Mastering Web Application

(Rick Simeone) #1
Chapter 2

Common strategies of solving this problem involve grouping files by a feature
(package by feature), by an architectural layer (package by layer), or by a file type.
What we would like to propose here is a hybrid approach:



  • Most of the application files should be organized by feature. Scripts and
    partials that are functionally related to each other should go together. Such
    an arrangement is very convenient while working on vertical slices of an
    application since all the files changing together are grouped together.

  • Files encapsulating cross-cutting concerns (persistence store access,
    localization, common directives, and so on) should be grouped together.
    The rationale here is that infrastructure-like scripts don't change at the same
    pace as the strictly functional code. In a typical life-cycle of an application
    some technical infrastructure is written early on and the focus is shifted
    to the functional code as the application matures. Files in the common,
    infrastructure level area are best organized by an architectural layer.


We can directly translate the above recommendations to the following directory
structure of the sample application:

Free download pdf