DEV Community

Cover image for Development principles you should know
Israel Blancas
Israel Blancas

Posted on

Development principles you should know

In our industry, principles are rules and recommendations to follow during software development to make it easy to maintain and evolve. Developers can apply these principles at various stages of the software development process, from planning and design to implementation and testing. These principles can look not so valuable when somebody is at the beginning of their career. On the other hand, they make sense when you start working on more professional applications.

During this post, I'll try to give you a quick view of some well-known software principles you should know!

You Ain't Gonna Need It

YAGNI is a principle that advises developers not to add unnecessary features or code to a software system. The idea is to keep the system as simple as possible. Adding new features happens later only if they are needed. So: rather than trying to anticipate future needs and adding them in advance, we only spend resources on creating something to satisfy our requirements.

Why is YAGNI important? Keep the product as much simple as possible, not adding stuff that will not bring value to the final customer, is a good practice: you don't waste resources and ensure your technical debt will not increase.

Don't Repeat Yourself

DRY is a principle that advises developers to avoid writing redundant code. The idea is to ensure that there is only one source of truth for any given piece of information within a system. This makes it easier to maintain the system, as you only have to update a single piece of code rather than searching for and updating multiple copies of the same code. You can reuse logic you wrote before: write once, use thousands of times.

Why is DRY important? Because you don't need to solve the same problem multiple times. If, for instance, you wrote a method to calculate the price of something... why do you need to write the same again in another place of your code? Also: if you fix a bug in one of the methods, you might forget about propagating the change to the other implementations of the same agorithm.

Keep It Simple, Stupid

KISS is a principle that advises developers to keep their code and design as simple as possible. The idea is that simple systems are easier to understand, maintain, and modify than complex ones.
It is a similar principle than Ockham's razor. Ockham's razor is a principle of parsimony which states that, when presented with multiple explanations for a phenomenon, one should select the explanation that makes the fewest number of assumptions. So: if you have multiple posibilities to implement something... what is the correct? The simplest.

Why is KISS important? Remember you will not be working alone when developing software. Keeping stuff simple, will help new contributors to understand your methods/architectures/systems easier... Find (and fix) bugs will be a piece of cake!

Law of Demeter

LOD is a principle that advises developers to reduce the number of dependencies between objects in a system. The idea is to minimize the amount of knowledge that an object has about other objects, as this can make the system more modular and easier to maintain.

Why is LOD important? It will help the KISS and DRY pinciples. Also... it will help you for testing purposes!

Separation of Concerns

SOC is a principle that advises developers to divide a software system into distinct parts, each of which addresses a separate concern. The idea is to make it easier to understand and modify the system, as each part can be developed and tested independently of the others.

Why is SOC important? Imagine, for instance, you integrated an application with a database. After some time, for cost reasons, you need to switch to another system. If the application is really coupled to the database (you have calls to the database API across all your code), the costs of using a new database will raise. But, if your code calls an intermediate piece of code thata acts as an interface for the database, you only need to change the implementation of its methods!


SOLID is an acronym for five design principles for writing maintainable and scalable software. They are:

  • Single Responsibility Principle: A class should have one and only one reason to change.
  • Open-Closed Principle: A class should be open for extension but closed for modification.
  • Liskov Substitution Principle: Subtypes should be able to substitute for their base types.
  • Interface Segregation Principle: A class should not be forced to implement interfaces it doesn't use.
  • Dependency Inversion Principle: High-level modules should not depend on low-level modules, but both should depend on abstractions.

Why are SOLID principles important? They mainly resume the others!

These are just a few examples of software development principles that can help developers create high-quality, maintainable software. By following these principles, developers can help ensure that their systems are flexible, scalable, and easy to modify over time. Which others do you know?

Top comments (0)