Brutally SOLID Typescript

I will teach and demonstrate stripped down SOLID in a typescript context.

SOLID [2] are 5 design principles that when properly understood transform the way you think about code and write code.

Brutalism Architecture, GEISEL LIBRARY BY WILLIAM PEREIRA. 1970, SAN DIEGO, CA. Ryan Kelehar via Shutterstock

Single Responsibility

“Classes, functions or modules have a single reason to change”

  • Functions, classes, modules, files and folders are to be consisted of a single domain or parts of that domain split up into units, thus the “single reason to change”.
  • Grouping together of unrelated code leads to unintended side effects in code in the form of bugs.
  • Small units have the benefit of overall workflows that can be tested individually.
  • Small units exposing APIs that are thought out in what their role is in their domain leads to easier composition.
  • Project structure should reflect these individual domains [ 5 ]
  • Personally I think it’s the most complex principal to follow.
我来评几句
登录后评论

已发表评论数()

相关站点

+订阅
热门文章