- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
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.
Admin
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.
Admin
Forum software 1, Forum owner 0.
Admin
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. :)
Admin
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?
Admin
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.
Admin
remove the Something = from the start of that bit, oops :)
Admin
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?
Admin
English Grammar, the VB way:
BeginSentence
You know
Pause
I think you may be on to something there
EmphasizeSentence
EndSentence
Admin
"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 ...
Admin
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.
Admin
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.
Admin
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.Admin
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.
Admin
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.
Admin
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...
Admin
... of course it would be much better if I would have actually included a quote from the original post... so, basically...
Never mind.
Admin
Personally, I would have replaced it with:
Control c = FindControl(controlName);
if (c != null && c is CheckBox)
(c as CheckBox).Checked = true;
Admin
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?
Admin
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).
Admin
Are you on crack? What should we write web apps in? HTML?
Admin
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.
Admin
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.
Admin
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>
Admin
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.
Admin
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#
Admin
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#.
Admin
Even if it is FileNotFound?
Admin
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)
Admin
Admin
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 ...)
Admin
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?
Admin
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!
Admin
'AndAlso'... really? wtf is wrong with '&&' ?
Admin
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
Admin
VB's "And" and "Or" follow the original behavior of the BASIC language. You'll have to blame Kemeny and Kurtz for that one.
Admin
It would look ugly in a Basic program, that's what. Perl shows where that sort of thinking leads.
Admin
'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,
Admin
Actually "AndAlso" was defined in the file "BetterVB.bas"
Admin
I've always wanted to be good at parabole, but I'm not sure how to speak non assymptotically.
Admin
Who knew there were so many delicate aesthetes among programmers? But I shouldn't talk--Perl syntax annoys the piss out of me.
Admin
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.
Admin
It's comments like this that keep us away.
Admin
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.
Admin
No
Admin
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
Admin
Why do you quote a 6 years old article which apply to VB6, and not VB.NET ?
Admin
So I suppose you think that && is more intuitive at first glance, huh?
Admin
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?
Admin
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.