Print this page

10 Best-practices to follow when developing on .NET / PHP

Written by Ritwik Ruia Wednesday, 17 September 2014 09:36

There are so many ways to go about coding and managing your repositories. Here’s a list to get started on implementing the best methods:

  1. Keep the code precise. More code doesn’t necessarily mean good code. Care should be taken to keep the code as short as possible as long lines of code hamper execution and make it difficult to trace bugs. Long SQL queries also need to be broken down at the time of embedding them in the code so as to minimize deep nesting and facilitate code compilation.
  2. The most effective coders use comments and indentation in a way that can be comprehended by anyone. Naming your variables in a sequential manner helps keep trace of their usage and scope. It is always better to start the method name with the action it is going to perform and its purpose.
  3. Version control is essential in coding, especially in collaborative projects. In the quest for continuous improvement and bug removal, code for most applications and software is modified regularly. Version control plays an indispensable roll in tracking these changes and rolling back to previous iterations as modifications are made and tested, and your roadmap changes. Proper version control can systematically take you back to the specific milestone you want to trace; else it can be a very cumbersome and time intensive task. There are many revision control software available. The most popular version management software are: Git , Subversion (SVN) and Perforce.
  4. Another important practice is to maintain data integrity, i.e. not mixing the code with the data. This increases the readability and comprehensibility of the code. The application should be made robust so that it is devoid of any SQL injections and improper session management.
  5. It is important to trace any exception to the highest class so as to know the cause of the specific error and debug the same. It is as important to be mindful of time spent tracing errors, as it is to actually solve them.
  6. Try using positive conditions as far as possible as they make the code more readable than negative conditions. Understanding and managing the code becomes easier with higher use of positive conditions, as too many negations can become confusing and misleading.
  7. It is always good to pattern the code in an ORM (Object Relational Mapping) model as we follow OOP (Object Oriented Programming) concepts in most modern day coding languages.  They make the code stable and reusable.
  8. For the application to perform seamlessly, connection pool may be maintained. Instead of creating and terminating the database connection every time, connections can be made available in the pool from where they can be picked at random and relieved on completion of the task.
  9. Any application should be properly designed as per the software design architecture. Before proceeding, the number of tiers - whether 3 or 4 - may be ascertained so that conformity in the software design is achieved.
  10. Use a collaborative platform for development, like Github. Github is the most powerful and widely used collaboration platform for software development and makes it incredibly simple to share code with others, perform code review and manage code repositories during projects.
Last modified on Friday, 24 March 2023 11:17