Robert C. Martin in one of his talks about clean architecture openly criticizes fairly standard way of doing things nowadays. Robert C. Martin - Clean Architecture and Design
What I understand as standard way
is something like this:
solution
- UI project
- Models
- Views
- Controllers
- Assets
- Logic project
- Data project
Martin here says, that the application should reveal its purpose immediately when you look at its top level directory structure... I wonder, can anyone provide an example of such directory structure, for instance while using MVVM pattern as a delivery mechanism? How can one structure his application the way Martin is describing?
From what I see in your example I can only guess that it is a ASP.NET MVC application, we need to take a look at the Logic
or Data
projects to understand what this application is about.
Most of the time people organize all their directory structure based on the technology or framework used. This comes from the way default project template are created (knowing nothing about what your application is supposed to do they really can't do much more than that for us).
Now, what Robert C. Martin tells us is that our top level directory structure should reflect on what the application does and not how it is built. I'm not sure it is a good idea to do that at the solution level. However, I always recommend to have a Domain
project were we could apply Domain Driver Design principles.
If in such Domain project you see at the root level the following folders:
Clients
Orders
Billing
Shipping
Promotions
...
You could guess it is some kind of E-commerce application. You would have to go even deeper in the directory structure if the folders you would have found are like Models
, DTOs
or Exceptions
.
I don't like to have too many projects in my solution (under 10 if possible) so I don't go and create one project per domain object of my system. This is why I think the root level of projects not solutions are were we should focus our attention on defining what the application is doing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With