Design Principles & Component Principles

Hicham BEN KACHOUD
3 min readFeb 6, 2021

What is the differences?

Introduction

Today, i will tell you about what is important in programming. I used to hear that some programming languages or frameworks are more important than others, which is completely wrong for me.

I am not an expert in programming, but I found that the most important thing is the clean code, the structure and how the software is built.

So I decided to write this article to give you some information about the things that will help you to build strong softwares, and sure you should search about it and learn more.

There are two things: Design Principles & Component principles.

Those principles complete each other, the first one is responsible for creating strong components, and the second is responsible for arranging this components in large systems.

In this article I will give a definition of each of them, and I will describe the content of each with examples in the other articles to avoid confusion.

1- Design Principles:

SOLID PRINCIPLES

Firstly the Design Principles or the SOLID principle as the Oncle Bob defined it in 2004.

The goal of this principle is to arrange the elements into component in order to make theme:

  • Easy to understand
  • Easy to reuse in many other systems
  • Easy to change

The SOLID principle contains five important principles:

  • SRP: Single Responsibility Principle:

This is an easy principle to understand because of this simple name. It says that every module, classe, function … do just one and only one thing.

  • OCP: Open Closed Principle:

As Bertrand Meyer said: A software artifact should be open for extension but closed for modification. The goal is avoid changing existing code when adding new features.

  • LSP: Liskov Substitution Principle:

This principle clarifies the importance of substitution with subtype. It means that objects of a superclass shall be replaceable with objects of its subclasses without breaking the application.

  • ISP: Interface Segregation Principle:

This principle advises programmers to avoid depending on things that they do not use.

  • DIP: Dependency Inversion Principle:

This principle is the important one for me, because it is the main of clean architecture and which one crosses the boundaries. It means that code which implements high-level policy (domain code, logical code) should not depend on the code that implements low-level details (frameworks, database, UI). This is Abstraction.

I will write an article for each of this principles with an example for more understanding.

2- Component Principles:

When we talk about large systems, we should think about this principle because every large system is built with smaller components, so we need some rules for this component in order to make our system strong.

So this principle describes how components should be composed. One thing important about this principle is:

  • The component cohesion:

It tells us which classes belong in which component. It is already difficult to make this decision and it requires a good understanding of software architecture.

This subject contains three principles:

  • REP: Reuse/Release Equivalence Principle:

I am not comfortable with this one, unfortunately it says that to reuse components it should belong through a release process, and having a release number.

  • CCP: Common Closure Principle:

Like the SRP principle that says a class should not have more reason to change, CCP said that components should not also have multiple reasons to change.

  • CRP: Common Reuse Principle:

This principle helps us to decide which classes and modules should be placed into a component, but It also tells us which classes not to keep together in a component. It is the component version of ISP principle, It advises us not to use components that have what we don’t use.

Conclusion

In this article, i defined the most important thing in programming: Design & Component Principles, which are so helpful for programmers to create strong software systems.

This article is just a definition, in the next articles i will define each of the elements of both principle at time, and i will give an example of implementation. You should also search and learn about for more and more string understanding.

I hope this article was helpful and rich for you, don’t hesitate to share it with your network.

--

--