VBA & .NET - differences ?

I thought you meant a mutable object and by default strings are immutable so you have to use the StringBuilder to create a mutable one. The term "mutable property" is one I admit is not familar with me and after a quick Google check it seems something that is only mentioned by C# developers so I'm not too gutted about it as I don't know C#. It's like critisising me for not knowing a C++ expression.

But as I use VB10 this is all irrelevant anyway, which you admit in your last line!!!

Again, I am not talking about old versions of VB, you might as well start highlighting the flaws with VB6 and before otherwise. So I don't actually get what your point is....
If you re-read my entire first post in this thread, not just up to the point where you found something to pick apart and disagree with, you'd find it didn't really criticize current state of VB, and maybe you'd find your own point in the last sentence ;)

But hey, if you read every sentence with the intention of finding something to disagree with, then be my guest.
 
Not to be picky but I presume (not being a VB.NET mastero) Dim O = 2 C#'s equivalent would be var O = 2; which is different to the other poster wrote. Missing off the type would cause the type of O to be inferred to Int32 which is not the same as Object O = 2;

If you're saying no one would assign to 2 to an Object type then I'd agree, both compilers would emit IL to box the value type to the reference type which is bad for performance.

Well I always declare the type as in the earlier example I would have written...

Dim O as Integer = 2

Maybe I'm ignorant on this as I always know the type of variable I need but I thought that declaring a variable as an Object was the same as not declaring the type at all (i.e it uses late binding).
 
If you re-read my entire first post in this thread, not just up to the point where you found something to pick apart and disagree with, you'd find it didn't really criticize current state of VB, and maybe you'd find your own point in the last sentence ;)

But hey, if you read every sentence with the intention of finding something to disagree with, then be my guest.

Then I don't see what you actual point is!!! VB used to have one rare element that took 10 seconds longer to code than in C# but not any longer...so frigging what???

The guy was asking if it was worth him learning VB.NET so how is an old flaw (although only a flaw in your opinion) relevant?

I'm sure if a C++ developer came on here and started highlighting issues with C# from years ago that are no longer an issue you'd asking why they were saying it too.
 
Maybe I'm ignorant on this as I always know the type of variable I need but I thought that declaring a variable as an Object was the same as not declaring the type at all (i.e it uses late binding).

Well in C# at least, using type inference (e.g. var foo = 2) is not the same as declaring the variable with type object. Indeed, in some cases (when using anonymous types) type inference is mandatory, since the type's name is not known.
 
Of course, but my point still stands. Despite being a totally different language from VB6, VB.NET retains the legacy of "beginner-oriented" syntax, whether or not that's still its purpose.

But that is a good thing is it not? Providing it has no performance drawbacks which VB10 doesn't over C#.

Surely being easy to learn is plus point for any language, that is unless you are a protectionist who likes to be an "oracle" type figure and see new people eager to learn as competition to your future fees/wages.

I think that's where a lot of the snobbery comes from in regards to VB.NET, it is easy to learn and therefore the potential marketplace become bigger and then you can't charge stupid prices for basic software like my company who just paid £35k for something I could have written in a couple of weeks.
 
Then I don't see what you actual point is!!! VB used to have one rare element that took 10 seconds longer to code than in C# but not any longer...so frigging what???
It's my opinion. Does every contribution to a discussion have to be confrontational?

I stated that my main gripes with VB, like property declarations used to be really bad, are being fixed and I don't really put one above the other anymore. (Apart from specific lambda and generics-intensive tasks cases like writing tests with Moq and setting up FluentNHibernate configurations where I still find C# less messy.) You somehow managed to turn that into an attack on VB, and even when I explain what I mean (after you ask me to) you interpret that explanation as a further attack on VB.

I dare say that humble opinion is just as relevant to how the discussion where headed at that point than all the noise you're managing to create right now.

A property is a rare element? :rolleyes:

I will not reply to you any more. You do not seem to be willing to read anything as anything other than an attack on you or your VB.
 
Last edited:
NO, NO, NO!!!!! Again you are compring C# with VB6 and not VB.NET which is a diffrent language. Please read this...

no no its just the c# compiler has slightly different information to work with than what the vb.net compiler has and could sometimes make better interpretations basically, I can't remember the specific example but it's pretty unimportant, they do produce slightly different IL.
 
Well I always declare the type as in the earlier example I would have written...

Dim O as Integer = 2

Maybe I'm ignorant on this as I always know the type of variable I need but I thought that declaring a variable as an Object was the same as not declaring the type at all (i.e it uses late binding).

Everything still has to run on the CLR which is strongly typed. Late type binding is just syntaxic sugar over reflection and COM IDispatch and is probably one reason C# devs believe VB.NET performs worse, reflection == bad performance. Anywhere you miss a type off when declaring a variable is nothing more than a compiler trick and the compiler will infere from the assigning value the type of the variable.

Although, as of .NET 4 with the introduction of dynamic and CLR support for it, things are looking a lot better, performance wise.

