views:

151

answers:

2

I'm developing a small project in ASP.NET MVC to manage photos, but I don't know how to organize my classes in namespaces.

I have 2 base classes (Photo and Category). Should I put these classes into which namespace? Domain? POCO/POJO?

For Data Access, I have more 2 classes, PhotoDAO and CategoryDAO in DAO namespace. (Is it right?)

Which namespace should I put my business logic classes and how name them?

Does someone has any advice which design patterns I have to use/study?

I'm sorry asking so basic questions. Thank you.

+2  A: 

I firmly espouse the simplicity / refactor-as-needed approach.

In this approach you just put all your classes into one namespace, and get your code working. At whichever point in the development cycle you begin to feel 'cluttered' think about the classes you have and separate them logically into one or two namespaces that match how you think of each group.

As you go on, repeat this process regularly/as-needed and when your total file count grows you can consider structuring your folders to reflect your namespaces.

This may not be the way for everyone, but if the idea of get-it-done and then fine-tune appeals to you, then I would recommend this approach.

Updated:

Link to MVC tutorials which will give you an idea of how they recommend things be done.

John Weldon
That being said; the ASP/MVC folks have some 'conventions' they use that would be very helpful for you if you followed...
John Weldon
A: 

consider making category an enum (photo can have a set of categories). consider an album class. allow a photo to be in many albums. use the mvc mini-architecture. take a look at picasa.

Ray Tayek