This content originally appeared on DEV Community and was authored by Sardar Mudassar Ali Khan
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.
This content originally appeared on DEV Community and was authored by Sardar Mudassar Ali Khan
Sardar Mudassar Ali Khan | Sciencx (2023-05-17T09:56:54+00:00) 6 Key Coding Principles. Retrieved from https://www.scien.cx/2023/05/17/6-key-coding-principles/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.