- 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
I know of a very valid reason for declaring the arguments as variants: nulls. The only way to represent a nullable value without writing your own struct of sorts is to use a variant.
Further, it was possible to create classes in VB6 which obviously would have been the preferred solution. (Although the types of the properties would have to be variants to allow for nulls). That said, creating COM classes in VB6 was its own little slice of heaven.
In VB6, that isn't even possible and in languages where it is, it is not the preferred method. It would be better to simply have properties on the class and let the code that consumes the class determine if the property values needed to perform its operation have the proper values. That said, the big problem with altering your class definitions is that you can get COM issues.
Admin
Yes; the trick in the technical interview will be ducking at the right time to avoid being stabbed in the head.
Admin
Gross, but it was the way it was ... back in the day.
It totally looks like Classic ASP.
You have to remember that the only way to remote objects was to use DCOM. You couldn't just declare objects and expect it to work all the way through all the layers. If you were really smart maybe you could get it to work, but DCOM was pretty buggy and a b*tch to get working, not to mention slow. When you add the best practice of a stateless service layer, you also need a very chunky API (as opposed to a chatty one).
The hungarian notation isn't even that much of a wtf when you are looking in the past. Annoying, but how else do you deal with a language where everything is a variant when communicating via COM.
So all things considered, the only wtf is the name of the function indicating the method will use some Xml somewhere (i.e. the caller doesn't care how the method calls the layer below, or at least shouldn't).
Admin
Admin
I'm really not seeing the inherent WTF of functions that call other functions and, you know, reuse code. That would normally be a success story.
Admin
Try reading the comments to the article if you need a hint.
Admin
What part of the strongly-typed code indicated to you that this was classic ASP?
Admin
It is much too easy for stored procedures just to call other stored procedures. First with professional Databases like postgres you can write stored procedures in different languages. Off course C would be a natural choice, but it is best complemented with perl and python.
Second (and much more important): Those other languages could call other libraries, which in call could call other libs, which could call ..., which could call ... ... a stored procedure!
pure pleasure!
Admin
Admin
and then you have to write a structure / class that simply has a lot of properties or a large constructor that has the same problem and adds more operations and maintenance headaches unnecessarily.
objects simply to pass data from one object to another with no processing are a bad idea.
the only real problem with this is that it is not strongly typed. the point is that it points to the huge amount of spaghetti and type misuse that will follow.
Admin
Who wrote this obscenity is just a minion: the blood is on the hands who wrote VB in the first place. Such a curse they cast upon humanity. We all are doomed. Praise thy ruby and thou will be saved.
Admin
I'm slightly confused as to which Ruby to praise.
Ruby - the programming langage ?
Or Ruby - the codename for the project which begat Visual Basic ?
What a beautiful day for throwing a bucket of water over a soothsayer and pointing out he didn't predict that...
Admin
FTFY.
Admin
Yeah, I read them.
I've worked on systems where rows were inserted by a stored procedure that had to do validation checks on the inserted data.
The same validation checks were also used by other public stored procedures so (guess what) the insert procedure called into subroutines, and other procedures also called those subroutines.
It's not a WTF.
Admin
Yes, you can simply declare objects and have them work all the way through the layers. DCOM was only needed to go across the network. Even then, it was easy. Just use the Component Services tool to build a proxy and install it on the next tier forward. Also, COM doesn't require everything to be a variant. Heck, COM was first implemented in C, not VB, so the whole idea of variant is not baked into COM. Finally, it's easy to build a stateless, single-trip API using DCOM and make it fast. VB even has a function (well, part of the MTS component) that tell Microsoft Transaction Server to dump the object state(SetComplete).
Also, stored procedures are neither necessary nor sufficient to protect against SQL injection. If you use stored procedures, but build the call with string concatenation, you will be just as naked against injection as someone who uses bare string concatenation. It's string concatenation you need to avoid.
Admin
A Varient is basically an XLOPER, so I guess it was sort of first implemented in assembler, not C, but the variant appeared when COM automation was built in Excel Basic.
http://www.vergentsoftware.com/blogs/ckinsman/HowToBeAProgramManagerByJoelSpolsky.aspx
Admin
O Gosh no, not that hoary old myth "more efficient to just use a pointer". I write embedded code where I count the size of the stack, and quess what: when you create the local object to pass to the remote function, it gets created on the local stack.
And WTF, when you need to add new data to the insert/update, you have to re-write the class. That is, add new data members. Well, that was a huge saving of labour, wasn't it?
Look, I'm just as much in favour of the One True Style as the next man, but let's remember: in the end what the workers got from the Marxist dielectic was jam tommorow
Admin
You're right, my bad, code should be b.f. ugly.
Addendum (2009-12-23 12:52): BTW - You would not necessarily have to re-write the class simply because the schema changed or something. It depends on what kind of schema-type information is being provided to/ discerned by the object in the first place.
I've written more than one object model that updates a data store and does not need to have the class re-written just because the schema changes and new types of information are being stored. Incidentally, you can't do that if each field is being passed as a separate argument in some fugly function.
Admin
In VB you could make it very clear: InsertXMLShipment( _ GMImportId_fk := 1000, _ nShpId := 2007, _ nShpConConsigneeId := 3, _ nShpConShipperId := 7, _
Using a simple function call, you can test the call from an Excel spreadsheet: but it's the thin end of the wedge if you let users do user requirement testing.
Admin
Admin
code like this often reflects thinking like this.... and an environment where management is incurably random, you have to codeify a process that's almost impossible to explain or understand, hence you end up with code that is almost impossible to explain or understand.... Alot of this was probably added at the last minute....
Admin
Oh, and the article specifies that this was VB6 <==> VB6 <==> VB6; ASP may have made the original call to the VB6 (COM+?) service, but everything else is VB6.
Except that to pass in a Null, you would need a type that can be set to Null -- which in VB6 means Variant. True, but the VB6 (or other COM) methods the ASP calls can certainly use any of the standard COM types, including strings and integers and doubles. But see above regarding Nulls and variants, and again... it's being called by VB6, not ASP.Admin
This looks to me like Pitney Bowes' SendSuite.
That software is nothing but a huge monstrosity of a WTF.
Admin
Gee, and people say Cobol is verbose!
Admin
Admin
Cue obligatory Yo Dawg joke.