Hoang Nguyen

Common Design Priciples: SOLID, OOP, DRY, WET

January 27, 2019 • ☕️ 1 min read

Writing a code which satisfies present requirements, also which can satisfy future requirement easily, should be the goal of every developer. Evolving with the time is the only factor which can keep you going

SOLID

Though they apply to any object-oriented design, the SOLID principles can also form a core philosophy for methodologies such as agile development or adaptive software development

  • Singple Responsibility: class should be having one and only one responsibility
  • Opened/Closed: classes should be open for extension but closed for modification
  • Liskov’s Substitution: parent classes should be easily substituted with their child classes without blowing up the application
  • Interface Segregation: many client specific interfaces are better than one general interface
  • Dependency Inversion: classes should depend on abstraction but not on concretion

OOP

Many of the most widely used programming languages (such as C++, Object Pascal, Java, Python etc.) are multi-paradigm programming languages that support object-oriented programming to a greater or lesser degree

  • Encapsulation: each object keeps its state private, inside a class. Other objects don’t have direct access to this state. Instead, they can only call a list of public functions — called methods.
  • Abstraction: each object should only expose a high-level mechanism for using it
  • Inheritance: The child class reuses all fields and methods of the parent class (common part) and can implement its own (unique part)
  • Polymorphism: is the ability (in programming) to present the same interface for differing underlying forms (data types).

More

  • DRY: Don’t Repeat Yourself
  • WET: Write Everything Twice

Hoang Nguyen

Software Engineer, iOS, Fullstack. Read my Resume