Javascript Best Practices: Writing a SOLID Code

Mariano De Simone
7 min readMar 6, 2023

A guide on how to write more scalable, maintainable, robust, and clean code.

Let’s be honest; most of us at least once had that “awesome” interview (please note the quotes for irony) where the interviewer asked you:

  • “Can you please explain to me what are the SOLID principles?”

When that question arose, I started thinking:

  • “I do not remember what the acronym stands for, less I will remember an explanation.”

So after that lost battle, I did a favor to myself and learned it. So now I will do a SOLID to you (cuak! — terrible joke) and explain it in this article.

Here we go…

The SOLID principles are design principles that help developers create easy software to understand, maintain, and extend. These principles were introduced by Robert C. Martin (also known as Uncle Bob) and are essential for writing high-quality, scalable, and robust code. This article will explore the SOLID principles and show you how to apply them in JavaScript with code examples.

Unbreakable
Unbreakable — Photo by Kahar Erbol on Unsplash

SOLID Principles Overview

The SOLID acronym stands for:

  • Single Responsibility Principle (SRP)
  • Open-Closed Principle (OCP)

--

--

Mariano De Simone
Mariano De Simone

Written by Mariano De Simone

Javascript Developer, Digital Marketing Specialist, amateur runner and history & philosophy books fan. Love to read when I'm not coding or writing.

No responses yet