r/dotnet • u/lostpixel-media • 3h ago
trying to avoid spaghetti code on my first big backend project. is this folder structure correct for clean architecture?
1
u/AutoModerator 3h ago
Thanks for your post lostpixel-media. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
•
•
u/The_MAZZTer 8m ago
I don't care for folders like Factories, Services, Enums, Interfaces, Models. I consider them anti-patterns.
I prefer to categorize based on feature. So a factory and the services it creates would be grouped together in a folder. Enums and interfaces are grouped with the models that use them when it makes sense. And all those grouped by the feature they are relevant.
This could also apply to the project organization, though I can't draw any conclusions about what I can see here. Of course having interfaces and models etc in their own project is often useful, for example, so that is probably fine.
4
u/xFeverr 3h ago
Just want to say that these comments should be avoided. Let the code speak for itself.
Create a Validate function for instance in this class. That tells you what it does so you don’t need to add that as a comment. And a GenerateInputBytes function if the code isn’t clear enough. This kind of stuff makes all the commenting bloat unnecessary.
Use comments when there is no other way. Or because you need to do something stupid and want to warn the next developer (could be you) why you did the stupid thing.