Common pitfalls

When we work on applications using MVC, it's common to find projects structured following the MVC acronym, as the following diagram illustrates:

MVC project structure

This directory structure indicates the following:

  • The project name is abc-web
  • This is a web application
  • The application uses the MVC architecture (structure)

Unfortunately, none of these points provide meaningful information for the team in charge of creating or maintaining an application. That is because a team working on a project is not interested in the file organization. Instead, it's much more useful to organize your code according to business rules, use cases, or other factors related to the business itself, rather than the technical aspects. 

With this idea in mind, we will suggest that a much more useful directory structure is as follows:

Understandable project structure
From this diagram, we can infer the following points:
  • This is an accounting system.
  • The main features of the project are related to the following, and more:
    • Income
    • Expenses
    • Reporting

Using the project layout shown in the preceding diagram, if we are tasked with fixing a report that is no longer working, we can think about reviewing the reporting folder. This approach is helpful for reducing the amount of time and effort required to accomplish project tasks.

We can conclude that the information provided by the second project structure is much more useful and practical, in comparison to the first one, since the first one does not provide information regarding the business at all.

Every single part of the project should communicate information regarding the business, rather than concerning the delivery mechanism or pattern used.

These details are small, but they are essential. At the beginning of this book, we mentioned that a good architecture is built around business requirements, and any goal that an architecture pursues should be understood by the whole team. We should approach every single detail with an aim to achieve this goal. Remember: details matter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.29.71