• (cs) in reply to OneFactor
    OneFactor:

    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.

     

    <FONT size=5>Option Explicit On</FONT>

    <FONT size=5>Option Strict On</FONT>

     

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

    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?

    Natural language? Programming more closely resembles mathematics than storytelling. Ask a mathematician why they use all those confusing symbols instead of writing out "three times X plus Z squared divided by the square root of Y factorial minus W to the fifth power". If you take the time to learn the symbology, it is really and truly easier to read and understand.

    If you were a mathematician, you'd use a functional programming language, not an imperative one.

    Since you aren't a mathematician, you like reading stories

  • (cs) in reply to OneFactor
    OneFactor:

    I will bet money that if your boss is a male from France, then he spells his name "Michel".

    I'm not a betting man. It has been years since I last contacted him, so I'm not even sure how to look it up. I recall it being Michelle, but my spelling is not good enough that I'd want to make a strong statement.

    (In short, you could be right, but I'm sticking to my story)

  • (cs) in reply to rbriem
    rbriem:
    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 ...

    Good points both :)

    I also agree with Mr Former-president that gender/sex/whatever really doesn't matter much on fora these days. It's just amusing that there are still bastions of IT that are still male-dominated cultures. Kinda like the usenet of old - where you had to have a male-sounding handle or suffer constant harassment <snif> ;)

    Luckily that no longer happens.

    rbriem:
    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 ...)

    Given I do it myself...

  • (cs) in reply to januarys
    januarys:

    But look, other times you are so nasty to everyone who decided to speak his or her mind, you confuse me to bits.  Would it kill you to respond kindly?? Or at least try to squelch the deep desire to know more than others and criticize even a compliment? Am I alone in this?



    My apologies if my post came across as criticism - that wasn't intended at all. To make this all a bit soppy - I'm happy that you're happy that women are posting too - so am I. :)

    However I still find it funny that most people assume that the InterWeb is all guys... I even did it myself with your post and trust me I was pretty amused by that particular irony. Yes I know... small minds.
  • WEB (unregistered) in reply to Jeff S

    Well said [Y]

  • Mats (unregistered) in reply to DZ-Jay

    >Idunno... implementing short-circuit boolean evaluation as an unintuitive "AndAlso" seems pretty idiotic to me.<

    Oh yes, compared to the fully intuitive && - can't beat lucidity like that!

    /Mats

  • (cs) in reply to Jeff S

    Jeff S:
    Vector:
    Anonymous:
    Gotta love a language that has "AndAlso" operator...

    Cheers, Mike5


    That's the first time you'll hear this athiest say Amen.


    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.

    Actually,  I'm  surprised they didn't name the operator something like
    "BitwiseAndWithShortCircuiting" <grin>

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

    Dim thisControl As Control = FindControl(controlName)
    If Not thisControl Is Nothing AndAlso TypeOf (thisControl) Is ICheckBoxControl Then
      CType(thisControl, System.Web.UI.ICheckBoxControl).Checked = True
    End If

    IMHO, the above code is also a WTF.  The type of the control is being checked twice.  The below C# is the best way of doing the above logic.

    ICheckBoxControl c = FindControl(controlName) as ICheckBoxControl;
    if (c != null) c.Checked = true;

    Not having used VB.Net, I'm not sure if it has an equivalent to the 'as' operator, but it doesn't, its a crime against .Net.

    or,

    if ((ICheckBoxControl c = FindControl(controlName) as ICheckBoxControl) != null)
             c.Checked = true;

     

  • (cs) in reply to KeithSpook
    Anonymous:
    Jeff S:
    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).



    Two of the most moronic, ignorant posts I've ever seen here ... which is actually quite an impressive achievement at this site.

    I hope at least one of these is sarcasm.


    Yes, I would say that mine is sarcasm.  I would think that most people would have caught that.  Sorry I over estimated... I'll never do it again.

    You are a wanker....

    oh yeah, and I am being sarcastic.

  • Jon (unregistered) in reply to Alex Papadimoulis

    Would this:
    Dim thisControl As Control = FindControl(controlName)
    If Not thisControl Is Nothing AndAlso TypeOf (thisControl) Is ICheckBoxControl Then
    CType(thisControl, System.Web.UI.ICheckBoxControl).Checked = True
    End If

    be slightly simpler as:

    Dim thisControl As Control = FindControl(controlName)
    If TypeOf (thisControl) Is ICheckBoxControl Then
              CType(thisControl, System.Web.UI.ICheckBoxControl).Checked = True
    End If

    Or does TypeOf(Nothing) generate an exception?


  • .NET Programmer (unregistered) in reply to OneFactor
    OneFactor:
    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#

    Eh .NET uses the same foundation, CLR, compiler etc. - did you notice option strict at the top of C# code.

  • (cs) in reply to zip
    zip:
    The name is derived from a sausage-like appendage that women lack.

    Have you been touched by His noodly appendage?

  • someone (unregistered)

    how about:

    VB.NET: Option Explicit On Option Strict On Option Infer On

    Dim thisControl = TryCast(FindControl(controlName), ICheckBoxControl) If thisControl IsNot Nothing Then thisControl.IsChecked = True End If

    TryCast === as

    C#

    var thisControl = FindControl(controlName) as ICheckBoxControl; if (thisControl != null) { thisControl.IsChecked = true; }

    I agree, the VB syntax is a bit verbose, but the language is actually mostly on a par with C# (comparing VB 11 with C# 5).

    I was once part of an OSS project which implemented a C# <-> VB.NET code converter and no, a (completed) VB.NET to C# converter takes more effort than 30 mins... just saying...

  • Douglastab (unregistered)

    acheter mГ©dicament en ligne sans ordonnance https://kamagraenligne.com/# pharmacies en ligne certifiГ©es

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

Log In or post as a guest

Replying to comment #:

« Return to Article