Clean Code

Practical Clean Code 2: Reduce Coupling

Image for post
Image for post

Overview

Reduce coupling

Source Code Level Dependencies

Image for post
Image for post
Figure A: Primary and it’s dependent

Dependence on Stable Entity

To be stable or flexible?

Image for post
Image for post
Figure B: Incorrect Source Code Dependencies
Snippet 1: Incorrect Coupling

Dependency Inversion Principle

Image for post
Image for post
Figure C: Correct Source Code Dependencies

Coupling Types

Data Models

Architecture Level

Wrap Up

References

Written by

Someone who bricked a motherboard after flashing the wrong rom because of trying to OC an intel celeron from 400mhz to beyond 600mhz in 3rd grade.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store