Right Stuff

logo

Friday, November 26, 2010

Leap from Beginner to Intermediate Developer PART III

TIP # 3: Learn good programming habits

Quality makes the application masterpiece and it's the responsibility of the developers to focus more on high quality coding. Nothing marks an inexperienced programmer like bad variable/function names, poor indentation habits, improper formatting, confusing/un-wanted comments and other signs of being sloppy. All too often, a developer learned how to program without being taught the less interesting details such as code formatting. Even though learning these things will not always make your code better or you a better developer, it will ensure that you are not viewed as an entry-level developer by your peers. Even if someone is a senior developer, when variables are named after their favorite verbs as opposed to meaningful names or their functions are called “doSomething(), they look like they do not know what they are doing, and it makes their code harder to maintain in the process.

Let me take example of indentation. It’s really a bad practice to use spaces to indent; instead use tabs. A tab character represents a virtual indent. If you want to indent two levels, use two tabs. The problem with spaces is that nobody ever uses the same number of spaces for indentation, even within the same file. Some people use eight spaces; others use four; some use two; and still others use some crazy in-between variation. Manually adding or removing indentation is tedious and error-prone because you have to add or delete the proper number of spaces.

You would be glad to know about Octaware’ initiative of a developer session being planned by senior industry architects on “Practices for becoming a better programmer”. This session will cover good habits one should follow in day-to-day programming. Stay tuned for the announcement of the upcoming session.

-Aslam

1 comment:

  1. Thanks for a great post,

    for indentation in C# and markup I generally use Ctrl+K+D which auto formats the code according to MS standards.

    ReplyDelete