Being a programmer is not only about writing code that works, but also about writing better code. You should not only write quality code but also make it right as you go along. OR you can do it as soon as you finish the task.
Write better comments
- For vague lines of code, write a single line of comments.
- For tricky logics or blocks, write descriptive comments.
- Don't assume everyone can understand your code.
- Don't forget, keep your comments up to date.
Code Refactoring
- The top most habit of highly effective developers is code refactoring.
- Do you have good health in your code? If not, keep it healthy.
- Your methods, functions, variable names, and the number of arguments a method receives should all be refactored.
Use a coding standard
- It's easy to write code, but hard to maintain and understand. By following a standard, your code will always be deterministic, regardless of the code type.
- It's not necessary to follow an existing standard, you can create your own.
Use meaningful names
- Be sure that variables, methods, classes, files, etc. have meaningful names.
- You should avoid using short names, because they might be difficult to understand by others.
- Use a consistent naming scheme, such as camelCase or Underscore.
Use a system of code backup
- If your code wasn't backed up or your system wasn't working due to an error, what would you do?
- Make it a habit to push your code to a distributed system like Git.
- A distributed version control system (git) will simplify your life.
Code reviewing
- Code review is always a good thing for coders. You should always review other skilled developers' code on Github. You will get to learn so many things.
- Offer to let other members of your team or other people review your code. Just note down all the feedback and follow them as much as possible. Trust me, it always makes your code better.
Don't repeat code
Whenever you have code that will be used more than once, it is better to separate it into a class or file.
Don't write long functions
Writing long functions is very difficult to read and understand. Keep functions short as much as possible.
Organize directory structure
Most of the projects do have lots of files and resources. It's good to have to organize all the files into smaller groups according to sub-modules.
Delete unused code
Don't keep unnecessary code in your main working project. If such code is not required, just delete it or keep it somewhere else.
- Use a design pattern
- Avoid global code
- Use automated build tools
- Use Testing framework
- Use Code Documentation
- Contribute to open-source projects
- Accept challenges and do them.
- Improve logic by solving problems daily.
- Always keep patience
Feel free to reach out if you have questions or if you want to contribute in any way:
- E-mail: [email protected]
- Instagram: https://www.instagram.com/ios_geeks16/
- Medium: https://medium.com/@nitinagam17