6 Key Coding Principles
Sardar Mudassar Ali Khan
Posted on May 17, 2023
Here are six fundamental coding principles every programmer must adhere to -
1️⃣ DRY (Don't Repeat Yourself): This principle emphasizes minimizing redundancy in our code. If you find yourself writing the same code more than once, consider a function or a class instead.
2️⃣ YAGNI (You Aren't Gonna Need It): The YAGNI principle tells us not to add functionality until deemed necessary. It's a practical approach that helps us avoid wasting time on features that might never be used.
3️⃣ SOC (Separation of Concerns): This principle encourages dividing a program into distinct sections, each handling a specific aspect of the functionality. This separation results in better organized and easily maintainable code.
4️⃣ LOD (Law of Demeter): Also known as "principle of least knowledge," it promotes loose coupling between software components. It suggests that an object should only communicate with its immediate neighbors and not with the whole system.
5️⃣ KISS (Keep It Simple, Stupid): The KISS principle is all about simplicity. The simpler and more straightforward your code is, the easier it is to understand, maintain, and debug.
6️⃣ DYC (Document Your Code): While not a traditional acronym like the others, this principle is equally important. Your future self, and other developers who will work with your code, will thank you for clear, concise documentation.
Posted on May 17, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.