Monday, December 28, 2009

How to be a better programmer

Most of us think that we are very good developers but honestly speaking, it's quite a bit other way round. It's very common to see following piece of code,

bool myFlag;
if(MyFunction() == true)
{
myFlag = true;
}
else
{
myFlag = false;
}
If you write this kind of code then.....you obviously need help some hard work. If you don't and you are actually a decent developer, even then there is always room for improvement. So here's a guide for all those who believe in improving themselves.

Just like any other craft, there is no shortcut to becoming a better programmer, it's all good old classic hard work. Here are some tips which I have gathered over the years and which many other top coders recommend,

1. Read the Code

Read , read and read the code you write. Just like a normal essay writing, code gets better when you review it over and over. Reading the code helps in understanding the overall structure and catching errors which may come during run time. It infact directly affects your unit testing time as chances are that you will pass the testing in first attempt. My personal experience says that reading the code makes me catch errors which would otherwise be very tough to be produced by normal QA testing, mostly because of complex scenarios.

2. Read the Code....that's others Code

Going everyday to your job and writing code all day long doesn't make you a better developer. You would have to see what others are doing. Take up others code, that's of people who have a good reputation as a programmer and read their code. Internet is full of open sourced projects, many companies have opened the source code of many of their products, pick any product that you might have enjoyed using or about which you might have wondered that exactly how it was done and just read the code and play with it. This will teach what smart techniques people are using.

Apart from that, reading others code is an art which isn't that common. Some developers say that it's a gift. If you disagree with me then recall the last time when your manager tried to give you an existing code base and asked to change one of the major functions, chances are that it wasn't your favorite assignment. I believe, the fear of reading others code is more to do with the fear of unknown than anything else. So kill that fear of yours by reading codes of other developers including your colleagues, but just for the sake of keeping your social ranking intact, don't be too emphatic in terms of pointing their mistakes or rather don't point them at all unless you think that it's critical to the project.

3. Join an open source project

By joining an open source project you can get to experience many things very early in your career such as participating in more than one phase of SDLC, direct interaction with the client that's end user in this case, and a coding approach of your choice that's you don't really have to follow the red tapped process of the company. You could also see the results of your efforts much more quickly than normal long term projects which usually come software houses way. Overall open source project not only gives you first hand experience in terms of working with a team with a more active role than a normal junior or mid level developer and it also helps you in getting your communication skills fine tuned and understand end users requirements better.

You may say that it's not important to get to know end user in order to sharpen coding skills, but it in fact gives another perspective to your work because now you also have an idea of how the users are using your applications and what other future expansions are expected.

4. Learn more than one language

I can't emphasize more that how important it is to know more than one language. And if you are a computer science graduate then learning a new language should be second to your nature. Knowing more than one language gives you a new perspective in terms of approaching a problem and figuring out a solution. Every language has it's own constructs but it's always possible that a concept of Java can be used in some form in Dot Net. Similarly, your ASP.Net will definitely see a boast if you know how the underlying response/request process works.

So don't make the mistake of sticking to one language, try to keep your language profile diverse.

5. Basics first

If the only data structure you use is ArrayList or Hashtable then shame on you (seriously!). Keep your knowledge of basic data structures always updated, using a B+ tree instead of a binary tree might make all the difference in the performance of your algorithm but in order to do that you need to know what exactly B+ tree is. Similarly it's also good to know basic algorithms.

With the ultra fast machines we have these days, it's not really critical to have highly optimized code and any efforts in that regard would eventually make it difficult for you to maintain the code. But you still would have to keep a check e.g. O(N square) is definitely something to avoid. So you should be able to do some basic code profiling.

Enjoy programming!

Visual Studio 2010 and .NET Framework 4 Beta period extended

Dr. Somasegar, senior vice president of Microsoft recently mentioned on his blog that the release of VS 2010 has been moved back by a few weeks, as they are focusing on including user feedback after Beta 2 release. The fact is that VS IDE consumes alot of memory and has a habit of getting slow which kills the whole purpose of the IDE that's making programmers productive. And this is pretty much the problem users faced with VS 2010. The virtual memory usage has a lot of problems (IDE crashes are an evidence in that direction) and that's what Microsoft wants to look at and fix. I think it's better to delay the release and get it right than meet the deadline and push over the shit to the poor programmers.

Here's the note,
At the same time, you have also given us feedback around performance issues, specifically in a few key scenarios including virtual memory usage. As you may have seen, we significantly improved performance between Beta 1 and Beta 2. Based on what we’ve heard, we clearly needed to do more work. Over the last couple of months, our engineering team has been doing a push to improve performance. We have made significant progress in this space since Beta 2.

With these improvements in the product, we do want to make sure that they truly address the performance issues while continuing to maintain a high quality bar. As a result, we are going to extend the beta period by adding another interim checkpoint release, a Release Candidate with a broad “go live” license, which will be publicly available in the February 2010 timeframe.

Since the goal of the Release Candidate is to get more feedback from you, the team will need some time to react to that feedback before creating the final release build. We are therefore moving the launch of Visual Studio 2010 and .NET Framework 4 back a few weeks.
Link to Post : Visual Studio 2010 and .NET Framework 4 Beta period extended

Friday, December 11, 2009

Google Vs. Facebook

Google and Facebook are probably not competitors in the truest sense but they are definitely two sites which are always open on my desktop. A few weeks back, I was in Thailand on vacations and well I figured out that in terms of being smart, Facebook somewhat beats Google or GMail to be exact.

As soon as I logged into the two services for the first time from Thailand, here's what happened,

1. FaceBook took me to a new page stating that current location of my login is alot different from my usual login locations, so I need to submit my date of birth (along with year) in order to verify that I am actually Beenish. In contrast GMail must have noticed but didn't bother to raise the issue. So that's extra security measure on FB's part.

2. Once I verified, FaceBook then wondered if I know Thai and would like to switch to Thai, which is again a plus point. FaceBook was offering a functionality on the basis of demographic data, so now user can get advantage of it even if they didn't know about it. And no, GMail didn't mention anything.

3. The point where FaceBook completely outclassed GMail was the speed. As soon as FB identified my new location, it started fetching data from the servers near to that location and not servers near to Pakistan (my previous or default location.) All the members of my party complained that something is wrong with the internet, GMail is just not working and then I identified from the footer bar that GMail is trying to reach the servers which are near to Pakistan (or may have been dedicated for Pakistan)!!!! The service difference was just so obvious, GMail pages were taking like 5 minutes to load during which you are perfectly done with checking FaceBook and writing on a few walls.

So FaceBook is definitely smarter than Google or GMail to be exact :).