EDIT: Just thought of something I much prefer in C# and is a reason to use it, lambda expression syntax is so much nicer and the lack of XML literals, just makes code prettier.
 
Last edited:
It's my opinion. Does every contribution to a discussion have to be confrontational?

I stated that my main gripes with VB, like property declarations used to be really bad, are being fixed and I don't really put one above the other anymore. (Apart from specific lambda and generics-intensive tasks cases like writing tests with Moq and setting up FluentNHibernate configurations where I still find C# less messy.) You somehow managed to turn that into an attack on VB, and even when I explain what I mean (after you ask me to) you interpret that explanation as a further attack on VB.

I dare say that humble opinion is just as relevant to how the discussion where headed at that point than all the noise you're managing to create right now.

A property is a rare element? :rolleyes:

I will not reply to you any more. You do not seem to be willing to read anything as anything other than an attack on you or your VB.

And dare I say the same way you are accusing me of interpreting your posts as an attack on VB, you are obviously seeing mine as a personal attack on you.

And I didn't say a property is a rare element so please don't mis-quote me. I said a 'mutable' property was and anything that only gets 112 Google results would qualify as 'rare' in my book...

http://www.google.co.uk/search?sour...Mutable+Property"&aq=f&aqi=&aql=&oq=&gs_rfai=

Especially as this thread is the top result!!!
 
But that is a good thing is it not? Providing it has no performance drawbacks which VB10 doesn't over C#.

Like I said, not at the expense of the general efficiency and easy of use of the language for a programmer who is already familiar with the it.

The syntax of a language is – in some sense – an investment. VB's syntax may be easier to learn and understand for a beginner, but that stage of a programmer's career is transient. Fairly quickly he'll become proficient enough with the language that whether it was easy to understand at first is no longer relevant, and what's more important is how easy it is to use.

Of course, this is entirely subjective, but I personally find the C style syntax far, far easier to use simply because it's so much more concise and doesn't involve so many words that must be read in sequence. I find a symbolic syntax far easier to understand than something that tries to look like prose :)
 
Last edited:
I'm not quite sure what the deal is with such malarky over "mutable" properties.. any property that is allowed to change is mutable, thus has a getter and setter..

Code:
public string aString { get; set; }
is mutable..


RE: Ease of reading/maintaining. That's an absolute key point, but like others I also find VB syntax hard to take in because it is so... blocky. If that is such a description. :) I work with a lot of VB6 as well as .NET, and Smalltalk, and others. Anything with VB is hard to read, be it .NET or 6.

Code:
If Not anObject Is Nothing Then
compared to:
Code:
if (anObject != null) {
The latter is much easier to read, imo. :)
 
Last edited:
Of course, this is entirely subjective, but I personally find the C style syntax far, far easier to use simply because it's so much more concise and doesn't involve so many words that must be read in sequence. I find a symbolic syntax far easier to understand than something that tries to look like prose :)

Again, you are implying that VB>NET applications are slower than ones written in C# unless you are specifically talking about a human reading the code but to be honest I don't think about what's easiest for me, just what the end user will get.

That's why I can't be arsed when people find some tiny nuence in VB that is one billionth of a second in C#, only programmers do and it aint them I'm writing the software for.

As I eluded too earlier, my employer has recently purchased software written in C# for £35k and it's awful, buggy and nothing works as you'd expect it to. But that's not because he used C#, it's because he's made a badly coded programme whereas my VB.NET applications just work (mainly because I test the hell out of them). The point being that a good VB.NET programmer can make better programmes than a bad C# programmer, and vice versa of course.

At least twice a year when I'm bored I'll pop online and try and find a reason to ditch VB for C# or even C++ and I just can't find one worth learning a whole new language for. As far as I can tell I an make the kind of programmes I need to with VB10 which perform the same as if I did it in C#, more importantly the end user has no idea (or cares) what language it's in.

Untill I find a useful function that cannot be done in VB.NET or is noticeably quicker for the end user, I'll stick with it.
I'm a data analyst by trade who is lucky enough to have a copy of VS2010 and enough time in the day to play about with it
 
RE: Ease of reading/maintaining. That's an absolute key point, but like others I also find VB syntax hard to take in because it is so... blocky. If that is such a description. :) I work with a lot of VB6 as well as .NET, and Smalltalk, and others. Anything with VB is hard to read, be it .NET or 6.

Code:
If Not anObject Is Nothing Then
compared to:
Code:
if (anObject != null) {
The latter is much easier to read, imo. :)

Come off it, the former is nearly an English sentence. Remember we are talking about a beginner here.

If you are versed in C# of course reading that will seem natural in the same way a German would read a German sentence, but you as a German wouldn't then say to an American that the German sentence was easier to read for him would you?

P.S. Why have you used a double negative anyway?

If anObject <> Nothing Then

......is much cleaner.
 
Last edited:
I assume Inquisitor was talking about humans reading the code.

