- 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
Rule of 3: If you have to code it more than twice, refactor it into a generic or abstract process.
Looks like these developers are going by the rule of 300.
THIS [code] IS MADNESS!
Admin
Madness? THIS-- IS-- ACCESS!
Admin
I think that:
But on the other hand:
What I don't get is:
Or maybe the article isn't finished yet?
Admin
This is a perfectly cromulent way to avoid buffer overflow attacks!
Admin
Yes and I agree. Because of this. agree?
Admin
WOW! Although the it is a long time since I have done anything in either Access or BASIC (in any of it's incarnations) this is over the top, I can hardly see what is happening except the horrible triple loop wherein the database is queried IN EACH INNER LOOP!!!! It looks as a to me something like this (pseudocode)
for () { for () { for() { connect_to_database(); query_database(with_newly_created_sql_each_time); disconnect_form_database() } } }
And they wonder why it is slow????
Someone please tell me I'm wrong and that VB (or whatever) can handle parameterized queries run multiple times with diferent input!!!
Yours Yazeran
Plan: To go to Mars one day with a hammer.
Admin
It's even worse, there is also the possible SQL-injection to make life interesting (hopefully this wasn't on a web server....)
Yours Yazeran
Plan: To go to Mars one day with a hammer.
Admin
Yeah, this article is obviously missing some chunks. Guess I'll check in tomorrow and see if it's been fixed.
Admin
The best WTF is even missed for non-dutch (belgium actually by the look of the tags) readers..
The only comment in the whole code is: 'dit lijkt me duidelijk translated: 'this seems obvious to me
Admin
Your server obviously isn't fast enough :)
Admin
A hardcoded XML array would be the perfect solution for this.
Admin
Nah, it's perfectly valid dutch, there's 2.5 times more dutch than flemish speakers, and the submitter's name is obviously dutch... No reason to conclude it's belgian code (nor to rule it out completely).
Given that Belgium will soon stop existing (government fell 200days ago and nobody noticed yet), it might become a valid piece of history it it were belgian though.
Admin
Yes, of course VB can run parameterized queries. You pass it any number of parameters, and it can take appropriate action. There isn't any overloading or inheritance or anything like that in VBA (not really, although the newer versions offer class modules).
No, this mess is not a function of VB being a bad language. It is a result of programmers (and I use that word loosely) who don't know what they're doing.
Captcha: conventio
Admin
Our arrays will block out the sun!
Admin
I also don't really see any Flemish characteristics, but then again, I'm far from an expert when it comes to Flemish.
Anyway, another Dutch WTF, we're not doing well :(
Admin
Indeed.
Admin
the real WTF is someone using access and VB
Admin
The real WTF is that someone is using VB.
Alex, I'd like to buy VB some braces! "{}"
Admin
Have you given any thought to how long it takes the Access runtime to convert all that Dutch to English?
Admin
God, help marinus!
Admin
Then we shall code in the basement...
Admin
Yuck. I hate braces. Not to start a language war, but VB is a fine language to program in if you're not an idiot. It's simple to get started in, therefore idiots can write "code" in VB.
And I hate braces.
Admin
In the short time I've spent developing database applications, I've come up with a handy rule of thumb:
If you're using Access, you're doing something wrong.
Admin
It allows people who don't understand nerdy stuff like 1NF to develop databases quickly. What could possibly go wrong?
Admin
Is that first paragraph a reference to the Matrix, or has my mind been too warped by those movies?
CAPTCHA: odio. Yo también odio los WTF (QP in Spanish :P)
Admin
Arrgh! I just wrote a huge comment on this and the flipping forum software and IE combined to obliterate it!! I'll try to summarise:
While True ... Wend used with On Error GoTo label as a termination condition? And no error checking when it skips out to the label? Gah!
Access: it's not a WTF people. It's a bad choice compared to most of the options that companies with a proper IT department can get hold of, but not every company has a proper IT department. It happens to be the best option that most places have for data apps (and is so much better than storing data in Spreadsheets). Plus, if it's used by a competent developer Access / VBA is actually a decent development environment for small, limited user data applications. There are much worse db WTFs (Paradox, for example ;^) )
And finally - whoever mentioned the nested loops and SQL statements: yes, it's there; no it's not elegant; but since each iteration fires off a single SQL statement which updates, inserts or deletes a single, 4 field record, it's unlikely to be a major performance hit... and compared to the rest of this code...
Admin
How VB can be this (http://www.tiobe.com/tpci.htm) popular, is beyond me. In this case though, I hardly think the tools are to blame, as idiots exist in every language.
Admin
The WTF begins with "access" and "database" in the same sentence.
Admin
I didn't think too much of braces when I was in C++ 101, but they are cleaner than the equivalent VB key words, which sometimes seem to fill up the page with letters, all jostling and crowding each other.
Admin
scheisse!!!!!!
Admin
If you need a tool to deliver a report(s) to users that utilize headers and footers Access is an acceptable solution. I know Reporting Services is out there, but for a long time it wasn't and Crystal is amazingly expensive when you can do it for free using Access.
Second, when creating Access apps, code all your connections using ADO. It's more time consuming, but pays off in reliability (no relinking), and easier to trouble shoot(runs all code through debugger).
Access tables should only be used to display data in bound forms. Data Access pages are cool, but for a lot of the Access work I have done I needed to loop record sets in business logic and then display the results. Hence, the display tables and bound forms.
Admin
i think article poorly wrote in long ever
Admin
Oh my god, it's full of FAIL!
Admin
There is no such thing as an "Access Programmer". Any one who programs in Access is a wanker who will ultimately drive your business into bankruptcy with their hideous software creation.
Admin
Admin
Finally, someone who has an informed opinion regarding Access. I must thank you friend for at least providing some supporting evidence rather than the typical "@CCE55 5UX! HAHAHAHA" or "You 'fo rizzle? @ccE55 Rox!" I'd totally agree with ADODB, it's much more stable. Binding the data directly on the form I'd agree has a really good benefit of simplicity of code, but my experience has been that the unbound style allows a much faster loading of the form if you do the binding on load.
Even ignoring the way he did some of the code, the naming conventions and not declaring data types early make this look a whole lot more confusing than it needs to be. To other people, I say don't throw away an entire language just because someone doesn't know how to code. Instead, try it on your work projects, realize that it sucks, and bring back a convincing argument as to why it sucks as bad as it does, otherwise I will ignore you. Sorry for the rant, but Access really needs to be given more of a fair shake than it's getting.
Admin
Or you're just not fortunate enough to work in an environment that supports anything else. I have to use VBA because my company won't allow anything else. And when you're building tools to distribute around the company, the only common platform is Office (security policy executables that aren't vetted by Corporate - read: you can't build executables).
Now, I will agree that Access is by far not the best database out there, but sometimes it's all we have.
Admin
You know, I was going to say a lot of things.
But then, looking at the code, it seems likely this is VB6, and the things I was going to talk about (ie, the most sensible way to talk to an SQL server, etc) are all really .NET.
And "call"?
Christ, maybe this is VB5, in which case I'm prepared to overlook a multitude of apparent sins, since that's basically stone knives and bearskins territory.
Admin
You missed some comments:
Obviously, the person who wrote this code did not consider this obvious...
Best, Hugo
Admin
What the Schnitzel?
For a moment there I thought this is German in the code. Seems though I missed the real point of origin by a single border crossing somewhere in the plains of north-west Germany.
captcha: genitus ... hm, sounds latin
Admin
I can't read that.
Admin
One can make a career out of converting Access databases to real applications..
Admin
We have three developers working on it full-time.
I used my senior developer privilege to opt out. I enjoy having a will to live.
Admin
Huh? You don't need any more "key words" than C# has. Just use If, Then, Else, and End If to mark things. Just like C#, but without the braces.
Admin
"You don't need any more 'key words' ... "
OK, sure ...
"Just use If, Then, Else, and End If"
"Then"? "End If"? Hmmm.
Admin
At least they didn't use "On Error Resume" so they can catch, and display the error.....er....nevermind.
Admin
Easy, quick way to tell a good programmer from a bad programmer (handy if you are interviewing):
Show the programmer poorly written code in VB6 or Access. Ask their honest opinion. If their response is "Of course this code is bad, VB/Access sucks!", then they are an ignorant, inexperienced, "blind sheep" programmer who will constantly blame tools and other things for their own shortcomings, and will never take responsibility for their own work.
If their response is "this CODE is really poorly written, it can be done better", then they know how to think independently, take ownership for their work and responsibility for what they do, and they will leverage whatever tools available to get the job done as well as possible.
We've covered this many times here before, kids, but let's all repeat it again: it ain't the tool, it's the programmer.
And, once again, for those who mindlessly repeat "the real WTF is using Access", then I ask you this: Are YOU, as a "talented programmer", capable of writing good, clear, clean code in Access, or would you fail miserably? If you answer "no", then you either are a really poor programmer or you don't have a clue how to use Access.
Admin
That company sounds like the real WTF. Get out while you can!!! :)
Admin
In Soviet Russia, Access uses YOU.
I mean, Access? HA HA HA HA HA HA HA HA HA HA HA HA HA.
Admin
And don't get me started on the "ElseIf" keyword...