- 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
TRWTF is VB.
Now that that's out of the way... let the actual commenting begin...
Admin
A poor craftsman blames his tools.
Admin
Admin
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()
Admin
How about plain old BASIC? ...like the one I used to use on the TTY?
100 PRINT "HELLO WORLD" 200 GOTO 100
Admin
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.
Admin
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...
Admin
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.
Admin
Here's a challenge for you all then. Give a piece of code which is 'better' in C# than in VB (.NET).
Go.
Admin
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
Admin
Pretty much like Pascal, and like Pascal, in its original incarnation totally unsuitable to write real software.
Admin
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.
Admin
Only me. And you, although maybe you went and looked it up.
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?
Admin
Admin
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#.
Admin
Admin
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.
Admin
Not as much as a flood of Look, I've found a typo comments.
Admin
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.
Admin
I don't know half a brain is about right for VB, I think.
Admin
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.
Admin
Whenever I have to write in VB.NET, I feel like I'm trying to compose a cover letter with crayons.
Admin
My head just exploded, and the universe is about to as well
Admin
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#.
Admin
Ah, but VB does not have the System.Gloat namespace
Admin
+1
Admin
Admin
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.
Admin
Admin
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:
The above would compile, and if you ever accessed Foo, you'd get 0.Admin
Admin
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.
Admin
The REAL WTF is that we can't post links
Admin
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.
Admin
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?
Admin
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.
Admin
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.
Admin
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.
Admin
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.
Admin
Admin
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.
Admin
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
Admin
public IEnumerable<int> GetFibonacciSequence() { int current = 0; int next = 1; do { yield return current; int temp = current + next; current = next; next = temp; } while(true) }
Admin
This comment is too long, can you sum it up with a one liner? Preferably with lambdas?
Admin
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"?
Admin
I started reading that until I saw this:
Next!
Admin
Admin
TRWTF is that no one knows what the "B" in "VB" stands for.
Admin
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.
Admin
Obviously, I don't remember the birthday dates of my in-laws, which is arguably a more important and useful thing to remember.
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.