floater
Java Jedi
总版主
发贴: 3233
积分: 421
|
于 2008-04-19 09:30
depends on your service.
For login service, my experience is yes, you need that, , if you have tens of ways to verify them, user/password, nt login, digital certs, finger prints, face recognition, etc...
I have a dao interface so that users can specify in the runtime to output the result to console, database, file, special cache, or downstream targets.
Most important thing is that you have to think hard about the interface, the data you send across this interface. Using a Map on the interface is almost for sure is a bad idea because it makes the interface almost invisible at all.
For example, User load(int userId);
or load(User user);
which one is better?
insertUser(int userId, String password, String name);
or
insert(User);
which one is better?
int getUserId();
should this be on the interface?
How about this:
User.load()
and how about
load(User[] users)
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." - Martin Fowler, Refactoring - Improving the Design of Existing Code
|