In my early coding days, I would tend to group classes that functioned in a similar way. For example:
- Data transfer objects
- Object A
- Object B
- Dialogs
- Dialog A
- Dialog B
After a while, it started to frustrate me that when I was working on a particular part of the application, I would have to jump all around to piece it together.
In the last few years, I tend to organize things by feature. Classes that are commonly shared, such as database objects, I still keep together. I think this even makes sense for things like websites:
- Page A
- images
- Resource 1
- Dialog 1
- Page B
- images
- Resource 2
- Dialog 2
Is this the best way to do it? Does anyone have a good rule of thumb to follow?