Why do you need an app folder in js applications?

  • 0

    I saw such a screen, and thought, why do we need the app folder in js applications? why is it separate from the gulp and test folder?
    Is gulp and tests part of the application anyway? or not?
    JavaScript Anonymous, Jun 26, 2020

  • 1 Answers
  • 0
    There is such a word, Cohesion, i.e. relationships between entities. If this word is applied to the file structure, we can say so - the principles by which entities are combined in the file system. For example, pens can be folded by color, or by type (gel / ballpoint).



    So, it's the same in development. You can store tests next to files, because they are directly related to a specific entity. Conversely, it can be stored outside the application source, because sometimes it is considered that tests are not application code, but application code that is launched only at the development stage, and has nothing to do next to the application code.



    In fact, there are more points of view.

    Just depending on the idea, you can store the code in different places.



    Personally, I prefer option # 1, because it is more convenient from the development point of view (no need to climb the file structure, everything is in one place), and tests are inseparable from development (this is part of development), including the solution documentation, so for me it's one, so I keep them together.



    So that's why sometimes there is a separation:

    app - application code

    test - test code

    ... tons of other folders (support / env / static / assets, and so on).
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!