Episode 08 – SOLID Principle

Clean Code

Episode 08

The eighth episode talks about the SOLID principle.

  • The source code is the design
    • The cost of design is expensive for software vs building a software
  •  Design smell
    • Rigidity, Fragility Immobility
  • Rigidity
    • System is hard to change.
    • Reduce build and test time
    • Long build time is a function of coupling
  • Fragility
    • Small change in one module affect another module
    • Manage the dependency in the module and isolate them from each other
  • Immobility
    • Internal component cannot be easily extracted and re-use in new environment
    • Immobility is due to coupling and dependency between the module of the system.
    • Decouple the central abstract in the application from database, UI and framework… etc.
  • Viscosity
    • Necessary operation like build and test, check-in, check-out, merge are difficult to perform and take a long time to execute
    • Exist due to irresponsible tolerance
    • Cause by tight coupling
    • decoupling module and manage remaining dependency
  • Needless Complexity
    • Coding additional needless complexity because anticipating change for the future that are not required
    • Use TDD so code changes in the future can be trusted with tests and no need for needless complexity now. Focus on current requirement.
    • Needless complexity related to tight coupling because we anticipate relationship of modules which currently are not related.
  • Code Rot
  • Dependency Inversion
    • Avoid having the dependency pointing to the same direction of the flow of control
    • Having dependency oppose the flow of control, prevent code rot by preventing application fan out from growing and coupling with low level.
    • Example, C++ v-table for virtual function, polymorphic dispatch mechanism in Java, C# and Ruby.
    • Inverse key dependency by using dynamic polymorphism.
  • What is OO?
    • Dependency inversion
    • Protecting high level policy from low level detail
  • Dependency Management
    • SOLID principle (Dependency related)
      • Single Responsibility Principle
      • Open Closed Principle
      • Liskov Substitution Principle
      • Interface Segregation Principle
      • Dependency Inversion Principle
    • Component Cohesion Principles
      • Release-Reuse Equivalency Principle
      • Common Closure Principle
      • Common Reuse Principle
    • Component Coupling Principle
      • Acyclic Dependencies Principle
      • Stable Dependencies Principle
      • Stable Abstraction Principle
  • References

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s