• (cs)

    TRWTF is VB.

    Now that that's out of the way... let the actual commenting begin...

  • (cs)

    A poor craftsman blames his tools.

  • (cs) in reply to akatherder
    akatherder:
    A poor craftsman blames his tools.
    So does a good craftsman who has crappy tools.
  • (cs)

    The key is knowing when to use a property and when to use a function instead.

    In this case, it was not a proper time for a property...

    Of course if it had been more like this:

    Obj.DemoTimeOut = 60000 ' Starts timer at 1 minute Obj.DemoTimeOut = -1 ' Stops timer.

    It works a bit better, but properties generally shouldn't do anything except get/set some sort of ... property, or setting. Firing off a timer is not something i would expect a property to do. Something like this would be more expected:

    Obj.DemoTimeOut = 60000 Obj.StartDemo()

  • Sam Sneed (unregistered)

    How about plain old BASIC? ...like the one I used to use on the TTY?

    100 PRINT "HELLO WORLD" 200 GOTO 100

  • Anonymous (unregistered)

    Awww, "beginner-targeted language" makes it sound so cute! Much better than "ungodly piece of crap" or "used exclusively by school children and bad CS students".

    As for todays WTF, well, that's exactly what you get from an ungodly piece of crap that is used exlusively by school children and bad CS students.

  • Steenbergh (unregistered)

    OMG 0_o

    I didn't even know VB could do such a thing! Yes, the () for both functions and indexes on arrays can get rather confusing, but seeing this leaves me speechless...

  • (cs) in reply to The MAZZTer
    The MAZZTer:
    The key is knowing when to use a property and when to use a function instead.

    In this case, it was not a proper time for a property...

    Of course if it had been more like this:

    Obj.DemoTimeOut = 60000 ' Starts timer at 1 minute Obj.DemoTimeOut = -1 ' Stops timer.

    It works a bit better, but properties generally shouldn't do anything except get/set some sort of ... property, or setting. Firing off a timer is not something i would expect a property to do. Something like this would be more expected:

    Obj.DemoTimeOut = 60000 Obj.StartDemo()

    I tried to convince other devs on our team of the greatness of the Single Responsibility Principle and got shot down in a staff meeting about it. I guess some people love the excitement of random side effects when they call methods (or even worse, accessors). Also, TRWTF is VB.

  • Larry David Jr (unregistered) in reply to Anonymous

    Here's a challenge for you all then. Give a piece of code which is 'better' in C# than in VB (.NET).

    Go.

  • Matt (unregistered) in reply to The MAZZTer
    The MAZZTer:
    The key is knowing when to use a property and when to use a function instead.

    In this case, it was not a proper time for a property...

    Of course if it had been more like this:

    Obj.DemoTimeOut = 60000 ' Starts timer at 1 minute Obj.DemoTimeOut = -1 ' Stops timer.

    It works a bit better, but properties generally shouldn't do anything except get/set some sort of ... property, or setting. Firing off a timer is not something i would expect a property to do. Something like this would be more expected:

    Obj.DemoTimeOut = 60000 Obj.StartDemo()

    Seconded. Properties can be extremely useful. You just have to have the restraint to use them reasonably as getters and setters. Just because a language has a feature doesn't mean you should use it for everything.

    Captcha: facilisis - paralysis of a facility

  • (cs) in reply to Anonymous
    Anonymous:
    Awww, "beginner-targeted language" makes it sound so cute!
    But is is targeted at beginners. Does anyone actually remember that BASIC stands for 'beginners all-purpose symbolic instruction code'?

    Pretty much like Pascal, and like Pascal, in its original incarnation totally unsuitable to write real software.

  • Bus Logic (unregistered)

    This bizarre ambiguity between properties and functions is just one item on a very long list of inherent issues with VB.NET. I honestly have no idea why anyone would choose it over C# when targeting the .NET framework, unless they're just so bad at writing code that they can't make the switch from Microsoft's kiddie code to a real language.

  • (cs) in reply to Severity One
    Severity One:
    Anonymous:
    Awww, "beginner-targeted language" makes it sound so cute!
    But is is targeted at beginners. Does anyone actually remember that BASIC stands for 'beginners all-purpose symbolic instruction code'?

    Only me. And you, although maybe you went and looked it up.

    Severity One:
    Pretty much like Pascal, and like Pascal, in its original incarnation totally unsuitable to write real software.

    Oh, boy, Standard Pascal... No way to know how much memory is left, no way to tell that an allocation just failed, no way to acquire the name of a file into a variable and then open that file, fixed-length string variables that are just PACKED ARRAY[1..X] OF CHAR, do I need to continue?

  • English Man (unregistered) in reply to Anonymous
    Anonymous:
    Awww, "beginner-targeted language" makes it sound so cute! Much better than "ungodly piece of crap" or "used exclusively by school children and bad CS students".

    As for todays WTF, well, that's exactly what you get from an ungodly piece of crap that is used exlusively by school children and bad CS students.

    It's entertaining when ignoramuses talk with such arrogance. Well done.

  • Spivonious (unregistered) in reply to Bus Logic
    Bus Logic:
    This bizarre ambiguity between properties and functions is just one item on a very long list of inherent issues with VB.NET. I honestly have no idea why anyone would choose it over C# when targeting the .NET framework, unless they're just so bad at writing code that they can't make the switch from Microsoft's kiddie code to a real language.

    Kiddie code? There is nothing you can do in C# that I can't do in VB. It all comes down to whether you prefer the verbosity of VB or the conciseness of C#.

  • Anonymous (unregistered) in reply to Severity One
    Severity One:
    Anonymous:
    Awww, "beginner-targeted language" makes it sound so cute!
    But is is targeted at beginners. Does anyone actually remember that BASIC stands for 'beginners all-purpose symbolic instruction code'?

    Pretty much like Pascal, and like Pascal, in its original incarnation totally unsuitable to write real software.

    Absolutely, I quite agree it is designed for beginners and targeted towards beginners. I don't have a problem with that but I do find it strange that this self-confessed "beginner's langauge" is used so extensively in enterprise software development. As far as I'm concerned, if you are out of school you should not be considering VB (in any of its incarnations) as a serious language. And even if you're still in school, you can do a lot better if you have half a brain...

  • Chris Haas (unregistered) in reply to Bus Logic

    I'm a long time VB dev and I have never been confused over properties vs methods. I don't want to get into the old war of C# vs VB but except for the unsafe keyword, there's nothing in C# that VB can't do.

  • Warren (unregistered) in reply to Chris Haas
    Original Article:
    a flood of The Real WTF is VB comments ensues

    Not as much as a flood of Look, I've found a typo comments.

  • Bus Logic (unregistered) in reply to Spivonious
    Spivonious:
    Bus Logic:
    This bizarre ambiguity between properties and functions is just one item on a very long list of inherent issues with VB.NET. I honestly have no idea why anyone would choose it over C# when targeting the .NET framework, unless they're just so bad at writing code that they can't make the switch from Microsoft's kiddie code to a real language.

    Kiddie code? There is nothing you can do in C# that I can't do in VB. It all comes down to whether you prefer the verbosity of VB or the conciseness of C#.

    That was my exact point when I said I don't understand why people would choose VB.NET over C#; they both lever the CLR in the same way, they effectively compile down to the same bytecode, so why use a langauge like VB.NET that has some horrible behaviour and only just qualifies as an OO langauge at all, when you could use the clean and logical syntax of C#?

    And yes, VB.NET is kiddie code. Just because it compiles down to an intermediate code that can be produced by other langauges it doesn't mean that this particular langauge is any good. That's like saying that Dreamweaver is a good web design tool because it compiles down to HTML. Lots of things produce HTML, it doesn't mean that are all equally good.

  • wtf (unregistered) in reply to Anonymous
    Anonymous:
    And even if you're still in school, you can do a lot better if you have half a brain...

    I don't know half a brain is about right for VB, I think.

  • Bremer (unregistered) in reply to Spivonious
    Spivonious:
    Kiddie code? There is nothing you can do in C# that I can't do in VB. It all comes down to whether you prefer the verbosity of VB or the conciseness of C#.

    Exactly. VB was a crap language upto VB6 (and I’m a VB developer), but .NET is a totally different beast. The only difference between it and C# is syntax, and if you ask me, verbosity is much easier to read then stupid nipple brackets.

    I do however wish Microsoft would drop support for old VB6 style function calls, as it just encourages people to write bad code in .NET.

    Oh, and VB supports XML Literals, which are awesome.

  • (cs)

    Whenever I have to write in VB.NET, I feel like I'm trying to compose a cover letter with crayons.

  • MacHaggis (unregistered)

    My head just exploded, and the universe is about to as well

  • dan (unregistered) in reply to Chris Haas
    Chris Haas:
    I'm a long time VB dev and I have never been confused over properties vs methods. I don't want to get into the old war of C# vs VB but except for the unsafe keyword, there's nothing in C# that VB can't do.

    Agreed.

    The issue with VB isn't about what it can do (since it's become a .net language it's become pretty powerful and fast).

    The issues are:

    How it's written - the vast majority of developers prefer a C-style language, and often find C# more maintainable.

    And of course, the average quality of developers for the language. For every good VB dev, there's a hell of a lot of bad ones. Why aren't there so many bad devs for C#? Nothing particularly unique to C#, rather that VB is a beginner lanugage - most of the bad devs in the world barely learnt VB, and will never learn C#.

  • (cs) in reply to Chris Haas
    Chris Haas:
    I'm a long time VB dev and I have never been confused over properties vs methods. I don't want to get into the old war of C# vs VB but except for the unsafe keyword, there's nothing in C# that VB can't do.

    Ah, but VB does not have the System.Gloat namespace

  • justsomedude (unregistered) in reply to Matt
    Matt:

    Seconded. Properties can be extremely useful. You just have to have the restraint to use them reasonably as getters and setters. Just because a language has a feature doesn't mean you should use it for everything.

    Captcha: facilisis - paralysis of a facility

    +1

  • Bus Logic (unregistered) in reply to Chris Haas
    Chris Haas:
    I'm a long time VB dev and I have never been confused over properties vs methods. I don't want to get into the old war of C# vs VB but except for the unsafe keyword, there's nothing in C# that VB can't do.
    Yes there is, because C# and VB.NET are completely different langauges. They compile down to the same intermediate language so what you meant to say was "there is no compiled bytecode that C# can produce but VB.NET can't". That is not the same as saying "there's nothing C# can do that VB can't". For example, VB.NET supports weak typing (ugh) whereas C# cannot and will not. This is a distinct difference in the high level langauges that exists despite the fact that both languages compile down to the same bytecode. And remember that C++ targets the .NET framework as well, so you might as well have said "there is nothing in C++ that VB can't do". Obviously this is not true.
  • Billy The Squid (unregistered)

    I've always felt like the hatred towards PHP was unjustified.

    The code itself isn't bad... It's simplistic, and easy to adapt to, it doesn't necessarily teach proper code structure or force people to do things just so... but if used properly, you can make it do some nice things.

    I've been able to call myself a PHP developer for more than a few years now. Nothing I do can't be accomplished in another environment, however we do things in PHP rather than rebuild from scratch, and it works... Our billing, reporting, and presentation levels are all in PHP.

    The code is clean, regular code reviews and decent testing prevent things from slipping into WTF levels of insanity, we don't allow developers to write their own SQL (instead use our SQL management toolset - generates queries, sanitizes inputs, prevents "something bad" from happening), even simple form-management is handled directly from another class, written fairly cleanly..

    It would be easy to let it all slip into "it works, shut up" type code... but you can say that about any code. You can make a shit-sandwich in any language. It's up to the user to learn how to NOT do so.

  • Anonymous (unregistered) in reply to English Man
    English Man:
    Anonymous:
    Awww, "beginner-targeted language" makes it sound so cute! Much better than "ungodly piece of crap" or "used exclusively by school children and bad CS students".

    As for todays WTF, well, that's exactly what you get from an ungodly piece of crap that is used exlusively by school children and bad CS students.

    It's entertaining when ignoramuses talk with such arrogance. Well done.
    It's entertaining when VB coders talk with such clarity, instead of just screeching and flinging feces at each other like normal. Well done.

  • Some guy (unregistered) in reply to Spivonious
    Spivonious:
    There is nothing you can do in C# that I can't do in VB.

    The real issue isn't that there is nothing you can do in C# that you can't do in VB. The issue is that there is plenty you CAN do in VB that you can't with C#.

    For example:

    Private Function _getFoo as Int Return 1 End Function

    Public Readonly Property Foo as Int Get _getFoo() End Get End Property

    The above would compile, and if you ever accessed Foo, you'd get 0.
  • Anonymous (unregistered) in reply to Billy The Squid
    Billy The Squid:
    I've always felt like the hatred towards PHP was unjustified...
    Sorry Billy but we're crucifying VB today. Maybe we'll do PHP tomorrow.
  • (cs)

    If you don't stop telling me that my perfectly good well-thought out post is spam I will REALLY REALLY hit you with spam.

  • (cs) in reply to Cbuttius

    The REAL WTF is that we can't post links

  • Mojo (unregistered) in reply to Bus Logic

    I do all of my new development in C# these days. I learned to program as a kid in Basic on an old Mac, then learned Pascal, and then C, and then C++.

    My degree was earned through instruction based in C++. But, of course, learning C++ wasn't the point of earning my degree. Hell, I took a class in programming language design, and we whipped up our own compilers.

    Giving a rip about the language you compose your symbols in... well, it just seems childish to me. You almost seem to see it: in the end they all compile. It is a truth.

    VB.Net is no more "barely" OO than C++ is. Yes, it's based on a non-OO language, but it has the functionality now.

    VB is more verbose, but then, in the VS.Net IDE, you're only typing out parts of keywords, and the rest of the text is automatically generated.

    I haven't noticed any time savings, in terms of how much typing I'm doing, after making the switch to C#. The code isn't any more readable. I'm not magically a better developer. It almost seems like... well... the differences are trivial.

    One thing I have noticed, as someone who cleans up crap code from "hotshot" developers: When I see code from a rookie VB developer, I generally see a progression from bad code to better code. Looking at the same rookie code from C-syntax devs, I often see a progression toward more hacks and "look ma, I can fit it all on one line!"

    In the end, I'll admit that I'd rather be developing in C#. But, having an extensive knowledge of VB is certainly not a liability in the market.

  • TheSHEEEP (unregistered)

    What is that timer actually for?

    Or does it not have anything to do with the problem and TRWTF is "just" the strange variable(parameter) = value syntax?

  • Mike D (unregistered) in reply to Bremer
    Bremer:
    if you ask me, verbosity is much easier to read then stupid nipple brackets.

    LOL. I'm sorry, I have never heard { and } referred to that way before. LOL. I will never see my Java code the same way again.

  • Raw (unregistered)

    I disagree with the notion that VB was made for beginners. It was made as a RAD environment, a way to make software quickly. MS needed a way to get insane numbers of database applications out there in lots of organizations to the windows platform, as the inability to do so was severely hampering the adaptation of Windows. MS acheived this through several methods:

    • A well know syntax that most programmers knew. Everyone has tried basic at some point. If they had gone with C, Pascal or something else, they would have got bogged down in trench warfare.

    • They identified the bits that most commercial software do a lot: GUI, databases, printing and communication. Then, they provided the tools to make those bits as simple as possible. Sure, C (or another language) can do it, but here, it was done quickly and with less risk for errors.

    • Hiding some of the more error prone bits and/or automating them, such as garbage collection, pointers and so on.

    Sure, a lot of bad programmers joined the gold rush, but they would have been there regardless of what syntax the language would be based on. If it had been based on C, we would have seen a similar flood of bad C code, probably even worse, as C really empowers newbies to eff up royally. It was not the language, it was the timing. Just about every big consultant company were hiring anyone who could spell VB to fill the demand. We have seen similar crap floods in the HTML boom and the Y2k debacle.

    The tool, however, is still valid, and in the hands of a decent programmer, can churn out solid quality applications quickly and efficiently at a rate that no other language at the time could match. Most projects are not paid by the hour, they they for results.

  • Jeff Dege (unregistered)

    One of my favorite programming language test questions involved a comparison between a signed and an unsigned int, in C.

    The answers were:

    A: the way K&R said it should work. B: the way ANSI said it should work (which was different that B). C: the way about half of extant C compilers worked (which was different from both A and B). D: If I don't write code like this, it doesn't matter.

    The correct answer, of course, is "D".

    Every language has constructs in it that made sense to some language designer, once, but on reflection are "really bad ideas [tm]".

    That VB.NET has a few does not make it a bad language. Every language has a few.

  • Mojo (unregistered) in reply to dan
    And of course, the average quality of developers for the language. For every good VB dev, there's a hell of a lot of bad ones. Why aren't there so many bad devs for C#? Nothing particularly unique to C#, rather that VB is a beginner lanugage - most of the bad devs in the world barely learnt VB, and will never learn C#.

    All I can say is... you've obviously never worked in software development in any capacity... or you're a troll.

    Not saying there aren't a lot of crap VB devs out there, but there's certainly just as many crap C# devs. If you don't see them, you must not have worked in the field. Or, I suppose you could BE one of them.

  • Mark (unregistered) in reply to Jeff Dege
    Jeff Dege:
    Every language has constructs in it that made sense to some language designer, once, but on reflection are "really bad ideas [tm]".

    That VB.NET has a few does not make it a bad language. Every language has a few.

    Yes but it's fair to say that VB has waaaaaaaaay more than most.

  • eric76 (unregistered)

    About 20 years ago, someone from a major oil company told me that they had lots of VB programmers, but they all spent their time writing applications that noone else would ever see or use.

  • (cs)

    I wrote a post from a while ago about creating a class system for programmers that will open language features by experience.

    http://subjectively.blogspot.com/2007/07/role-playing-gmes-we-play.html

  • aleonard (unregistered) in reply to Larry David Jr

    public IEnumerable<int> GetFibonacciSequence() { int current = 0; int next = 1; do { yield return current; int temp = current + next; current = next; next = temp; } while(true) }

  • (cs) in reply to Mojo
    Mojo:
    I do all of my new development in C# these days. I learned to program as a kid in Basic on an old Mac, then learned Pascal, and then C, and then C++.

    My degree was earned through instruction based in C++. But, of course, learning C++ wasn't the point of earning my degree. Hell, I took a class in programming language design, and we whipped up our own compilers.

    Giving a rip about the language you compose your symbols in... well, it just seems childish to me. You almost seem to see it: in the end they all compile. It is a truth.

    VB.Net is no more "barely" OO than C++ is. Yes, it's based on a non-OO language, but it has the functionality now.

    VB is more verbose, but then, in the VS.Net IDE, you're only typing out parts of keywords, and the rest of the text is automatically generated.

    I haven't noticed any time savings, in terms of how much typing I'm doing, after making the switch to C#. The code isn't any more readable. I'm not magically a better developer. It almost seems like... well... the differences are trivial.

    One thing I have noticed, as someone who cleans up crap code from "hotshot" developers: When I see code from a rookie VB developer, I generally see a progression from bad code to better code. Looking at the same rookie code from C-syntax devs, I often see a progression toward more hacks and "look ma, I can fit it all on one line!"

    In the end, I'll admit that I'd rather be developing in C#. But, having an extensive knowledge of VB is certainly not a liability in the market.

    This comment is too long, can you sum it up with a one liner? Preferably with lambdas?

  • (cs) in reply to Markp
    Markp:
    akatherder:
    A poor craftsman blames his tools.
    So does a good craftsman who has crappy tools.
    What good craftsman willingly uses crappy tools?

    I suppose he may not have a choice, but then wouldn't he still make the best of what he has? He wouldn't need to blame the tools (or anything else) if he succeeds.

    And if there's no chance of succeeding despite his best efforts due to tools/resources/work conditions/etc., I think a good craftsman would see that beforehand and avoid a project he knows would fail. Otherwise, would you really call him a good craftsman, and if so, by what standard are you measuring to derive the term "good"?

  • Larry David Jr (unregistered) in reply to NightDweller

    I started reading that until I saw this:

    an expert is anyone programming in any of the real languages (assembly, c, c++, java, c#)

    Next!

  • Mark (unregistered) in reply to Anonymous
    Anonymous:
    English Man:
    Anonymous:
    Awww, "beginner-targeted language" makes it sound so cute! Much better than "ungodly piece of crap" or "used exclusively by school children and bad CS students".

    As for todays WTF, well, that's exactly what you get from an ungodly piece of crap that is used exlusively by school children and bad CS students.

    It's entertaining when ignoramuses talk with such arrogance. Well done.
    It's entertaining when VB coders talk with such clarity, instead of just screeching and flinging feces at each other like normal. Well done.
    +1e100 for that retort

  • Larry (unregistered)

    TRWTF is that no one knows what the "B" in "VB" stands for.

  • airdrik (unregistered)

    Here's my 2 cents:

    The syntax of the language should get out of the way of the content. When writing the code, you want something that lets you easily put together the content - putting together method calls, manipulating variables and objects, etc. When reading code, you want something that directs your attention to that content.

    IMO, a language that is more verbose is harder to read/write because of the extra verbosity, or "fluff", which tends to get in the way of the content more than assist in promoting the content. You may say that it is easier to read because it reads more like a novel, but we aren't writing novels, we are writing code. Sure for someone who is unfamiliar with the language, it will be easier for them to find out what's going on if the syntax is more words than symbols, but it becomes faster to scan through symbols than words for the actual content when you are familiar with the syntax of the language. Of course you can still go too far with replacing words with symbols, for example: APL, or Perl (where you can easily write entire programs without using any alphabetic characters). But it would seem that languages like C (et al), Python and Ruby strike the right balance with few reserved keywords, symbols for structure and emphasizing naming for clarity.

  • (cs) in reply to Steve The Cynic
    Steve The Cynic:
    Only me. And you, although maybe you went and looked it up.
    Alas... tomorrow is my 41st birthday, and I've been programming since the age of 13 (starting with BASIC on the TRS-80 model I). I also know what COBOL and APL stand for.

    Obviously, I don't remember the birthday dates of my in-laws, which is arguably a more important and useful thing to remember.

    Steve The Cynic:
    Oh, boy, Standard Pascal... No way to know how much memory is left, no way to tell that an allocation just failed, no way to acquire the name of a file into a variable and then open that file, fixed-length string variables that are just PACKED ARRAY[1..X] OF CHAR, do I need to continue?
    You forgot two-byte signed integers that couldn't exceed 32767.

    At least, Niklaus Wirth fixed that in Modula-2, which also had the cardinal type.

    Which was an two-byte unsigned integer that couldn't exceed 65535.

Leave a comment on “Property Basics”

Log In or post as a guest

Replying to comment #:

« Return to Article