- 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
s/static typing/explicit typing/g thank you very much.
Likewise, s/loose typed/dynamically typed/g, most langages getting popular right now are strongly typed, either dynamically implicitly or statically implicitely with typehints (type inference)
Admin
"how to create objects flexibly using Builder patterns. A chapter on collections (including iterators) "
_snip_
"this title bears reading for any technical lead or advanced VB developer interested in software patterns and some leading-edge object-oriented design."
Leading-edge object oriented design.
_gulp_
Admin
Well hmm. Actual usage of these terms is as follows:
strong/static/explicit typing = 'sort of like Java or C# or something'
weak/dynamic/implicit typing = 'sort of like Perl or Ruby or something'
Admin
Ooh, it's my first brush with the fabled WTF forum software! Exciting!
Admin
My question to all fellow "commenters" is "What if paula got this code to manage"......
Gawd.... [screams and runs.... ]
Consequences of unimaginable multitude possibiliries are obfuscating his mentation. Apocalypse is near! *-)
Admin
<font style="font-family: verdana;" size="1">Hi All,
Normally I just read this forum and am slightly amused by the perversion displayed here but when I saw the two posts by MVP I was completely thrown of my game and had to reply.
Guess what this program prints?
</font>
<font style="font-family: verdana;" size="1">final Vector ridiculousStatement = new Vector();</font>
<font style="font-family: verdana;" size="1">ridiculousStatement.add("shipped"); //$NON-NLS-1$</font>
<font style="font-family: verdana;" size="1">System.out.println(ridiculousStatement.get(0).equals("shipped") //$NON-NLS-1$</font>
<font style="font-family: verdana;" size="1"> ? "Statement is rubbish" //$NON-NLS-1$</font>
<font style="font-family: verdana;" size="1"> : "WTF!!! Everything I know about OO was just thrown out the window!"); //$NON-NLS-1$</font>
<font style="font-family: verdana;" size="1">
Cheers, Kokki
Don’t believe everything you see.</font>
Admin
Sorry, Din't quite know how to use the forum software here again and please MVP test your code before posting.
Normally I just read this forum and am slightly amused by the perversion displayed here but when I saw the two posts by MVP I was completely thrown of my game and had to reply.
Guess what this program prints?
<font style="font-family: courier new;" size="1"> final Vector ridiculousStatement = new Vector();
ridiculousStatement.add("shipped"); //$NON-NLS-1$
System.out
.println(ridiculousStatement.get(0).equals("shipped") //$NON-NLS-1$
? "Statement is rubbish" //$NON-NLS-1$
: "WTF!!! Everything I know about OO was just thrown out the window!"); //$NON-NLS-1$</font>
Cheers, Kokki
Don’t believe everything you see.
Admin
Delphi does/did have it until at least v6, and very useful it is too.
(hope this forum software works)
Admin
Static typing has a very clear definition, and it doesn't expand to 3 type qualifications.
And calling Ruby weakly typed is misinformation too.
Admin
It should return a Vector alright, or List or some other Collection, but of class objects, not strings.
A class with private members for each data item and then public getter and setter methods on those items. Pure, simple OOP, like everyone has been taught. There might be one item in the collection or thousands, it doesn't matter.
Then have this class throw a user generated exception type. There are very few reasons to return an error inside a parameter in Java. Also it didn't go into this, but how do you know if the vector is a data vector or an error vector? A string search on an element maybe?
This code reeks of someone trying to port it from a procedural language and doing a half-ass job by not bothering to implement coding standards for Java.
Well, at least they didn't try to use a multidimensional array.
Admin
Does that mean that you'd eventually get a stack overflow? [:)]
Admin
Actually, it's Windows that has a Variant data type. It's needed for all communication through COM (ActiveX, or whatever they call it this year).
And yes, Delphi has it, of course, in all its incarnations (1-2006).
And no, it (Variants, that is) is not a 'monstrosity'.
Admin
Yep, generics should handle this one. Unfortunately, I don't (officially) know about them yet - this particular university course, at least, hasn't caught onto the idea.
Besides, this particular software doesn't seem to use generics - in fact, if they're putting anything other than strings in there, they wouldn't work anyway. (Of course, it could be that not only are they not storing anything but strings in the vectors, but the person who programmed it didn't know how to put, say, an integer into a list).
Well, obviously. (I'm guessing that they tell whether it's a data vector or an error vector by the type of the first element. Whether that would be a string, an Exception (ugh), or what, I don't know. Of course, they could just have a "class ErrorVector extends Vector"...)
Admin
Gah - I didn't notice that until now - the offset of some of the items in the list varies depending on what the other items are set to - WhyTF?
Heh, obviously the goggles do something after all...
Admin
The WTF reminded me about one of my PHP based project, which has some legacy code from php3 times. Here's a snapshot:
$table_ret[0][$key][$relation_target] = $relation_cache[$relation][$value[$relation_key]][$relation_target];
- Garo
Admin
Actually, this just looks like someone has reinvented "best practices" of about 1975.
I've seen code exactly like this, in old FORTRAN numerical jobs---everything is stored in one giant array named WORK.
Why someone felt compelled to come up with a way to implement COMMON blocks in a modern language is beyond me, but it's sort of neat, I guess.
Admin
<FONT face=Garamond color=#000080>============</FONT>
<FONT face=Garamond color=#000080>...object DoEverythingConceivable(string whatToDo, object whatToDoItWith)</FONT>
<FONT face=Garamond color=#000080>...MyEbay = DoEverythingConceivable('hell','in a handbasket')</FONT>
<FONT face=Garamond color=#000080>============</FONT>
<FONT face=Garamond color=#000080>I just need to know one thing. [;)] </FONT>
<FONT face=Garamond color=#000080>[co][sn]</FONT>
<FONT face=Garamond color=#000080>Should I wrap this DoEverythingConceivable object in my (enterprisey) web form using a form button and "http post"? </FONT>
<FONT face=Garamond color=#000080>[I]</FONT>
<FONT face=Garamond color=#000080>Or should I href it (gets rid of that "silly" form button thingie), use javascript for authentication and use "http get"?</FONT>
[:^)]
<FONT face=Garamond color=#000080>alert("<FONT style="BACKGROUND-COLOR: #ff1493" face=Georgia color=#000080>are you sure you want to remove 'hell' from your 'handbasket'?</FONT>");</FONT>
<FONT face=Garamond color=#000080>< runs for cover... >[li]</FONT>
Admin
Brilliant
Admin
'string' .. that's so restrictive, shouldn't we rather do:<FONT size=2> </FONT>
object DoEverythingConceivable(object whatToDo, object whatToDoItWith)
Admin
Come on man, this is the daily WTF. You're gonna have to do a lot better than that!
Admin
Anonymous wrote: | Actually, in Java you need to cast everything coming out | of a Vector
First, you shouldn't use Vector anymore since Java 1.1 or so. The Collection classes are far superior.
Second, equals() takes Object, so you don't have to cast.
Third, you should put the ternary expression inside of the get(): orderVector.get(orderVector.get(4).equals("shipped")?6:5)
Admin
I was thinking more of "Vector Pepper - so misunderstood" (and now we can see why...)
Admin
No, they just renamed it "Object".
Admin
Using a Vector here ensures that all method calls for these objects are synchronized. I'm certain that our VOP programmer was very concerned about thread safety when he opted to use Vectors instead of one of those other new-fangled collection classes like java.util.ArrayList. Plus, the AOP acronym was already taken, so "ArrayList-Oriented Programming" just wouldn't fly!
Admin
Which is obviously exactly what you want. We don't build bridges out of wet noodles. For that we use solid, dependable parts. A wet noodle bridge would fall apart as soon as someone decided to take a fork to the foundation of it. Your code is the same way. In short, don't let anyone bring a fork anywhere near your code, and quit using flexible data structures.
This message brought to you by Tdwtf Consulting, Inc.
Admin
I'm surprised nobody noticed that "11/12/02" is a WTF in itself. Is that 2011-12-02, or nov 12, 2002, or 11 Dec, 2002? And if you think you know, then do you think everyone reading the spec knows? :)
Admin
Isn't it? Let's see. You take a perfectly good statically typed language and give it a "type" that can hold any value, thus throwing all the benefits of static typing out the window. What's that, optional static typing? If you (like me) don't like to declare types, use a dynamic language and be done with it.
Admin
Really... (in principle) how is this any different from untyped data sets in .Net?
Admin
You have to be carefull and catch a possible EHellIsFreezingOver Exception...
Admin
You have to be carefull and catch a possible EHellIsFreezingOver Exception...
Admin
Tensor Oriented Programming (TOP)
Admin
"You've got clearance, Clarence..."
"Roger, Roger."
Admin
I Propose "Tensor Oriented Programming", (TOP), which should be used exclusively with next paradigm after AGILE, "Gestalt Oreinted Development" (GOD) , which when integrated, can be referred to as TOPGOD, or, if you're semi-dyslexic, TOPDOG...
Admin
Lisp lives!
Although, a better solution would involve recursively nested cons cells.
Admin
In the late 90s I worked for a small web design/hosting company. My boss either was unaware of or for some reason refused to use any ALTER TABLE statements once he created the original schema. So whenever he realized he needed to store another piece of data, he used the largest column and joined all the data on pipes.
Admin
For some database systems, especially the older (ISAM-based) ones, ALTER TABLE meant copying the whole table. That takes a lot of time and needs a lot of space, obviously.
Admin
I use SQL Server's Enterprise Manager to design schema. Whenever I make changes to a table that has a lot of data, I make sure to click "Save Change Script" instead of "Save". All too often, it needlessly generates SQL that copies the whole table, when a few simple ALTER TABLE statements will do the trick just fine.