It’s official… I like C# better than VB.NET
Yes, it is true, I’ve switched to the dark side. The last bastions of VB.NET have fallen.
After a conversation with a pair of developers I work with, I have finally been convinced that C# is a better syntax than VB.NET. That’s saying something, considering I used to believe I liked my languages verbose. You know, like COBOL. There were three things in the C-based syntax of the language that bothered me:
- Case sensitivity
- Curly braces
- Semicolons
Like me, one developer was a former VB programmer now a fan of C#. The other was more of an open source proponent, but extremely knowledgeable about programming theory and history. A discussion with these two and some time actually developing in C# helped me understand the power of the language and the benefits over VB.NET syntax. I would still like to point out that the IDE in Visual Studio could use a few more features to truly make C# programming outstanding. I guess Resharper will have to fill the gap.
Case sensitivity
For the longest time, I could not come up with a decent reason for a case sensitive language. In VB.NET’s case-insensitive world, the IDE can auto correct your tYpInG mistakes very easily. It isn’t as easy to do in a case-sensitive language, because the IDE will not know “var” verses “Var” verses “VAR” when all three are in use. I have found case-sensitivity to make sense in naming variables, especially in the post Hungarian Notation world. I can declare a variable and name it the same as the class on which it is based. For example:
Customer customer = new Customer();
I don’t have to spend any time coming up with a different variable name. It actually requires less thinking. Less thinking is good.
Curly Braces
My previous experience with C-based languages was in college, circa 1994. Back then, there were no fancy IDEs, we coded in a text editor and we liked it that way!
Ok, I didn’t.
Formatting a document was a giant pain, but I had to do it to my curly braces straight. With VB’s If.. End If structure, I could read where the end of a statement was without tracing back and forth. Admittedly, Visual Studio can be thanked for fixing a lot of this issue in C#. It will auto-format a document for you and highlights bracket pairs. A number of other IDEs have done this for c-based languages as well.
What I hadn’t realized was how symbology makes it easier to understand the code. By using curly braces and other short constructs that are not words, C-based languages become easier to understand. My mind spends less time translating the code when I read it because the braces fade into the background. I can focus on the important things instead - the actual code.
It actually requires less thinking, and less thinking is good.
Semicolons
This one is more of a religious debate than anything else. I used to prefer not having to end statements with a semi-colon, choosing instead to use a line delimiter for continuation. That worked out fine and dandy until I needed to reformat a line - it involved moving the delimiters. In C# I hit enter and I’m done.
You know… less thinking.
6 Comments
- Jeremy said:
- ^Lestat said:
- Dan said:
- Dan said:
- Dan said:
- y0mbo said: