Principals and Best Practices
Principals
In here we can identify there are three types of principals,
- S.O.L.I.D
- Guidelines- Approaching the solution
- Guidelines- Implement the solution
- S.O.L.I.D
Why we should follow S.O.L.I.D principals?
- There are many reasons have for that few of them are to maintain high coding standards, make the code universally understandable and repairable.
- Approaching the Solution
Under this topic there are six principals,
- Think throughout the problem.- This means first think and understand the problem clearly before jump in to coding.
- Divide and Conquer - This means break the problem in to small parts and implement solutions for that small parts and then merge the all to solve the main problem.
- KISS (Keep It Simple and Stupid) - This means always keep the solution simple, motivate to use simplest solutions than complex ones.
- Learn from Mistakes - Always anticipate and embrace changes and do not introduce new bugs when implementing.
- Reasons for software exists- Always keep the picture of why we need this software if the implementer loose the picture might cause follow the wrong path and implement something else than customers needs.
- You won't be using the software - Always assume you not the one who gonna use this software, if you are think you are think the user also have same knowledge as you, you will loose the user experience level because everyone don't have technical knowledge as the implementer so that user might not understand the logic you have used.
- Implement the Solution
Under this topic there are seven principals,
- YAGNI (You Are Not Gonna Need It ) - This principal lead programmer not to predict the future things and implement solutions. This leads to only implement solution want in that moment requirements.
- DRY (Don't Repeat Yourself) - This repeating is eliminated via abstraction, always re use the codes via relationships between entities.
- Embrace Abstraction - This is the most important concept , this concept make system functions properly without knowing implementation details of the system and this lead code's quality, re usability and maintainability.
- DRITW (Don't Re Invent The Wheel) - If a solution is already existing for your solution don't go to re invent things and make complex the solution use already existing approach and implement your solution by using it. Design patters are the best example for this.
- Write Code That Does One Thing Well - This means when you are implementing the functions you are used only use for specific things don's use same function for do multiple tasks at the same time that may make the code complex and hard to debug when occur a bug.
- Debugging is harder than writing the Code - Normally people are not smart enough to debugging so implement the solutions much as simple and readable its will help you to when coming debugging.
- Kaizen - Leave it better than when you found it - This principle leads to improve the team spirit. Helping other members to finish their works.
Best Practices
Under best practices there are five best practices we are discussing here,
- Unit Testing - Unit testing ensure the specific function or class work as expected.
- Code Quality - Code quality means code should be readable and understandable.
- Code Review - Get reviews from the seniors is the one of the best way to improve the quality of the product.
- Version Controlling - Can make changes without breaking the code and multiple developers can work with the same code by using version controlling.
- Continuous Integration - By continuous integration developers can identify errors early and fix them easily and each checking verified the building.
No comments:
Post a Comment