marcusolsson / goddd

Exploring DDD in Go
MIT License
2.41k stars 273 forks source link

Moving source code to src/pkg/app directory #29

Open Hyaxia opened 5 years ago

Hyaxia commented 5 years ago

Its just my opinion, but I think it will be much cleaner if you would take all the code that is connected to the project itself and put it into an additional directory. I have red that you want it to be as flat as possible, and it will be still flat, the code that matters, the way you implement DDD, all that is related somehow to the domain, application and infrastructure layers will all be in the same level as it is right now, but only inside another directory, separated from the other files that have a different purpose. And then at the first level of the folder tree you would have the cmd directory, pkg (or src or app or whatever you want to call it) and all the other remaining files that are related to setting up the application itself, like docker files etc...

marcusolsson commented 5 years ago

I'm on the fence on this, I'm not a huge fan of the pkg directory due to the extra level of indirection. Your arguments are valid though, so I would open this up for discussion.

Hyaxia commented 5 years ago

mattermost Have a pretty neat app structure that follows DDD principles (I guess you can say that it also follows the clean architecture). They have a model directory, it contains lots of file, that if would have been in the in the top level of the folder structure hierarchy would confuse you, and make you search for the README.md, or anything else that is related to the distribution of the project.

An even better name to what i proposed would be like in the project of Mattermost, to name the directory that holds all of the domain layer files, "model". Descriptive name of what it contains and leave the first directory clean of confustion.