The Developer Stash

Arbitrary Contemplations
posts - 19, comments - 27, trackbacks - 0

My Links

News




Locations of visitors to this page

 





Elroy D'silva's Blog

Twitter












Archives

Post Categories

Blogs I read

Developer's Stash - 10 Things I do to code better

 
    After being into the software development career for more than a year now, I feel I understand what is expected from a "Software Developer". There are a lot of things that need to be done, and they need to be done with care. I see everyday that a lot of developers around me take software development as a job-to-be-done and not as a passion. Anyways, I'm here to talk about what I, as a software developer do to write better code everyday. Here's the list:
 
 
Keeping my code clean
Clean code could be described as code that is easily readable, and at the same time quite understandable. Stuff like proper indentation of code and the related comments can make your code look delicious.
 
Writing comments
Clean code and better comments make everyone's life simpler. Good comments are those which describe the 'WHW' (what, how and why) you do a particular thing in your code, in the simplest possible way. I call it "The expected WHW". Explaining this shouldn't be like writing an essay. Comments should be highly precise.
 
Writing Pre-conditions
Your code doesn't always stay with you. Everyone in your team should understand the pre-conditions and context when invoking a particular method that you might have written. The method which is being called should clearly describe it's pre-condition. Pre-conditions can be something like "The Person object should be initialized by calling the Person.Init() method" or something like that. Here, if the object 'Person' wasn't initialized, it may result in errors when other developers use methods that use the 'Person' object. This step helps other developers to use your code effectively.
 
Loose coupling
I always use this design principle to stay on the safer side with regards to scalability and maintainability. Loose coupling enables you to define boundaries within your code structure, and helps make easier the testing of the code and handling later changes in the code. This is one thing a developer's architect or designer might have a say in, but as far as I am concerned, I do have the liberty to suggest better coupling structures, however, they are happily trashed if we foresee any problem.
 
Knowing your programming language well
I'm always stuck in this conquest of mastering the programming language I use for coding. I keep switching from C++ to C# and vice versa but, I don't really understand which one to choose as they both have their own supernatural powers. I love C# for its simplicity and it's always a pleasure to work with it on Visual Studio. I came across a guy (who has always been working in C++) lately who was using C# .Net and was doing some kind of string processing. He had written around 10 lines of code for splitting strings (the C++ way, character by  character) based on a few characters but, never did he know that there is already a method called String.Split() that was readily available for use. It is difficult to know everything in the very huge .Net Framework, but the more you know the better your life becomes.
 
Learning Tips and Tricks
I always try and learn new tips and tricks to use my development IDE (Visual Studio) in the best possible manner. These tips and tricks help you to perform faster. Consider using keyboard shortcuts rather than moving your hand to the mouse and then searching for the respective button to be clicked in the IDE. This reduces the time in interaction with the IDE and would give you more time to think about your code. I learn tips and tricks in coding i.e. how something could be done in the best possible way.
 
Using Source and Version control software effectively
Source and version control software sound like an unnecessary nightmare to a low-on-experience software developer. I've had great times with Rational ClearCase. It's annoying ways help me learn more about it. Although a merge always screws up my code, I love the concept of source and version control because it enables me to code without the fear of losing my previously written code by mistake. I'm still in the process of taming this wild animal called "ClearCase".
 
Following coding guidelines
I always try my best not to be cursed by my fellow developers for not following the coding guidelines. Adherence to these guidelines helps developers to understand the "The expected WHW" of your code. This in turn helps you keep the code clean.
 
Reviewing my code
I always perform a self review of the written code before sending it for a review to the other team members. Reviews help you identify defects in the code at an early stage. Defects might miss out ones attention but, it might get caught by someone who would look at the code in a different manner or it may be easier for someone who has been working on the same thing for a long time to point out the possible defects in the code.
 
Knowing the context
Last, but never the least, it is a must to understand the entire context of usage of your code especially when you are adding particular functionality to existing code. There's always a chance that your changes could affect and break other's code. Always consult the original developers who had written the earlier code and get your code reviewed from them to avoid unexpected and vexing results.
 
 
This is a compilation of some things that I think help me in learning to code better. Opinions may vary, and if you’re still reading, I would like to hear your opinion on this. What do you think are other things that developers need to take care of?


kick it on DotNetKicks.com

Print | posted on Saturday, September 06, 2008 12:08 PM | Filed Under [ Developer's Stash ]

Feedback

Gravatar

# re: Developer's Stash - 10 Things I do to code better

Everyone should own a copy of the The Pragmatic Programmer [PP].

Loose coupling: PP section 26
Learning tips & tricks / effective version control: PP section 16, 17
Preconditions: PP section 21

"Knowing the context" is made much easier by loose coupling.
9/8/2008 4:45 AM | chris
Gravatar

# re: Developer's Stash - 10 Things I do to code better

try netbeans, it will surely rocks your world.
http://www.netbeans.org/
9/8/2008 5:11 AM | alcmontejo
Gravatar

# re: Developer's Stash - 10 Things I do to code better

@alcmontejo

NetBeans isn't an option for me. I work in C# and C++ on VS.


@chris

It's nice to hear that I'm on the right track. I'll consider buying a copy very soon. Then, probably, I'll have more than just 10 things.


9/8/2008 4:12 PM | Elroy
Gravatar

# re: Developer's Stash - 10 Things I do to code better

This is a nice article and definitely it helps the people to be intact.

Out of all, my vote goes to "Learning Tips and Tricks" and "Knowing your programming language well" as these two have a major impact on how fast and effectively you can deliver. Rest of all can very well be improved upon.

Nice write up!

Cheers,
Raghavan alias Saravanan M.
9/10/2008 5:13 PM | Raghavan alias Saravanan M
Gravatar

# re: Developer's Stash - 10 Things I do to code better

Its great concept to improve software development performance. Its all about logic. If it is independent then it is easy to handle.

Try to break logic as much as possible and develop.

Write small function rather then bigger.

Write more class with limited no of method rather than less no of bigger classes.

It helps more to us and others.
9/11/2008 2:23 PM | Vipul Tailor
Gravatar

# re: Developer's Stash - 10 Things I do to code better

Only one year of professional software development? I have worked with many developers claiming many more years of experience who still don't grasp any of your ten points.

Oh yeah. 100% agree with Vipul.
9/12/2008 8:40 PM | Norman
Gravatar

# re: Developer's Stash - 10 Things I do to code better

Hey! Great website, thanks for pointing me over here, definetely a great and helpful article!

Steph
9/30/2008 8:27 PM | Steph
Gravatar

# re: Developer's Stash - 10 Things I do to code better

Great work Elroy! You seem to have learned so much in an year!Cheers!
11/5/2008 11:22 PM | Aditi
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: