I’m having a hard time coming up with informative and useful class names. One class I am have this problem with makes requests to websites/servers. I thought it would only be fitting to name this class ServerRequest which is within the package of ServerServices. This package also contains the classes ServerData and ServerImage. ServerData parses the response from ServerRequest and creates objects. ServerImage will copy remote images to local machine using ServerRequest.
I don’t feel like it’s good practice to prefix every class name. At the same time I don’t want to simply name the classes Request, Data, and Image. Without the prefix the names lose their meaning, not to mention how common they become.
What are good conventions to use, beyond CamelCase and using nouns?
What are some examples of class names to use for the three classes above?
Well if you’re going to have
ServerData,MailData,UserDatathen the prefix is certainly a good idea to know whichDatawe’re talking about. But if class-name confusion isn’t a problem (also depends on the scale of the project…) you could regroup all your classes under thesomething.here.serverpackage and keep simple class names likeRequest,DataandImage.It’s all about aiming for maximum readability and code clarity.