thoughts on coding and everything in between
Tag Archives: c#
A very common (and sometimes heated) discussion among developers is: “Which is better – C# or VB.NET?” Answers that I have heard have ranged from “VB has a great ‘spell-checker’” (not kidding, that is a real reason that a developer gave to our team) to the statement that “Its the one I work with the most.” In my opinion, the best answer I have heard so far that sums it all up is: “Coding in C# makes you a better programmer.”
Of course, this reason is most certainly arguable and sounds very subjective, and there are lots of other good reasons, but I think that one sums it up the best. Perhaps more than half of those who would read this post will already be disgusted with me for making such a statement and might not even read further. But for those of you who like a good debate, by all means continue reading so you have a fuller context with which to either agree with me or flame me at the end! I am certainly not going to attempt to prove that C# makes better developers, but it is at the very least thought provoking. In fact, I wonder if we asked a group of developers from each side with the same basic skill level to take a short quiz, which ones would write better quality code – the VB or C# programmers? But again, that is not what this post is for.
So why do I think that C# makes me a better programmer? I liken it to how driving a manual transmission makes a me (and most likely anyone) a better driver. I think that manual transmission cars encourage people to be better drivers because there is much more attention to detail required throughout the entire drive time.
There is less opportunity to fall asleep at the wheel when you have to push and pull and coordinate feet and hands than when you only have to move one part of your body a very small distance.
You also have more control over the car and how it operates because there is more of you involved in driving. Your brain is forced to coordinate several things just to get the car moving forward not to mention making split second decisions.
There are also several things a manual transmission does that indicate whether or not you are doing the right thing – the sound of the engine is different, the way the car moves (or lurches) forward or backward, and even gas consumption is an indicator of how well (or poorly) you are driving. Since you are the one controlling all these things, the only way the car will perform better is if you drive better.
Coding in C# has done much the same things for me as driving a manual transmission. It has encouraged (sometimes forced) me to be a better coder because of the attention to details that are required.
When you are forced to think about the names you give things because the mere spelling of that name could cause problems, it is harder to “fall asleep” coding. You have to state explicitly that you are ending a coding thought or what type of variable you are getting ready to declare or whether a variable should be available for the whole project or just the class you’re working in. Sure these seem like small details, but when we are forced to be more involved in our code, we will become better developers just by having to pay closer attention to minor details that make a big difference.
C# also seems to force us to the level of thinking that asks “Are my variables declared properly? Are they initialized? Are they being used and spelled correctly? Should this method actually be private?” etc. It seems like C# starts off believing that you, the developer, know what you are doing so you should tell your code how you expect it to work instead of your program trying to intuit what you meant to code. On the flip side, VB seems to begin by thinking that you might not know what you’re doing so it will try to figure it out for you. That makes lazy developers and sloppy code.
I began my coding career working with VB and I appreciate how it helped me get started and how much it has improved over the past seven years that I have been working with it. However, as I have grown as a developer I have found it less and less sufficient to accomplish my given tasks and more and more cumbersome to actually use. In fact, a colleague of mine the other day said it well I think “VB stands for Verbose.” But whenever I’m in a C# project, I have no problems figuring how how something is supposed to work whether I wrote it or not and I am able to write code that looks better, works better, and is more efficient by paying attention to the details.
I welcome your comments. What has been your experience? Which language(s) do you prefer and why? Is there a language that has made you a better developer?