• (cs) in reply to Anonymaly
    Anonymous:
    Pope:
    Anonymous:

    Andrew Hare:
    Explain to me which aspects of c# would be neccesary to prevent production from grinding to a halt if you were forced to use vb?

    In my opinion, a cleaner, more elegant and more easily readable syntax.

    Interesting.  I find VB.NET to be more closely related to actual language... by far.  I started in C++ and found myself continually pulling my hair out due to braces and semicolons.

    More elegant?  Why?  Because it makes you feel like you're programming a space shuttle?

    Cleaner?  Why?  Is this not due to the programmer's abilities?

    I'm always hearing why everyone should use C# instead of that "toy language" VB.NET, and I never hear why.  AndAlso, I've found I can accomplish the same tasks in both languages in the same amount of time. 

    Whoah there Cowboy.  I did remember to note that it was my opinion.  No, I do not find that it feels remotely anything like programming a "space shuttle"; that's quite an odd comparison.

    However, having used assembly language, C and C++ for quite some time, I have become accustomed to mnemonics and terse reprentation of complex expressions without the need for it to read like "Green Eggs and Ham".

    It was a matter of becoming accustomed to that programming style.  Learning C# has made me more productive "out of the box".  Having used Visual Basic 6.0 for quite some time, I can read VB.NET as well --it just hurts my eyes.

    DON'T CALL ME COWBOY!  Just kidding.  Yeah, the space shuttle thing was a bit much... just... I guess... trolling.  I'm currently taking a hyperbole class... I'm failing.

    I agree with your "Green Eggs and Ham" statement.  Until this thread, I've never really thought about how things like || and && could split up a bunch of text rather than making it look like a bunch of clicks and whistles where language should be.  Thanks.

  • Anonymaly (unregistered) in reply to Pope
    Pope:
    Anonymous:
    Anonymous:

    AndAlso would seem to be more intuitive than ||.  I think the whole point of this WTF is you should learn the language before criticizing it.

    Of course "AndAlso" would be much more intuitive than "||".  That's because "||" actually maps to "OrElse" in VB.NET.  Yes, I knew you meant "&&".  However, both those operators are 'mnemonics'.  I prefer using a mnemonic; to me, it makes the code seem less verbose or 'busy'.

    That's a really interesting point... like being able to pick out numbers on a page of text because they stand out when imbedded in regular text.  Hmm.  Thanks.

    What's actually amusing about your sarcastic reply is the sheer fact that punctuation exists for the English language.  For example, the comma, the period, the apostrophe, the exclamation point, the colon and the semicolon.

    It seems having these foreign little "visual cues" makes it so much easier to read things that are written within that jumble of letters and numbers, but it's just not obvious what they do until you actually learn what they mean.

  • (cs) in reply to Alex Papadimoulis
    Alex Papadimoulis:

    wintermyute:
    VB.NET (as supported in VS.NET 2003) does not support XML comments without a VS plug-in. 

    //open up a connection to the database server

    WTF does that say?

    //<COMMENT>open up a connection to the database server</COMMENT>

    Ahhh ... so much clearer ...

     

    (Yes, I know what you meant -- just a joke)

    Forum software 1, Forum owner 0.

  • (cs) in reply to Anonymaly
    Anonymous:
    Pope:
    Anonymous:
    Anonymous:

    AndAlso would seem to be more intuitive than ||.  I think the whole point of this WTF is you should learn the language before criticizing it.

    Of course "AndAlso" would be much more intuitive than "||".  That's because "||" actually maps to "OrElse" in VB.NET.  Yes, I knew you meant "&&".  However, both those operators are 'mnemonics'.  I prefer using a mnemonic; to me, it makes the code seem less verbose or 'busy'.

    That's a really interesting point... like being able to pick out numbers on a page of text because they stand out when imbedded in regular text.  Hmm.  Thanks.

    What's actually amusing about your sarcastic reply is the sheer fact that punctuation exists for the English language.  For example, the comma, the period, the apostrophe, the exclamation point, the colon and the semicolon.

    It seems having these foreign little "visual cues" makes it so much easier to read things that are written within that jumble of letters and numbers, but it's just not obvious what they do until you actually learn what they mean.

    1.) Step away from your computer.  2.) Start talking to real people every once in a while.  When someone says "thanks," it can also mean "THANK YOU."  I wasn't being sarcastic, just thinking out loud.  I admit that it did sound sarcastic, though... and that it would have been best if I kept it to myself.  :)

  • (cs) in reply to Pope
    Pope:
    Anonymous:

    Andrew Hare:
    Explain to me which aspects of c# would be neccesary to prevent production from grinding to a halt if you were forced to use vb?

    In my opinion, a cleaner, more elegant and more easily readable syntax.

    Interesting.  I find VB.NET to be more closely related to actual language... by far.  I started in C++ and found myself continually pulling my hair out due to braces and semicolons.

    More elegant?  Why?  Because it makes you feel like you're programming a space shuttle?

    Cleaner?  Why?  Is this not due to the programmer's abilities?

    I'm always hearing why everyone should use C# instead of that "toy language" VB.NET, and I never hear why.  AndAlso, I've found I can accomplish the same tasks in both languages in the same amount of time. 



    Maybe because being presented with a page of pure text is incredibly hard to parse, interpret and understand quickly.
    Something =
    If This Or That And OtherThing = Something Then
      SomethingElse = AnotherThing
    End If
    vs.
    if (This || That && Otherthing == Something)
    {
      SomethingElse = AnotherThing;
    }

    which is easier to read? The one with loads of "craaazy symbols" or the one where you can't even tell the difference between a variable name and an operator without reading the word?
  • (cs)

    Sure, a big WTF as programmers try to code around their complete ignorance of typed interfaces and references to such ...
    <p>
    but is it that unreasonable to ask that
    control.checked = True;
    should work?  :)
    <p>
    This is what happens when you take programmers who were weened on weakly typed object references and ask them to convert to static types ... As someone who very much appreciates Smalltalk, ruby, objective c, and that design paradigm, I can appreciate the programmers' frustrations.
    <p>
    Yeah, type cast it to a ICheckBoxControl.  What a solution, so we enforce compile time type checking!  ... And we're left with run time cast exceptions, or no-ops.

  • (cs) in reply to Casiotone

    remove the Something = from the start of that bit, oops :)

  • (cs) in reply to Alex Papadimoulis

    Heh.

    For those of you not familiar with .Net, C# XML comments can be used to generate javadoc-like documentation for classes, methods, events, etc.  Visual Studio displays these with the "IntelliSense" auto-completion -- which can be quite handy.  The unfortunate fact is that many people won't go to the extra trouble of installing the plug-in for VB.NET to add this feature.  I'm not saying that this is a failing only of VB.NET developers, but it's a nice little feature that I have wished on a couple occassions that certain VB.NET developers knew how to use.  This isn't actually a gripe about VB.NET, but about disparate support for C# and VB.NET in Visual Studio.

    Did I mention that the VB.NET syntax makes me want to vomit blood forever?

  • Whiskey Tango Foxtrot? Over. (unregistered) in reply to Anonymaly
    Anonymous:
    What's actually amusing about your sarcastic reply is the sheer fact that punctuation exists for the English language.  For example, the comma, the period, the apostrophe, the exclamation point, the colon and the semicolon.

    It seems having these foreign little "visual cues" makes it so much easier to read things that are written within that jumble of letters and numbers, but it's just not obvious what they do until you actually learn what they mean.

    English Grammar, the VB way:

    BeginSentence

       You know

       Pause

       I think you may be on to something there

       EmphasizeSentence

    EndSentence

  • (cs) in reply to Djinn
    Djinn:
    januarys:

    I'm just excited that the submission was made by a woman. Three cheers for smart chicks!!!



    I second your base sentiment, but it's wrong of you to associate programming with "smarts". This industry does suffer from sausagefestivess.

    "Sausagefestivess"???

    Criminy - I can't even tell if that's supposed to relate to "smart" or to "woman".

    Wait - I'll look it up ... AGGGHHHH!!! The Googles - they do nothing!

    I need to get out more ...

  • Anonymaly (unregistered) in reply to Pope
    Pope:

    1.) Step away from your computer.  2.) Start talking to real people every once in a while.  When someone says "thanks," it can also mean "THANK YOU."  I wasn't being sarcastic, just thinking out loud.  I admit that it did sound sarcastic, though... and that it would have been best if I kept it to myself.  :)

    My apologies Pope; the needle on the sarcasm meter was dipping a bit into the red.  Considering that was a sincere, "thanks", then you're most welcome.

  • VerdantBrekkies (unregistered) in reply to Pope

    In general, I'm a "GreenEggs AndAlso Ham" type of guy, but I think it should actually be "GreenEggs Or Ham" because if the eggs evaluate to false, I still want the ham.

  • pinguis (unregistered) in reply to VerdantBrekkies


    the pope said:

    More elegant?  Why?  Because it makes you feel like you're programming a space shuttle?



    In fact space shuttle programming  should resemble ALGOL

    see  http://en.wikipedia.org/wiki/Jovial

    As for beeing legacy, there are rumours that the new F-22 still uses portions of code in this language.


  • (cs) in reply to KeithSpook

    This is just ignorant.  Give credit where it is due, don't be a dumbass.  This kind of crap just clutters up an otherwise fun place to come read and laugh. 

  • (cs) in reply to pinguis
    Anonymous:


    the pope said:

    More elegant?  Why?  Because it makes you feel like you're programming a space shuttle?



    In fact space shuttle programming  should resemble ALGOL

    see  http://en.wikipedia.org/wiki/Jovial

    As for beeing legacy, there are rumours that the new F-22 still uses portions of code in this language.


    That's awesome!  Then I was right.  Programming in C# DOES make you feel like you're programming a space shuttle.

    Exhibit A: ALGOL uses bracketed statement blocks and was the first language to use begin end pairs for delimiting them.  I'ma call up NASA and tell them I am ready.

       

  • (cs) in reply to Pope
    Pope:
    Anonymous:
    Pope:
    Anonymous:

    Andrew Hare:
    Explain to me which aspects of c# would be neccesary to prevent production from grinding to a halt if you were forced to use vb?

    In my opinion, a cleaner, more elegant and more easily readable syntax.

    Interesting.  I find VB.NET to be more closely related to actual language... by far.  I started in C++ and found myself continually pulling my hair out due to braces and semicolons.

    More elegant?  Why?  Because it makes you feel like you're programming a space shuttle?

    Cleaner?  Why?  Is this not due to the programmer's abilities?

    I'm always hearing why everyone should use C# instead of that "toy language" VB.NET, and I never hear why.  AndAlso, I've found I can accomplish the same tasks in both languages in the same amount of time. 

    Whoah there Cowboy.  I did remember to note that it was my opinion.  No, I do not find that it feels remotely anything like programming a "space shuttle"; that's quite an odd comparison.

    However, having used assembly language, C and C++ for quite some time, I have become accustomed to mnemonics and terse reprentation of complex expressions without the need for it to read like "Green Eggs and Ham".

    It was a matter of becoming accustomed to that programming style.  Learning C# has made me more productive "out of the box".  Having used Visual Basic 6.0 for quite some time, I can read VB.NET as well --it just hurts my eyes.

    DON'T CALL ME COWBOY!  Just kidding.  Yeah, the space shuttle thing was a bit much... just... I guess... trolling.  I'm currently taking a hyperbole class... I'm failing.

    I agree with your "Green Eggs and Ham" statement.  Until this thread, I've never really thought about how things like || and && could split up a bunch of text rather than making it look like a bunch of clicks and whistles where language should be.  Thanks.

    I was gonna take a hyperbole class, but I couldn't get up for it... so instead I enrolled in hypobole... much more my style I think...

  • (cs) in reply to jvancil

    jvancil:
    This is just ignorant.  Give credit where it is due, don't be a dumbass.  This kind of crap just clutters up an otherwise fun place to come read and laugh. 

     

    ... of course it would be much better if I would have actually included a quote from the original post... so, basically...

     

    Never mind.

  • (cs)

    Personally, I would have replaced it with:

    Control c = FindControl(controlName);

    if (c != null && c is CheckBox)
       (c as CheckBox).Checked = true;

  • (cs) in reply to Brian Kemp
    Anonymous:

    Nope - the as operator returns null if the type cast cannot be completed.  From http://msdn.microsoft.com/library/en-us/csref/html/vclrfAs.asp?frame=true:

    The as operator is like a cast except that it yields null on conversion failure instead of raising an exception. More formally, an expression of the form:

    expression as type

    is equivalent to:

    expression is type ? (type)expression : (type)null

    except that expression is evaluated only once.

    Note that the as operator only performs reference conversions and boxing conversions. The as operator cannot perform other conversions, such as user-defined conversions, which should instead be performed using cast expressions.

     

    The best part is that the as operator seems to just do the try-catches for you...well, it feels like it.  There's noticable lag in my debugger when I get a null result from an as operator, which would be the exception being thrown then caught before your code ever sees it.

    C# version of the code:

    Control thisControl = FindControl(controlName);
    if (thisControl != null && thisControl is ICheckBoxControl)
    {
        ((ICheckBoxControl)(thisControl)).Checked = True;
    }

    I suppose there's a chance you're right. Anyone willing to try disassembling the resulting bytecode and taking a look at what's really going on?

  • (cs) in reply to januarys
    januarys:
    I'm just excited that the submission was made by a woman. Three cheers for smart chicks!!!


    LOL - you seem to be assuming that there aren't any chicks on this forum... which is always amusing to me (ah the InterWeb(tm) - the great anonymiser) :)

    Oh and I agree with Djinn that ability to program != smarts
    Though I am curious what he meant by "sausagefestiveness" ... though I think maybe I really shouldn't ask...

    Taryn
    gender = female (just to be clear).

  • Rain dog (unregistered) in reply to KeithSpook
    Anonymous:
    e.thermal:

    Anyone who would ok Vb.NET for corporate development is the true loser here....  ...Everytime I see VB.net code I am thoroughly reminded I made the right choice.

     

    Correct.  Vb.NET is an attempt at a programming language, and it is a bad business decision to write web applications in a programming language (or an attempt thereof).



    Are you on crack? What should we write web apps in? HTML?
  • Anonymaly (unregistered) in reply to Oliver Klozoff

    Oliver Klozoff:
    Personally, I would have replaced it with:

    Control c = FindControl(controlName);

    if (c != null && c is CheckBox)
       (c as CheckBox).Checked = true;

     

    It actually seems cleaner (In C#) to do the following:

    ICheckBoxControl control = FindControl(controlName) as ICheckBoxControl;

    if (control != null)
    {
       control.Checked = true;
    }

    If you use both 'is' and 'as', you are just adding redundant IL code under the hood.  Might as well just use the 'as' in the assignment and perform only one comparison of the result to null before setting the property.

  • Anonymouse (unregistered) in reply to Jeff S
    Jeff S:
    We've covered this a million times here.  They left "And" as a non-shortcurcuting operator for backwards compatability with previous versions of VB.  They added "AndAlso" to introduce a short-circuiting And operator to VB.NET.   Same with "Or" and "OrElse".

    You can say that maybe the names are a little silly, or they could have used symbols like in C#, but if you don't understand it, don't criticise it.


    It may have been covered a million times, but I'm kinda new here and its the first time I've heard about how VB handles its logic operators - Thank you for the explanation.

    However it seems like we can criticise VB for not implementing short-circuit evaluation in the first place.
  • diaphanein (unregistered) in reply to makomk
    makomk:
    Anonymous:

    Nope - the as operator returns null if the type cast cannot be completed.  From http://msdn.microsoft.com/library/en-us/csref/html/vclrfAs.asp?frame=true:

    The as operator is like a cast except that it yields null on conversion failure instead of raising an exception. More formally, an expression of the form:

    expression as type

    is equivalent to:

    expression is type ? (type)expression : (type)null

    except that expression is evaluated only once.

    Note that the as operator only performs reference conversions and boxing conversions. The as operator cannot perform other conversions, such as user-defined conversions, which should instead be performed using cast expressions.

     

    The best part is that the as operator seems to just do the try-catches for you...well, it feels like it.  There's noticable lag in my debugger when I get a null result from an as operator, which would be the exception being thrown then caught before your code ever sees it.

    C# version of the code:

    Control thisControl = FindControl(controlName);
    if (thisControl != null && thisControl is ICheckBoxControl)
    {
        ((ICheckBoxControl)(thisControl)).Checked = True;
    }

    I suppose there's a chance you're right. Anyone willing to try disassembling the resulting bytecode and taking a look at what's really going on?

    Sure, not quite the same, but here's the sample C#:

    <FONT color=#008000 size=2><FONT color=#008000 size=2>

    using </FONT><FONT color=#000000 size=2>System</FONT><FONT color=#006400 size=2>;

    </FONT><FONT color=#008000 size=2>

    namespace </FONT><FONT size=2><FONT color=#000000>AsTest
    </FONT></FONT><FONT color=#006400 size=2>{
       
    </FONT><FONT color=#ff0000 size=2>class </FONT><FONT size=2><FONT color=#000000>MainClass
       </FONT>
    </FONT><FONT color=#006400 size=2>{
          
    </FONT><FONT color=#0000ff size=2>public </FONT><FONT color=#a52a2a size=2>static </FONT><FONT color=#ff0000 size=2>void </FONT><FONT color=#191970 size=2>Main</FONT><FONT color=#006400 size=2>(</FONT><FONT color=#ff0000 size=2>string</FONT><FONT color=#006400 size=2>[] </FONT><FONT color=#000000 size=2>args</FONT><FONT color=#006400 size=2>)
          
    {
             
    </FONT><FONT color=#ff0000 size=2>string </FONT><FONT color=#000000 size=2>s </FONT><FONT color=#006400 size=2>= </FONT><FONT color=#ff00ff size=2>"Test"</FONT><FONT color=#006400 size=2>;
             
    </FONT><FONT color=#191970 size=2>WithAs</FONT><FONT color=#006400 size=2>(</FONT><FONT color=#000000 size=2>s</FONT><FONT color=#006400 size=2>);
             
    </FONT><FONT color=#191970 size=2>WithIs</FONT><FONT color=#006400 size=2>(</FONT><FONT color=#000000 size=2>s</FONT><FONT color=#006400 size=2>);
          
    }

          
    </FONT><FONT color=#0000ff size=2>private </FONT><FONT color=#a52a2a size=2>static </FONT><FONT color=#ff0000 size=2>void </FONT><FONT color=#191970 size=2>WithAs</FONT><FONT color=#006400 size=2>(</FONT><FONT color=#ff0000 size=2>object </FONT><FONT color=#000000 size=2>obj</FONT><FONT color=#006400 size=2>)
          
    {
             
    </FONT><FONT color=#ff0000 size=2>string </FONT><FONT color=#000000 size=2>s </FONT><FONT color=#006400 size=2>= </FONT><FONT color=#000000 size=2>obj </FONT><FONT color=#008b8b size=2>as </FONT><FONT color=#ff0000 size=2>string</FONT><FONT color=#006400 size=2>;
             
    </FONT><FONT color=#0000ff size=2>if </FONT><FONT color=#006400 size=2>(</FONT><FONT color=#000000 size=2>s </FONT><FONT color=#006400 size=2>!= </FONT><FONT color=#000000 size=2>null</FONT><FONT color=#006400 size=2>) </FONT><FONT color=#000000 size=2>Console</FONT><FONT color=#006400 size=2>.</FONT><FONT color=#191970 size=2>WriteLine</FONT><FONT color=#006400 size=2>(</FONT><FONT color=#000000 size=2>s</FONT><FONT color=#006400 size=2>);
          
    }

          
    </FONT><FONT color=#0000ff size=2>private </FONT><FONT color=#a52a2a size=2>static </FONT><FONT color=#ff0000 size=2>void </FONT><FONT color=#191970 size=2>WithIs</FONT><FONT color=#006400 size=2>(</FONT><FONT color=#ff0000 size=2>object </FONT><FONT color=#000000 size=2>obj</FONT><FONT color=#006400 size=2>)
          
    {
             
    </FONT><FONT color=#0000ff size=2>if </FONT><FONT color=#006400 size=2>(</FONT><FONT color=#000000 size=2>obj </FONT><FONT color=#006400 size=2>!= </FONT><FONT color=#000000 size=2>null </FONT><FONT color=#006400 size=2>&& </FONT><FONT color=#000000 size=2>obj </FONT><FONT color=#008b8b size=2>is </FONT><FONT color=#ff0000 size=2>string</FONT><FONT color=#006400 size=2>)
                
    </FONT><FONT color=#000000 size=2>Console</FONT><FONT color=#006400 size=2>.</FONT><FONT color=#191970 size=2>WriteLine</FONT><FONT color=#006400 size=2>((</FONT><FONT color=#ff0000 size=2>string</FONT><FONT color=#006400 size=2>)</FONT><FONT color=#000000 size=2>obj</FONT><FONT color=#006400 size=2>);
          
    </FONT><FONT color=#006400 size=2>}
       }
    </FONT><FONT color=#006400 size=2>}

    </FONT></FONT><FONT color=#006400 size=2>WithAs generates the following IL:</FONT>

    <FONT color=#1000a0>.method</FONT> <FONT color=#1000a0>private</FONT> <FONT color=#1000a0>hidebysig</FONT> <FONT color=#1000a0>static</FONT> <FONT color=#006018>void</FONT> WithAs(<FONT color=#006018>object</FONT> obj)<FONT color=#1000a0> </FONT><FONT color=#1000a0>cil</FONT><FONT color=#1000a0> </FONT><FONT color=#1000a0>managed</FONT>
    {
          <FONT color=#808080>// Code Size: 17 byte(s)</FONT>
          <FONT color=#1000a0>.maxstack</FONT> 1
          <FONT color=#1000a0>.locals</FONT> <FONT color=#1000a0>init</FONT> (
                <FONT color=#006018>string</FONT> text1)
          L_0000: <FONT color=#006018>ldarg.0</FONT> 
          L_0001: <FONT color=#006018>isinst</FONT> <FONT color=#006018>string</FONT>
          L_0006: <FONT color=#006018>stloc.0</FONT> 
          L_0007: <FONT color=#006018>ldloc.0</FONT> 
          L_0008: <FONT color=#006018>brfalse.s</FONT> L_0010
          L_000a: <FONT color=#006018>ldloc.0</FONT> 
          L_000b: <FONT color=#006018>call</FONT> <FONT color=#006018>void</FONT> [<FONT color=#006018>mscorlib</FONT>]<FONT color=#006018>System.Console</FONT>::<FONT color=#006018>WriteLine</FONT>(<FONT color=#006018>string</FONT>)
          L_0010: <FONT color=#006018>ret</FONT> 
    }
    
    WithIs generates this IL:
    <FONT color=#1000a0>method</FONT> <FONT color=#1000a0>private</FONT> <FONT color=#1000a0>hidebysig</FONT> <FONT color=#1000a0>static</FONT> <FONT color=#006018>void</FONT> WithIs(<FONT color=#006018>object</FONT> obj)<FONT color=#1000a0> </FONT><FONT color=#1000a0>cil</FONT><FONT color=#1000a0> </FONT><FONT color=#1000a0>managed</FONT> { <FONT color=#808080>// Code Size: 23 byte(s)</FONT> <FONT color=#1000a0>.maxstack</FONT> 1 L_0000: <FONT color=#006018>ldarg.0</FONT> L_0001: <FONT color=#006018>brfalse.s</FONT> L_0016 L_0003: <FONT color=#006018>ldarg.0</FONT> L_0004: <FONT color=#006018>isinst</FONT> <FONT color=#006018>string</FONT> L_0009: <FONT color=#006018>brfalse.s</FONT> L_0016 L_000b: <FONT color=#006018>ldarg.0</FONT> L_000c: <FONT color=#006018>castclass</FONT> <FONT color=#006018>string</FONT> L_0011: <FONT color=#006018>call</FONT> <FONT color=#006018>void</FONT> [<FONT color=#006018>mscorlib</FONT>]<FONT color=#006018>System.Console</FONT>::<FONT color=#006018>WriteLine</FONT>(<FONT color=#006018>string</FONT>) L_0016: <FONT color=#006018>ret</FONT> }
    As you can see, the As version is smaller, but has an extra local.  
    In the case of the controls above, the local is present for both.
    The As version has fewer conditional branches (so less branch prediction need)
    and its st/ld would probably be optimized away at the native level when JITed.
    BTW, MS's best practices will typically use the as operator for this sort of usage.
    Also, I wouldn't make any qualitative comparisons based upon single-stepping through the debugger.
  • (cs) in reply to taryn

    taryn:
    januarys:
    I'm just excited that the submission was made by a woman. Three cheers for smart chicks!!!


    LOL - you seem to be assuming that there aren't any chicks on this forum... which is always amusing to me (ah the InterWeb(tm) - the great anonymiser) :)

    Oh and I agree with Djinn that ability to program != smarts
    Though I am curious what he meant by "sausagefestiveness" ... though I think maybe I really shouldn't ask...

    Taryn
    gender = female (just to be clear).

    A "sausagefest" is a gathering of humans that are predominantly male.  It originally was used to describe a party with not enough chicks but has since become part of the vernacular.

    The name is derived from a sausage-like appendage that women lack.

    Heh heh.

  • (cs) in reply to Pope
    Pope:
    Anonymous:

    Andrew Hare:
    Explain to me which aspects of c# would be neccesary to prevent production from grinding to a halt if you were forced to use vb?

    In my opinion, a cleaner, more elegant and more easily readable syntax.

    Interesting.  I find VB.NET to be more closely related to actual language... by far.  I started in C++ and found myself continually pulling my hair out due to braces and semicolons.

    More elegant?  Why?  Because it makes you feel like you're programming a space shuttle?

    Cleaner?  Why?  Is this not due to the programmer's abilities?

    I'm always hearing why everyone should use C# instead of that "toy language" VB.NET, and I never hear why.  AndAlso, I've found I can accomplish the same tasks in both languages in the same amount of time. 

    VB.NET != C#
    Don't believe the marketing material which says they are the same because they compile to the same intermediate language. The VB.NET compiler is very very different from the C# compiler. There is a set of MSIL commands guaranteed to cause problems at runtime that the C# compiler will never produce that the VB.NET compiler will happily allow.

    For example, have you ever had a brain-dead moment while implementing a method which returns an instance of Widget and forgotten to return instance you spent a few lines of code creating? When I do such braindead things, the C# compiler refuses to compile saying not all code paths return a value. The VB.NET compiler just returns a variant. No compiler error. At runtime it returns happily but when you start trying to do stuff to it like call methods and properties, it starts to spew.

    There are lots of other things where the VB.NET compiler won't catch your mistakes (adding or omitting parentheses by mistake) even though the compile code is guaranteed to fail at run time. C# compiler does not allow that sort of nonsense. C# is by no means perfect, but do not be fooled into thinking it is the same as VB.NET. C# compiler catches way more errors at compile time. If you're smart you won't ever make compile time errors so it's a moot point. If you're like me, you need all the help you can get to catch your mistakes and the sooner the better.

    Take your pick as to which you prefer, but VB.NET is not the same as C#

  • (cs) in reply to zip
    zip:
    Pope:
    Anonymous:

    Andrew Hare:
    Explain to me which aspects of c# would be neccesary to prevent production from grinding to a halt if you were forced to use vb?

    In my opinion, a cleaner, more elegant and more easily readable syntax.

    More elegant?  Why?  Because it makes you feel like you're programming a space shuttle?

    Cleaner?  Why?  Is this not due to the programmer's abilities?

    I find c#/c++/java/anything not VB cleaner and more elegant because it is less verbose, using brackets instead of words for delimiting blocks.  I also think "WEnd" is totally unnecessary.

    That's a pure fallacy, Ruby uses keywords to delimit blocks and no sane man would ever try to utter that it's more verbose than C++, Java or C#.

  • (cs) in reply to VerdantBrekkies

    Anonymous:
    In general, I'm a "GreenEggs AndAlso Ham" type of guy, but I think it should actually be "GreenEggs Or Ham" because if the eggs evaluate to false, I still want the ham.

    Even if it is FileNotFound?

  • Gregs (unregistered) in reply to pinguis
    Anonymous:


    the pope said:

    More elegant?  Why?  Because it makes you feel like you're programming a space shuttle?



    In fact space shuttle programming  should resemble ALGOL

    see  http://en.wikipedia.org/wiki/Jovial

    As for beeing legacy, there are rumours that the new F-22 still uses portions of code in this language.


     

    Actually the space shuttle's computers are programmed in HAL/S (http://en.wikipedia.org/wiki/HAL/S)

    The same computers are used by the USAF, and they program them in Jovial.

    (Something tells me I spend too much time wandering around wikipedia)

  • (cs) in reply to mike5
    Anonymous:
    Gotta love a language that has "AndAlso" operator...

    Cheers, Mike5
    <font size="5">A</font>t least Microsoft bent to public pressure and put it in.  They could have kept up with their "VB isn't C" and the NIH nonsense.

  • (cs) in reply to taryn

    taryn:
    januarys:
    I'm just excited that the submission was made by a woman. Three cheers for smart chicks!!!


    LOL - you seem to be assuming that there aren't any chicks on this forum... which is always amusing to me (ah the InterWeb(tm) - the great anonymiser) :)

    Oh and I agree with Djinn that ability to program != smarts
    Though I am curious what he meant by "sausagefestiveness" ... though I think maybe I really shouldn't ask...

    Taryn
    gender = female (just to be clear).

    Speaking af assumptions, how do you know that januarys isn't a chick? And (obligatory reference to previous thread) is your gender female, or is your sex female? Not so clear after all ...

    Agreed that the ability to program is not necessarily an indication of smarts ... however, the ability to get paid to program while actually posting code and comments to TDWTF is definitely a sign of pure genius (it's true - ask anyone who hangs out here ...)

  • (cs) in reply to diaphanein
    Anonymous:

    Sure, not quite the same, but here's the sample C#:

    <FONT color=#008000 size=2><FONT color=#008000 size=2>

    using </FONT><FONT color=#000000 size=2>System</FONT><FONT color=#006400 size=2>;

    </FONT><FONT color=#008000 size=2>

    namespace </FONT><FONT size=2><FONT color=#000000>AsTest
    </FONT></FONT><FONT color=#006400 size=2>{
       
    </FONT><FONT color=#ff0000 size=2>class </FONT><FONT size=2><FONT color=#000000>MainClass
       </FONT>
    </FONT><FONT color=#006400 size=2>{
          
    </FONT><FONT color=#0000ff size=2>public </FONT><FONT color=#a52a2a size=2>static </FONT><FONT color=#ff0000 size=2>void </FONT><FONT color=#191970 size=2>Main</FONT><FONT color=#006400 size=2>(</FONT><FONT color=#ff0000 size=2>string</FONT><FONT color=#006400 size=2>[] </FONT><FONT color=#000000 size=2>args</FONT><FONT color=#006400 size=2>)
          
    {
             
    </FONT><FONT color=#ff0000 size=2>string </FONT><FONT color=#000000 size=2>s </FONT><FONT color=#006400 size=2>= </FONT><FONT color=#ff00ff size=2>"Test"</FONT><FONT color=#006400 size=2>;
             
    </FONT><FONT color=#191970 size=2>WithAs</FONT><FONT color=#006400 size=2>(</FONT><FONT color=#000000 size=2>s</FONT><FONT color=#006400 size=2>);
             
    </FONT><FONT color=#191970 size=2>WithIs</FONT><FONT color=#006400 size=2>(</FONT><FONT color=#000000 size=2>s</FONT><FONT color=#006400 size=2>);
          
    }

          
    </FONT><FONT color=#0000ff size=2>private </FONT><FONT color=#a52a2a size=2>static </FONT><FONT color=#ff0000 size=2>void </FONT><FONT color=#191970 size=2>WithAs</FONT><FONT color=#006400 size=2>(</FONT><FONT color=#ff0000 size=2>object </FONT><FONT color=#000000 size=2>obj</FONT><FONT color=#006400 size=2>)
          
    {
             
    </FONT><FONT color=#ff0000 size=2>string </FONT><FONT color=#000000 size=2>s </FONT><FONT color=#006400 size=2>= </FONT><FONT color=#000000 size=2>obj </FONT><FONT color=#008b8b size=2>as </FONT><FONT color=#ff0000 size=2>string</FONT><FONT color=#006400 size=2>;
             
    </FONT><FONT color=#0000ff size=2>if </FONT><FONT color=#006400 size=2>(</FONT><FONT color=#000000 size=2>s </FONT><FONT color=#006400 size=2>!= </FONT><FONT color=#000000 size=2>null</FONT><FONT color=#006400 size=2>) </FONT><FONT color=#000000 size=2>Console</FONT><FONT color=#006400 size=2>.</FONT><FONT color=#191970 size=2>WriteLine</FONT><FONT color=#006400 size=2>(</FONT><FONT color=#000000 size=2>s</FONT><FONT color=#006400 size=2>);
          
    }

          
    </FONT><FONT color=#0000ff size=2>private </FONT><FONT color=#a52a2a size=2>static </FONT><FONT color=#ff0000 size=2>void </FONT><FONT color=#191970 size=2>WithIs</FONT><FONT color=#006400 size=2>(</FONT><FONT color=#ff0000 size=2>object </FONT><FONT color=#000000 size=2>obj</FONT><FONT color=#006400 size=2>)
          
    {
             
    </FONT><FONT color=#0000ff size=2>if </FONT><FONT color=#006400 size=2>(</FONT><FONT color=#000000 size=2>obj </FONT><FONT color=#006400 size=2>!= </FONT><FONT color=#000000 size=2>null </FONT><FONT color=#006400 size=2>&& </FONT><FONT color=#000000 size=2>obj </FONT><FONT color=#008b8b size=2>is </FONT><FONT color=#ff0000 size=2>string</FONT><FONT color=#006400 size=2>)
                
    </FONT><FONT color=#000000 size=2>Console</FONT><FONT color=#006400 size=2>.</FONT><FONT color=#191970 size=2>WriteLine</FONT><FONT color=#006400 size=2>((</FONT><FONT color=#ff0000 size=2>string</FONT><FONT color=#006400 size=2>)</FONT><FONT color=#000000 size=2>obj</FONT><FONT color=#006400 size=2>);
          
    </FONT><FONT color=#006400 size=2>}
       }
    </FONT><FONT color=#006400 size=2>}

    </FONT></FONT><FONT color=#006400 size=2>WithAs generates the following IL:</FONT>

    <FONT color=#1000a0>.method</FONT> <FONT color=#1000a0>private</FONT> <FONT color=#1000a0>hidebysig</FONT> <FONT color=#1000a0>static</FONT> <FONT color=#006018>void</FONT> WithAs(<FONT color=#006018>object</FONT> obj)<FONT color=#1000a0> </FONT><FONT color=#1000a0>cil</FONT><FONT color=#1000a0> </FONT><FONT color=#1000a0>managed</FONT>
    {
          <FONT color=#808080>// Code Size: 17 byte(s)</FONT>
          <FONT color=#1000a0>.maxstack</FONT> 1
          <FONT color=#1000a0>.locals</FONT> <FONT color=#1000a0>init</FONT> (
                <FONT color=#006018>string</FONT> text1)
          L_0000: <FONT color=#006018>ldarg.0</FONT> 
          L_0001: <FONT color=#006018>isinst</FONT> <FONT color=#006018>string</FONT>
          L_0006: <FONT color=#006018>stloc.0</FONT> 
          L_0007: <FONT color=#006018>ldloc.0</FONT> 
          L_0008: <FONT color=#006018>brfalse.s</FONT> L_0010
          L_000a: <FONT color=#006018>ldloc.0</FONT> 
          L_000b: <FONT color=#006018>call</FONT> <FONT color=#006018>void</FONT> [<FONT color=#006018>mscorlib</FONT>]<FONT color=#006018>System.Console</FONT>::<FONT color=#006018>WriteLine</FONT>(<FONT color=#006018>string</FONT>)
          L_0010: <FONT color=#006018>ret</FONT> 
    }
    
    WithIs generates this IL:
    <FONT color=#1000a0>method</FONT> <FONT color=#1000a0>private</FONT> <FONT color=#1000a0>hidebysig</FONT> <FONT color=#1000a0>static</FONT> <FONT color=#006018>void</FONT> WithIs(<FONT color=#006018>object</FONT> obj)<FONT color=#1000a0> </FONT><FONT color=#1000a0>cil</FONT><FONT color=#1000a0> </FONT><FONT color=#1000a0>managed</FONT> { <FONT color=#808080>// Code Size: 23 byte(s)</FONT> <FONT color=#1000a0>.maxstack</FONT> 1 L_0000: <FONT color=#006018>ldarg.0</FONT> L_0001: <FONT color=#006018>brfalse.s</FONT> L_0016 L_0003: <FONT color=#006018>ldarg.0</FONT> L_0004: <FONT color=#006018>isinst</FONT> <FONT color=#006018>string</FONT> L_0009: <FONT color=#006018>brfalse.s</FONT> L_0016 L_000b: <FONT color=#006018>ldarg.0</FONT> L_000c: <FONT color=#006018>castclass</FONT> <FONT color=#006018>string</FONT> L_0011: <FONT color=#006018>call</FONT> <FONT color=#006018>void</FONT> [<FONT color=#006018>mscorlib</FONT>]<FONT color=#006018>System.Console</FONT>::<FONT color=#006018>WriteLine</FONT>(<FONT color=#006018>string</FONT>) L_0016: <FONT color=#006018>ret</FONT> }
    As you can see, the As version is smaller, but has an extra local.  
    In the case of the controls above, the local is present for both.
    The As version has fewer conditional branches (so less branch prediction need)
    and its st/ld would probably be optimized away at the native level when JITed.
    BTW, MS's best practices will typically use the as operator for this sort of usage.
    Also, I wouldn't make any qualitative comparisons based upon single-stepping through the debugger.

    Hmmm... looking at that disassembly makes me wonder if perhaps you could actually get away without checking that obj != null; it looks likely that the "is" operator always returns false if called on null. Do you know if this in any way guaranteed?

  • (cs) in reply to Rain dog
    Anonymous:
    Anonymous:

    Correct.  Vb.NET is an attempt at a programming language, and it is a bad business decision to write web applications in a programming language (or an attempt thereof).



    Are you on crack? What should we write web apps in? HTML?


    We should write apps the good old fashioned way, carrying our bits from the database over to the web server one at a time... uphill... both ways... in the snow...   And we like it that way!
  • Alex Pamplemousse (unregistered) in reply to makomk

    'AndAlso'... really? wtf is wrong with '&&' ?

  • (cs) in reply to taryn
    taryn:
    januarys:
    I'm just excited that the submission was made by a woman. Three cheers for smart chicks!!!


    LOL - you seem to be assuming that there aren't any chicks on this forum... which is always amusing to me (ah the InterWeb(tm) - the great anonymiser) :)

    Oh and I agree with Djinn that ability to program != smarts
    Though I am curious what he meant by "sausagefestiveness" ... though I think maybe I really shouldn't ask...

    Taryn
    gender = female (just to be clear).



    I don't see why anyone would give a fig about the gender of people posting on an Internet forum.

    I'm never going to have anything to do with anyone's genitals from this forum so it's a real non-issue. And as far as the "female programmer" perspective goes - I don't think that adds anything to a discussion on poor code. (Although it could add to a discussion on the dynamics of an office but I'm not really interested in that.)

    To anyone monitoring this stuff, I remain:
    Gender: null

    sincerely,
    Richard Nixon

  • John Hensley (unregistered) in reply to Anonymouse
    Anonymous:

    However it seems like we can criticise VB for not implementing short-circuit evaluation in the first place.

    VB's "And" and "Or" follow the original behavior of the BASIC language. You'll have to blame Kemeny and Kurtz for that one.

  • John Hensley (unregistered) in reply to Alex Pamplemousse
    Anonymous:
    'AndAlso'... really? wtf is wrong with '&&' ?

    It would look ugly in a Basic program, that's what. Perl shows where that sort of thinking leads.

  • Geoff (unregistered) in reply to Pope

    'Natural Language' programming languages are all crap. All of them. English is the most ambiguous lexicon known to humanity. Why the heck would I want to make my programming language ambiguous?

    You are going to begin to grep a symbol or an 'english equivilent' as an entity completely unrelated to its common definition, regardless of what said symbols actually is: be it the '|' or the AndAlso.

    Anyway, VB bugs me to death for reasons that aren't fully valid in the scope of 'should I use this for building web apps etc etc.'. There ARE good uses for a wizard-driven language. I despise VB more for the fact that 'back in the day' clueless coders would develop APPLICATION CODE in VB, when the POINT of VB was to do simple GUI based development, and to link to DLLs to do the real grunt work.

    Now that reason is gone. We are simply left with the problem which ANY 'training language' (I say that because it IS used as a first language in many cases, not as derision) is cursed with: you get a lot of bad code from people who started learning on language 'x', and never ever bothered to learn other languages. COBOL had this too; sure, a bunch of people turned out some bloody good code. But a bunch of other people turned out a bunch of complete crap. Guess which makes itself known?

    As for the real failings in VB: http://www.ddj.com/documents/s=1503/ddj0001vs/jan00.htm

    Some of those may be fixed. Dunno. Cheers,

  • Dingle (unregistered) in reply to mike5
    Anonymous:
    Gotta love a language that has "AndAlso" operator...

    Cheers, Mike5


    Actually "AndAlso" was defined in the file "BetterVB.bas"
  • procyon (unregistered) in reply to jvancil
    jvancil:
    Pope:
    Anonymous:
    Pope:
    Anonymous:

    Andrew Hare:
    Explain to me which aspects of c# would be neccesary to prevent production from grinding to a halt if you were forced to use vb?

    In my opinion, a cleaner, more elegant and more easily readable syntax.

    Interesting.  I find VB.NET to be more closely related to actual language... by far.  I started in C++ and found myself continually pulling my hair out due to braces and semicolons.

    More elegant?  Why?  Because it makes you feel like you're programming a space shuttle?

    Cleaner?  Why?  Is this not due to the programmer's abilities?

    I'm always hearing why everyone should use C# instead of that "toy language" VB.NET, and I never hear why.  AndAlso, I've found I can accomplish the same tasks in both languages in the same amount of time. 

    Whoah there Cowboy.  I did remember to note that it was my opinion.  No, I do not find that it feels remotely anything like programming a "space shuttle"; that's quite an odd comparison.

    However, having used assembly language, C and C++ for quite some time, I have become accustomed to mnemonics and terse reprentation of complex expressions without the need for it to read like "Green Eggs and Ham".

    It was a matter of becoming accustomed to that programming style.  Learning C# has made me more productive "out of the box".  Having used Visual Basic 6.0 for quite some time, I can read VB.NET as well --it just hurts my eyes.

    DON'T CALL ME COWBOY!  Just kidding.  Yeah, the space shuttle thing was a bit much... just... I guess... trolling.  I'm currently taking a hyperbole class... I'm failing.

    I agree with your "Green Eggs and Ham" statement.  Until this thread, I've never really thought about how things like || and && could split up a bunch of text rather than making it look like a bunch of clicks and whistles where language should be.  Thanks.

    I was gonna take a hyperbole class, but I couldn't get up for it... so instead I enrolled in hypobole... much more my style I think...



    I've always wanted to be good at parabole, but I'm not sure how to speak non assymptotically.
  • (cs) in reply to wintermyute

    wintermyute:
    Did I mention that the VB.NET syntax makes me want to vomit blood forever?

    Who knew there were so many delicate aesthetes among programmers?  But I shouldn't talk--Perl syntax annoys the piss out of me.

  • joh6nn (unregistered) in reply to Pope

    Also, deine Argument hat weniger Sinn Falls man uebersetzts auf Deutsch.

    i've been told that there 80 or so languages throughout the world that can be thought of as "widely spoken".  assuming that's true, your "more closely related to actual language" carries a lot less weight with regards to any of the 79 other languages.   besides which, you'd have to do some footwork to convince me that a programming language's resemblence to natural language is beneficial: the most you could say about something's resemblance to natural language is that it would be easy to learn.  i'm inclined to think that the measure of a programming language ought not to be how easy it is to learn, but rather, how useful it is. 

  • Anonymous (unregistered) in reply to januarys
    januarys:

    I'm just excited that the submission was made by a woman. Three cheers for smart chicks!!!

    It's comments like this that keep us away.

  • Alan Trick (unregistered) in reply to Anonymous

    VB is a bastard. Really, it is! VB.Net is nothing like VB6, the only difference between VB.Net and C# are the keywords, syntax and case sensitivity. Basically you could probably write a script to convert one to another in 30 minutes.

  • Joe (unregistered) in reply to John Hensley

    No

  • (cs) in reply to KeithSpook
    Anonymous:
    e.thermal:

    Anyone who would ok Vb.NET for corporate development is the true loser here....  ...Everytime I see VB.net code I am thoroughly reminded I made the right choice.

     

    Correct.  Vb.NET is an attempt at a programming language, and it is a bad business decision to write web applications in a programming language (or an attempt thereof).

    So what do you write web pages with?  Text files?

    ( http://www.mysite.com/index.txt )
    Welcome to my site!
    For the main menu, go to menu.txt
    For my downloads page, go to downloads.txt
    For my blog, go to blog.txt

  • FlorentG (unregistered) in reply to Geoff
    Anonymous:
    ' As for the real failings in VB: http://www.ddj.com/documents/s=1503/ddj0001vs/jan00.htm

    Why do you quote a 6 years old article which apply to VB6, and not VB.NET ?
  • (cs) in reply to DZ-Jay

    So I suppose you think that && is more intuitive at first glance, huh?

  • utunga (unregistered) in reply to Anonymaly
    Anonymous:

    Oliver Klozoff:
    Personally, I would have replaced it with:

    Control c = FindControl(controlName);

    if (c != null && c is CheckBox)
       (c as CheckBox).Checked = true;

     

    It actually seems cleaner (In C#) to do the following:

    ICheckBoxControl control = FindControl(controlName) as ICheckBoxControl;

    if (control != null)
    {
       control.Checked = true;
    }

    If you use both 'is' and 'as', you are just adding redundant IL code under the hood.  Might as well just use the 'as' in the assignment and perform only one comparison of the result to null before setting the property.

     

    You say that "seems cleaner" but then you justify it by pointing out that its easier on the compiler. Just my opinion but I'm totally with Oliver on this one.

    Worrying about redundant IL is precisely the kind of thing that programmers (myself included) have to resist, when they are trying to write clean, easily maintained code.

    Worry about the programmers that come after more than the the compiler. You're talking about saving a few trillionths of a second in performance, in return for what seems to me like a less obvious statement of events.

    The human brain (at least my brain) thinks first.. "if this thing is an x" and then "I'll just make sure this is an x so I can do y with it".. much easier to follow and understand than "supposing for a second i treat this as an x, then if its null, that means it wasn't really an x, but if it is not null, then it must've been an x all along so I will now do y" which is basically what goes through my brain (andAlso, no, I definitely don't want to write it out like that, give me curlies any day.).

    utunga

    PS have you noticed that the captcha works if you submit right after it renders but doesn't if you take a while before you submit - could this be a case of a non-multithreaded web-app? or perhaps (heaven forbid) the use of a static to store the desired captcha text?

  • (cs) in reply to SysRq2000
    SysRq2000:
    So I suppose you think that && is more intuitive at first glance, huh?


    It's true.

    && is not more intuitive than 'AndAlso'.

    && must be learned.

    'AndAlso' has implicit meaning.

    Who cares.

    Point is moot, since a programming language doesn't have to be that intuitive.

    A programmer will learn the language. If he needs to learn that && means a strict AND then he will. End of story. No programmer will complain that a language is crap because he couldn't figure it out at first glance, and nor should he. He should shut up and whip out the reference manual.

    'Making it intuitive' applies to interfaces aimed at the person who needs to perform a task with 0.0 hassle && cannot be required to sit back and learn the interface.
    Example: ticket machines at the train station.
    Example: cash machines
    Example: the on-screen options on your monitor or TV.

    Software interfaces are in the grey zone. You need to make 'em "easy to use", "efficient", "intuitive" but you, as interface designer, can require your users to learn the damn program.

    Photoshop can be hard. Softimage XSI is definitely hard. Public Websites should be easy, at all times, no exceptions.

Leave a comment on “Way To Go O.O.!”

Log In or post as a guest

Replying to comment #:

« Return to Article