Back to Drupal Training Syllabus
Best Practices in Programming
Code readability is a universal subject in the world of computer programming.
Learning Objectives
Learner will be able to code using the Drupal coding standards. His/ her code will be readable as text reading (to an extent)
Course Content
-
Coding standards
-
Understand the requirement clearly
-
Consider others when you do anything
-
Code Quality
-
The rule of 30 minutes
-
Acknowledge emails
-
Art of following up
-
Read code
-
Try to up-to-date in technology
'Code is also written for humans to read, not only for computers to execute'
- Erki Lindpere.
In the drupal development environment, a developer should follow Drupal coding standard.
Points to cover :
* Indentation
* Comment
* White space
* Control structures
* Naming conventions
More reads : https://www.drupal.org/coding-standards
It is the responsibility of the developer to understand the requirement clearly before starts development. There is no wild card game of guess or assume, that may lead to something that is entirely opposite to client's need.
http://free-thinking-cap.blogspot.in/2011/10/points-of-view.html
This is one important aspect to consider while coding. Code should be human readable.
http://blog.wurkit.com/expert-of-professional
Once the developer starts to follow the Drupal coding standards, code quality will be good.
http://drupal.org/coding-standards/docs – API documentation and commenting standards.
http://drupal.org/node/2497 – SQL coding standards
http://drupal.org/node/223584 – Drupal mark-up style guide
http://drupal.org/node/302199 – CSS coding standards
http://drupal.org/node/172169 – Javascript coding standards
When the developer cannot find a solution for 30 minutes of research, get help from others. It is not advisable to waste time.
Develop a habit of acknowledging to all the requests or mails. This will build a rapport.
While working in an environment where multiple priorities are set, it is necessary to follow up properly to get the work done.
There are a couple of aspects that need to be kept in mind.
1) Follow up action has to be initiated with adequate time between two actions
2) Maintain the gentleness through wise choice of words
3) Use a combination of mediums (project tracker, face to face, phone, email). The ideal way would be to a phone call or face to face meeting, followed up immediately with an email.
Familiarity with the code helps to find solution faster. By reading code, developer will learn to write good code.
Follow technology closely. Watch what is happening in drupal, html, css, web-development or what is happening in software as a whole.
Drupal planet is a good place to start with : http://drupal.org/planet
Useful websites
http://css-tricks.com/
http://www.codinghorror.com/blog/
http://arstechnica.com/
http://lifehacker.com/
http://techcrunch.com/
http://www.wired.com/
http://mashable.com/
http://slashdot.org
http://xkcd.com/
Reference
http://www.slideshare.net/zyxware/code-quality-aesthetics-functionality-...
http://code.tutsplus.com/tutorials/top-15-best-practices-for-writing-sup...