In software technology, SOLID is a
an acronym representing a set of five principles of
object-oriented design. These principles were presented by
Robert C. Martin in the 2000s as a guide to creating
software that is more scalable, flexible and easy to maintain.
Below is a brief description of the
five SOLID principles:
Single Responsibility Principle (SRP): Each class
or module must have a single responsibility, which means that
There must only be a reason for it to change.
This principle helps to avoid complexity and confusion in the
software design.
Open/Closed Principle (OCP): Software Entities
(classes, modules, etc.) must be open
for extension but closed for modification. In others
words, new ones should be able to be added
functionality without having to modify existing code.
Liskov Substitution Principle (LSP): Derived classes must
be replaceable by their base classes
without affecting the behavior of the program. This principle guarantees
than code that uses a base class
can use any derived class safely and consistently.
Interface Segregation Principle (ISP): The clients of a
object must depend only on the
interfaces they need, rather than relying on interfaces they don't
use. This principle helps
to avoid unnecessary dependencies on classes and reduces the
system complexity.
Dependency Inversion Principle (DIP): The modules of high
level must not depend on modules
low level. Instead, both must depend on abstractions.
Also, abstractions should not
depend on the details, but the details should depend on
the abstractions. This principle
Helps reduce coupling and increase flexibility of the
system.
We selected a
video regarding this topic.
Clean Code
Clean Code (Código Limpio) is a term
used in software engineering to describe a
programming style that focuses on writing code
readable, easy to understand, maintain and extend in the
time. The goal is to produce a clear, concise code
and efficient, easy to read and understand by others
programmers.
The Clean Code concept was popularized by Robert C.
Martin in his book "Clean Code: A Handbook of Agile Software
Craftsmanship", in which he proposes a series of practices and
techniques to produce high-quality code.
Some of the code features
clean include:
Good structure: the code should be well organized and
structured,
so that it is easy to understand and follow the flow of the
logic.
Descriptive names: variables, functions and methods must
have descriptive and meaningful names that reflect their
purpose
and function.
Helpful comments: code should be well documented with
comments
tools that explain the logic behind the code, rather than
simply
describe what the code does.
Small, cohesive functions: Functions should be small,
cohesive
and do one thing. In this way, they are easier to understand,
prove
and keep.
Proper error handling: The code must properly handle errors.
errors and exceptions, to avoid problems and behaviors
unexpected.
Listen to this podcast to learn a little more about Clean Code.