Chances are you're not going to convince anyone who likes the C# syntax otherwise, and they're not going to convince you.

I started programming with the original Visual Basic, I know the language is completely different (and much much worse) compared to VB.NET but the syntax is still pretty similar. Over the years I moved onto other languages; C, C++, PHP, C#, Java etc which all share a similar syntax (bonus). Whilst at first learning the syntax differences was a pain (especially going from VB6 to C++ which was my first step) I personally prefer the shortened, less "Englishy" syntax because I find it much easier to read when you're working with complex nested code (let's not start a re-factoring argument :p), and find it quicker to write.

If you prefer VB.NET and are happier working with that, and have no real reason to move to C# then that's your choice. It would obviously be highly beneficial to you to be able to use them both though if you had to, and chances are it won't take you very long at all to pick it up.

Day-to-day I switch between maintaining things written in both ASP (VBScript) and C# (including ASP.NET), I don't mind writing in either 'style' if I need to.
 
Again, you are implying that VB>NET applications are slower than ones written in C#

No, I'm not.

unless you are specifically talking about a human reading the code

That's precisely what I'm saying.

but to be honest I don't think about what's easiest for me, just what the end user will get.

Whether you use VB.NET or C# has absolutely no bearing on what the end user experiences, so it's almost entirely down to the programmer's preference.

That's why I can't be arsed when people find some tiny nuence in VB that is one billionth of a second in C#, only programmers do and it aint them I'm writing the software for.

As I eluded too earlier, my employer has recently purchased software written in C# for £35k and it's awful, buggy and nothing works as you'd expect it to. But that's not because he used C#, it's because he's made a badly coded programme whereas my VB.NET applications just work (mainly because I test the hell out of them). The point being that a good VB.NET programmer can make better programmes than a bad C# programmer, and vice versa of course.

At least twice a year when I'm bored I'll pop online and try and find a reason to ditch VB for C# or even C++ and I just can't find one worth learning a whole new language for. As far as I can tell I an make the kind of programmes I need to with VB10 which perform the same as if I did it in C#, more importantly the end user has no idea (or cares) what language it's in.

Untill I find a useful function that cannot be done in VB.NET or is noticeably quicker for the end user, I'll stick with it.
I'm a data analyst by trade who is lucky enough to have a copy of VS2010 and enough time in the day to play about with it

Why are you being so damn defensive? I've said several times already that the VB.NET vs. C# argument is a waste of time since both are so similar. Not once have I said that C# is superior to VB.NET in anything other than matters of personal preference.

Sure, I prefer C# to VB.NET and I've explained some of my reasoning, but that's a personal thing and I couldn't care less what language other people use as long as they write good software.

Now take that chip off your shoulder, please!
 
Come off it, the former is nearly an English sentence. Remember we are talking about a beginner here.

That's a poor argument. A programming language shouldn't try to emulate natural language, as they are utterly different in purpose.

The reason I prefer C# is that its syntax is symbolic (visual), while VB's is textual. Since the human brain is far more effective at recognizing visual patterns and cues than textual, I'm able to interpret and understand the C# snippet that much more quickly than the VB snippet, which I have to read in its entirety before I can understand.

Sure, VB might be self-explanatory, but if I know the language already then I don't need it explained again.

If you are versed in C# of course reading that will seem natural in the same way a German would read a German sentence, but you as a German wouldn't then say to an American that the German sentence was easier to read for him would you?

As I've said, a programming language shouldn't aim to be easy to understand for people who don't even know the language. Rather, it should be easy to use for those who do, as they're the ones who actually have to deal with it regularly. Learning the language is simply a one-time investment that every programmer must make up front.

Let me reiterate that these are my own preferences, in case you think this is some slight on your good name!
 
Last edited:
I learnt VB.NET at college (when i say learnt it was more like guessing!) and i could use it until i started to really get the hang of C / PHP and a bit of Java and c#. I just couldn't stick the lack of { } and (what feels like) extra words in VB.NET. Just up to the coder at the end of the day.
 
Come off it, the former is nearly an English sentence. Remember we are talking about a beginner here.

If you are versed in C# of course reading that will seem natural in the same way a German would read a German sentence, but you as a German wouldn't then say to an American that the German sentence was easier to read for him would you?

P.S. Why have you used a double negative anyway?

If anObject <> Nothing Then

......is much cleaner.
Because "<> Nothing" doesn't work. :)

This isn't an attack dude, I prefer to read C#, as does everyone in my office (given we're migrating from VB6 and *everyone* is using C#, nobody has opted to use VB.NET!)
 
Because "<> Nothing" doesn't work. :)

This isn't an attack dude, I prefer to read C#, as does everyone in my office (given we're migrating from VB6 and *everyone* is using C#, nobody has opted to use VB.NET!)

Oh rly?

seeyo.png


seep.png



I'm not suprised you find VB.NET hard to read if you're not using the the most efficient syntax ;)
 
Last edited:
Back
Top Bottom