Objects + Idea of Single Responsibility
Two questions:
1) Let's say you have an instant messenging server. (I am using the conditional because I have already made the server and am really curious about the client, yet this is the same problem with an easier example to explain.) The server has to validate the user's registration, register the user on the MySQL database, and then send a packet to the user indicating whether the registration was successful. I am not using RMI, so the server will have to put together a packet containing a header (message ID, message length) and a body (NTStrings, integer flags, etc.). Should I have a single User object handle these three responsibilities and give the User object helper objects (a socket interface, a MySQL database interface, and an interface that handles the protocol) or should I create a RegistrationValidator object for validating the user's registration, a RegistrationInformer object for building a packet, and a DatabaseRegistration object for the database (with all of these objects using their logical helper objects that I mentioned before).
2)
{
Let's say for question (1), I choose to break the responsibilities of the User into a few classes. For sending packets to clients, should the server have classes for each packet (there are only like 5 or so packets) and have those packets build and send themselves? If so, should I use this in conjunction with a PacketFactory that takes theknow-the-implementation-and-do-the-instantiation responsibility away from the rest of the program?
Or if I choose the User-class-do-it-all route for (1), I could just have a PacketFactory that constructs a packet and returns an array of bytes to the requestor (in this case the User). This is what I did in my already-existing server program. (Once again, I'm using a hypothetical case because it best explains my questions in another case.)
}
I know that these questions may be a matter of preference but I am just wondering what you think is best in this situation. This may seem like a really picky and weird question but this is one of the few places that I can get second opinions =(.

