Is C# Better?

  • The reason why there is a feeling "C# programmers are better than VB.NET"...from my perspective, it's true. And I use myself as an example.

    I've been a programmer for 10+ years. I started out in VB6/VBA which definitely got my feet off the ground and wrote some nice programs and interfaces. From the users perspective, they didn't know or could care less what language it was written in. At the time, I considered myself a decent programmer and could get the job done.

    But, about 4-5 years ago, we were tasked with upgrading everything to .NET. The nice thing was that I had the choice of which language to use. Since the "push" at the time was C#, I decided to learn/use that. Concurrently, I also learned VB.NET b/c I wanted to know the differences and honestly...I wanted to have "programming ammunition" for my resume.

    Five years later, in a new company and still programming in C# (even though I can do VB.NET), I look at some of the legacy apps written in VB6/VB.NET (and some of my old stuff) and realize how awful some of the code looks. Granted, a lot has to do with poor coding practices, but still...learning C# and using it day-in & day-out has made me a better programmer. I've seen bad code in both C# and VB, but it seems that VB allows for sloppier coding. With C#, it almost forces you to write good code. It's not so much of a status thing with me...it's definitely a personal preference. However, the whole "compile time vs run time" issue is a stickler. I've seen that ppl who learn VB.NET first have a hard time grasping C#. BUT those who learn C# first can easily pick up VB.NET - just look at most of the "pro VB.NET" comments on this board and you'll see my point.

    Oh...and on a side note...most everything that can be done in C# can be done in VB.NET and vice-versa. They are just syntactically handled differently. I just happen to prefer the syntax in C#...this coming from a guy who started in VB.

    ~Steve

    -------------------------------------

    DEATH TO FOXPRO!!!

  • Because I use both, I feel somewhat un-biased, but I will say C# is faster to deliver using the VSTS environment than VB. Technically, doing things such as wiring up events is far more simple in C# than VB.NET as the model is a little more straightforward in the latter.

    Beyond that, creating properties/accessors is far more simple courtesy of the latest improvements to the C# language platform.

    That said, I've adopted the popular adage "Code in VB for the show, C# for the dough."

  • With C#, it almost forces you to write good code.

    Almost?

    And what is a good programmer?

    I think an object oriented programmer is a better programmer, regardless of language.

    Even in COBOL.NET....

  • I've actually seen people advance the argument that VB is worse than C# because, "Look at all the bad code that's been written in VB!"

    I've seen the argument that C# is better, because "It's too easy to learn VB, so you get a lot of people writing VB apps who really don't know best practices and who then write horrible applications."

    Personally, I don't see a significant difference in which one you use. I spent a lot of time writing VBA code inside MS Access, so I'm more comfortable with VB.NET than with C#, but I can read either one reasonably well, and have to dig through books/website to write either one if I'm going beyond simple "Hello World" type code.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • DEATH TO FOXPRO!!!

    off topic, just asking, why death to foxpro? there's rumor a long time ago that part of it's fast engines were used for sql and access, though i wouldn't hold on to that rumor.

  • bear in a box (11/13/2009)


    DEATH TO FOXPRO!!!

    off topic, just asking, why death to foxpro? there's rumor a long time ago that part of it's fast engines were used for sql and access, though i wouldn't hold on to that rumor.

    Well...it's more of a personal vendetta for me. While it may have had it's uses, it again, allows for poor programming. It is one of our legacy programs here which handles formulation and has been nothing but a thorn in our side when it comes to integration and modifications. Once you harness the power of SQL, who would want to go back to that dinosaur? Not I.

  • wiring up events is far more simple in C# than VB.NET

    Really?

    In VB it is a double-click....

  • It is a matter of the right tool.

    If all you do is general business programming VB.Net will be sufficient and maybe your best choice.

    If you need to access native assemblies, C# has the ability to get to that level, use pointers, etc. VB.Net does not allow it.

    Even though both compile to intermediate code, the do not compile to the same code. If you disassemble the IL code, you will find that C# often takes a shorter route, albeit with less safety checks. You can coax VB.Net to do less checking by tweaking your compiler options. Here you have a difference between compilers, how well each compiler looks at your code and optimizes it, can make a difference in performance.

    C# has some nice to haves, that you CAN live without.

    Anonymous functions

    * Lambda expressions

    * anonymous method

    Multi-line comments

    Auto-Implemented Properties

    While curly brackets and semicolons date C#, I find the way VB delimits code blocks irritating also.

    The past few years there have been some exiting work done about how a language affects code quality and productivity. Some interesting .NET languages focused on these areas are F# and BOO.

  • You could throw lots of languages into the big melting pot entitled "What is the best programming language" but it usually depends upon what you are trying to do and, very importantly, what your previous experience with programming was concerned with. If you programmed expensive military hardware with engines and wings then you may well have been using ADA and if you programmed giant telescopes then you may have been using FORTH. Of course all .Net languages sit upon the Common Language Runtime (CLR) and other bits of commonware so perhaps some will look at them as pretty much the same, but they are not...

    If the first programming language you learned was BASIC then there's a good chance you will want to stay with it for the rest of your days here on Earth. If however your first language was C or C++ (and probably compiled on some kind of UNIX box back in the 1970's) then you will probably not care too much for BASIC because unconciously you have been enjoying code for years that is presented to the eye more harmoniously through the use of that wonderful code clarifier - white space!

    Yes, BASIC, VB.Net and other flavours of BASIC can be heavy on the eye and represent quite a maintenance burden - at least at first sight - but the use of block braces serves as a visual separator as well as semantic delimiter in C and C# code. It appears that to make BASIC code just as clear or easy to read takes a definable effort which most of these programmers don't care to invest as they are busy transferring the real world problem straight into code. I agree that white space simply consumed trees back in the days when most of us programmers thought we had to print out all our code at the end of each day, but not many of us have to do do this now and so we just get the benefit of code full of white space which is easily consumed; something that they try to teach you at college, even now!

    So go on... if you code in VB.Net then treat yourself to more blank lines and white space generally (and try to design you programs more before you start writing the code). If you code in C#.Net then just carry on, but whatever language you use, put lots of comments in because if you don't then in a year's time it will take you three times longer than it should to make your enhancements.

    So you see, it's all down to white space and comments (available in VB.Net and C#.Net!!!) and how you use them.

    Happy coding.

  • there's rumor a long time ago that part of it's fast engines were used for sql and access, though i wouldn't hold on to that rumor.

    It's not a rumor, it's true. I was on the beta-test of the first version of FoxPro for Windows back when FoxPro was owned by Fox Software. It was just before the beta finished that MS bought Fox Software. They bought them primarily for the query engine "secret sauce" called Rushmore. David Fulton, President of Fox Software became a Database Architect at Microsoft after the sale.

    Rushmore was orders of magnitude faster than other xbase engines, and MS used it to speed up Access 2.0 (might have been 1.1, but I think it was 2.0).

    Rushmore is a database-agnostic technology, something about bitmapping indexes in memory for searching. Something like it had apparently been done on mainframes but never on a PC.

    So there you are. 🙂

  • Which language is better? I would say neither. You can mostly accomplish the same with both, and if you are doing something with one that cannot be done with the other, then you probably shouldn't be using that feature as your code may no longer be CLS Compliant.

    My understanding is that VB was originally meant to be a hobbiest language and as such attracted a lot of people who simply did it as a hobby. Because of all of this a lot of unprofessional code was written in VB, and C/C++ was generally used by people who did development for a living. This meant that, in general, code was architected beter if it was done in C/C++ than if it was done in VB. Over the years, the mind set has remained, by many, that VB.NET is generally for hobbiest, and C# is used by professionals, so a stigma has been formed that C# code is better than VB.NET code. I would treat these ideas like any other stereotype: it's a bad idea to use them, though there is a reason the stereotype existed at some point.

    In the end, this has nothing to do with which language is better, but is more of an [bad] assumption as to the quality of code based on the language that was used.

    I would argue that any sufficently skilled c# developer should be able to read VB.NET with little to no issue, and that any VB.NET developer should be able to read C# with little to no effort. Writing code in the language you are not proficient with does take effort and will reduce efficiency for the period of time in which you are becoming accustomed to the language.

    Disclaimer: I am a C# developer and have not used VB.NET in any projects, but have read a fair amount of VB.NET code.

  • Just My 2c (this is a sincere rant, so be ready)

    I have a C/C++ (among many prior languages) background and still see C++ that as the language to beat when it comes to speed, controllability and coding facilities. Granted, developing good code with it requires a higher experience level and more knowledge then with the newer languages that are more forgiving as they automate memory management (to some extend, don't be fooled) and the memory layout of structures/objects. The reward from C++ however is sheer speed, memory control and manageability if you do it right, something no GC can offer (not even close).

    As such I tend to see C#, Java and any other language based on a GC as a degeneration of programming, something my initial testing with C# and Java backed up and I since deemed it not even worth a serious second look. Type safe reusable collections without casts were not possible in C# 1.0 for example. Yes, constant casting was needed in the consuming code…something we got rid of 10 years before and they still dare call it progress. While C# was horrible to coding in, the first issue I ran into with Java was more of a UI nature as I tried it when SWING came into being, and boy o boy…if you wanted instant migraine, this was it (everything was constantly being redrawn).

    Yet then the hype was the same in both cases as well as others (COM and DLLs etc), so I learned to mistrust it anyone promoting it...deeply. I do know improvements have been made to C# such as generics, making coding easier but nothing beyond what was needed and available in C++ already. Then there is a case of reliability (or lack thereof) to be made. Even the most mature of the bunch (Java) uses a GC that is still buggy, causes memory leakage and unreliable performance even in simple provable bug free code. For these problems to persists after 15+ years of tuning should be a RED FLAG to anyone with half a brain.

    So it pains me to see the movement of the industry big players going the GC / .Net / Java direction and I question their motives. In my view, control of what happens when (functional speaking) is, and always must be in the hands of the developer. No pure GC based, OO oriented language can offer this as they are in essence mutually exclusive goals. You need to have a choice when something should be delegated to a trusted automated system like a GC and be able to set appropriate boundaries for different uses within your solution. The latter implying that it must be part of your delivered code and not part of the runtime system as such (ruling out .NET and java).

    The current move is to the other direction as the choice is being made for you the programmer. When something is wrong all you can do it react and act as a bunch of moneys and try every button and option until some problem goes away and shout victory if it looks like it works until another issue pops up where you have no control over. It think it is foolish to follow the same "leaders" every time when they abandon their previous failed hype, over and over. Sure next time they get it right...this time its different....sure.

    I think I better stop here as I can rant on and on about this, but you get the idea (I hope).

  • I think it's a matter of preferrence. I use both on a regular basis but when given the choice use c#.

    It seems to take a bit less time when writing in c#.

    I like specifying the variable type before deciding on a name for a variable as well.

    I like lining up things using { and }.

    I also like it's similarity to java. It used to take me much longer to read what a java program was doing to be able to recreate it with vb. Getting used to c# syntax helped to make it quicker to read and understand.

  • I have written in both C# and VB.NET. Other than syntax, they are virtually identical from a feature/function perspective. The reason to choose one over the other is simply what your development team has used in the past. Developers will be most productive in languages they are familiar with. It generally takes 3 or 4 months to become as productive after changing primary development languages.

  • I am a professional VB.NET developer and the only limitation that I have yet to find that I have needed is the VB.NET equivalent of the C# yield keyword for iterators. That being said, the nice thing about .NET is if your primary language doesn't have what you need for a specific situation you can go and develop a new library for that situation in the other language and add a reference to it. I believe one is not better than another but just a matter of preference.

Viewing 15 posts - 61 through 75 (of 176 total)

You must be logged in to reply to this topic. Login to reply