• (cs) in reply to TrueLogic
    Anonymous:
    its me:

    VB 6.0 and earlier used to have (something like) this, it was called "Variant" datatype. Highly prone to runtime errors, and often a PITA to debug. The .NET platform did away with it for good reason....


    Sorry I couldn’t disagree more, this is the same logic that makes people think that a program compiling without errors is the same thing as a program working.

    <!--[if !supportEmptyParas]--> <o:p></o:p>

    Variant data types are not prone to runtime errors, sloppy programmers using variant data types are. Strong typing is a needless psychological safety net, it slows development and doesn’t really help develop functional software, it just helps create syntactically correct code.  Why to you think we are seeing an increase in the number of loose typed or untyped languages.

    <!--[if !supportEmptyParas]--> <o:p></o:p>

    VB.NET is a monolithic development tool and is often far too cumbersome for the job. VB6 on the other hand was the screwdriver of the programming toolkit, not always the right tool for the job, but sometime you just need a screwdriver.

    <!--[if !supportEmptyParas]--> <o:p></o:p>

    <span style="font-size: 12pt;" times="" new="" roman="" ;="">There is a lot of snobbery about VB, because it put programming in the hands of the amateur some people thought everybody using it had to be an amateur.


    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)

  • boicy (unregistered) in reply to Sean
    Sean:
    Anonymous:


    This book looks mega-scary.  The first line of the abstract is enough to convince me every copy should be collected and incinerated, and the authors terminated with extreme prejudice: "Suitable for any project manager or VB software professional willing to think outside the proverbial box." 


    "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_
  • Ben McKraken (unregistered) in reply to masklinn
    masklinn:
    most langages getting popular right now are strongly typed, either dynamically implicitly or statically implicitely with typehints (type inference)

    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'

  • Ben McKraken (unregistered) in reply to Ben McKraken

    Ooh, it's my first brush with the fabled WTF forum software! Exciting!

  • @tom (unregistered)

    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! *-)

  • Kokki (unregistered) in reply to MVP

    <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>

  • Kokki (unregistered) in reply to MVP
    Anonymous:
    Nope, first cast is needed.  The orderVector.get(4) call returns an Object, NOT a String.  Polymorphism doesn't apply in this case.  Java doesn't know it's a String until it is casted.  Even if that object is technically a String, not casting it will force Java to call Object's equals() method, not String's equals() method. 


    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.

  • (cs) in reply to Davor
    Anonymous:
    its me:

    VB 6.0 and earlier used to have (something like) this, it was called "Variant" datatype. Highly prone to runtime errors, and often a PITA to debug. The .NET platform did away with it for good reason....

    Delphi had that monstrosity as well.... I dont know if still does.



    Delphi does/did have it until at least v6, and very useful it is too.

    (hope this forum software works)
  • (cs) in reply to Ben McKraken
    Anonymous:
    masklinn:
    most langages getting popular right now are strongly typed, either dynamically implicitly or statically implicitely with typehints (type inference)

    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'


    Static typing has a very clear definition, and it doesn't expand to 3 type qualifications.

    And calling Ruby weakly typed is misinformation too.

  • (cs)

    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.

     

  • bcammack (unregistered) in reply to Ralph
    Anonymous:
    loneprogrammer:
    Anonymous:

    That is awesome.

    <FONT size=2>

    object DoEverythingConceivable(string whatToDo, object whatToDoItWith)

    </FONT>



    <FONT size=+0><FONT size=2>DoEverythingConceivable("go to hell", handbasket);</FONT></FONT>

    I don't think that would ever return.

    Does that mean that you'd eventually get a stack overflow? [:)]

  • Newton (unregistered) in reply to Davor
    Anonymous:
    its me:

    VB 6.0 and earlier used to have (something like) this, it was called "Variant" datatype. Highly prone to runtime errors, and often a PITA to debug. The .NET platform did away with it for good reason....

    Delphi had that monstrosity as well.... I dont know if still does.



    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'.

  • (cs) in reply to SerajewelKS
    SerajewelKS:
    Anonymous:
    Actually, in Java you need to cast everything coming out of a Vector (since Vectors store Objects).
    Uhm, yeah, where were you when they introduced generics in Java 1.5? Where were all of you? The real WTF on this site is that most of the people posting have no idea what the hell they're talking about.

    Yeah, I know, "not everybody uses Java 1.5," but nobody here has even suggested the possibility.

    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).

    CaptSalty:

    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.

    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"...)

  • (cs)
    Alex Papadimoulis:
    • Order_Number
    • Order_Id
    • Customer_Number
    • Order_Date
    • Order_Status
    • [Ship_Date] (exists only if Status is "shipped")
    • PO_Number
    • [Shipping_Code] (exists only if Status is "shipped")
    • ...
    • LastSaved_Username --or-- LastSaved_Date (past 11/12/02, it is Date)
    • [LastSaved_Username] (exists only past 11/12/02)
    • ...

    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...

  • Garo (unregistered)

    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

  • Llelldorin (unregistered) in reply to Garo

    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.

  • TomCo (unregistered) in reply to lamborghini

    <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>

    <FONT face=Garamond color=#000080></FONT> 
  • foo (unregistered)

    Brilliant

  • shadowseeker (unregistered) in reply to Ralph
    Anonymous:

    That is awesome.

    <FONT size=2>

    object DoEverythingConceivable(string whatToDo, object whatToDoItWith)

    </FONT>

     

    'string' .. that's so restrictive, shouldn't we rather do:<FONT size=2> </FONT>

    object DoEverythingConceivable(object whatToDo, object whatToDoItWith)

     

  • (cs) in reply to Garo
    Anonymous:
    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


    Come on man, this is the daily WTF.  You're gonna have to do a lot better than that!
  • heinzkunz (unregistered) in reply to MVP

    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)

  • None Of The Above (unregistered) in reply to gtllama
    Anonymous:
    Anonymous:
    So basically, we eschew all sense of strongly typed objects or even run-time binding, such as referencing an object by property name, and end up with Vector Pepper.


    Order Vector, Error Vector
    I'm a Vector, He's a Vector
    Wouldn't you like to be a Vector, too?



    I was thinking more of "Vector Pepper - so misunderstood" (and now we can see why...)
  • None Of The Above (unregistered) in reply to its me
    its me:

    VB 6.0 and earlier used to have (something like) this, it was called "Variant" datatype. Highly prone to runtime errors, and often a PITA to debug. The .NET platform did away with it for good reason....



    No, they just renamed it "Object".
  • bfhcpd0 (unregistered) in reply to heinzkunz

    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!

  • Adam (unregistered) in reply to ammoQ
    ammoQ:
    Well, at least they use Vector. Most "clever" people use hashtables to implement "flexible" objects, but using Vectors instead adds some, well, inflexibility.


    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.
  • Randal L. Schwartz (unregistered)

    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? :)

  • (cs) in reply to Newton
    Anonymous:


    And no, it (Variants, that is) is not a 'monstrosity'.



    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.
  • DoogyHowser (unregistered)

    Really... (in principle) how is this any different from untyped data sets in .Net?

  • Jeroen Vandezande (unregistered) in reply to Ralph

    You have to be carefull and catch a possible EHellIsFreezingOver Exception...

  • Jeroen Vandezande (unregistered) in reply to Ralph
    Anonymous:
    loneprogrammer:
    Anonymous:

    That is awesome.

    <font size="2"> </font>

    <font size="2">object DoEverythingConceivable(string whatToDo, object whatToDoItWith)</font>



    <font size="-0"><font size="2">DoEverythingConceivable("go to hell", handbasket);</font></font>

    I don't think that would ever return.



    You have to be carefull and catch a possible EHellIsFreezingOver Exception...
  • Charly (unregistered) in reply to Rank Amateur

    Tensor Oriented Programming (TOP)

  • (cs) in reply to ParkinT
    ParkinT:
    "What's our Vector, Victor?"


    "You've got clearance, Clarence..."

    "Roger, Roger."

  • (cs) in reply to Josh

    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...

  • jbs (unregistered)

    Lisp lives!

    Although, a better solution would involve recursively nested cons cells.

  • K (unregistered) in reply to loneprogrammer

    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.

  • (cs) in reply to K
    Anonymous:
    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.


    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.
  • (cs) in reply to ammoQ
    ammoQ:
    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.


    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.

Leave a comment on “Vector Oriented Programming”

Log In or post as a guest

Replying to comment #:

« Return to Article