Chapter 5: Layering

Anatoly Volkhover

Break your system into layers and keep them separate. Consider creating a domain-specific language (DSL) for the application layer, as a way to promote simplicity and separation. If using general-purpose language (GPL) for building the application layer, create a restrictive framework and a process to keep the application layer from intermingling with the layers below.

Break your system into layers and keep them separate. Consider creating a domain-specific language (DSL) for the application layer, as a way to promote simplicity and separation. If using general-purpose language (GPL) for building the application layer, create a restrictive framework and a process to keep the application layer from intermingling with the layers below.

  • Andrew says:

    Hi Anatoly,
    There is a tiny typo “augmentSerices()” at least in kindle version, page 63.

  • weldon says:

    Is the calling signature different after myBankingService implemented by augmentServices?

    Before:
    myBankingService.deposit(…)

    After:
    myBankingService[“deposit”](…)

    Am i right? I’m not familiar with TS

    • anatoly says:

      In typescript/javascript, there is no functional difference between
      myBankingService.deposit(…)
      and
      myBankingService[“deposit”](…)
      The difference is that the first version is validated by the compiler – it checks that the deposit() method is defined for myBankingService, and the second version leaves the validate for runtime. The second syntax is not advisable unless you need to compute the name of the method to be called dynamically, and the expense and the compile-time static type check.

  • Yannick says:

    Hi,

    In this chapter, you propose to use the Proxy pattern to keep the business logic as short and pure as possible.

    I was looking the difference between the Proxy and the Decorator pattern, and I feel that the Decorator pattern is more suitable for the goal.

    Indeed, we read in the GoF:
    “Although decorators can have similar implementations as proxies, decorators have a different purpose. A decorator adds one or more responsibilities to an object, whereas a proxy controls access to an object.”

    What do you think?

    Yannick

  • >