Archive for October 2011

Week 42, year 2011

  • Code Folder Structure - All code bases I ever read or worked with, share a similar folder structure: Controllers BlogPostController CommentController Models BlogPostModel CommentModel Views BlogPostsView BlogPostDetailView Helpers … The ones where the developer has read Domain Driven Design, or is using Doctrine2 or Hibernate, usually have a better focus on the domain model: Model Entities BlogPost Comment User Repositories BlogPostRepository CommentRepository UserRepository Services UserService … The philosophy of these folder structures is usually inspired by the frameworks they use. After all, if your framework is organized like this, it must be a best practice, right? It does make really good sense for a framework to be organized in packages [modules, components, …] like this. For your application, it’s a missed opportunity. You are not communicating the role each class has in relation to others, or the dependencies it has. A BlogPostRepository and a CommentRepository have no direct relation to each other, apart from the fact that they are both Repositories. However, a BlogPostRepository has a very tight dependency on BlogPost. [Mathias Verraes]
Permalink | From 17 October 2011 to 23 October 2011 | Last updated on: Mon, 7 Jun 2021 09:18:52 GMT