Page 1 of 1

Vector Oriented Programming

Posted: Tue Apr 04, 2006 8:50 pm
by Einherjar
Τυχαία έπεσα πάνω σε αυτό το νέο paradigm in software development και είπα να σας παραθέσω το πιο αντιπροσωπευτικό παράδειγμα :)
Για όσους δε το καταλάβατε... κάνω πλάκα. Κάποιος άλλος όμως δεν έκανε :shock:
It's not too often that we have the opportunity to unveil the next paradigm in software development: Vector Oriented Programming (or, VOP). In addition to sounding cooler than OOP, VOP offers all the benefits of OOP and a healthy heap of flexibility. Take, for example, this method uncovered in an order entry system used within a mid-western shipping company ...

Code: Select all

    /**
     * Returns an Order vector or a vector of Order vectors, based on one 
     * or more parameter values. If there was an error retreiving the
     * Order, then a standard Error vector is returned. (see docs)
     *
     * @param  getOrSet        indicates what action to take. can be:
     *                         "get", "set", "close", "find"
     * @param  orderNumber     number of the order
     * @param  orderId         id of the order
     * @param  customerNumber  number of the customer
     * @return                 vector of 18 elements or a vector of vectors
     *                         or an error vector
     */
      public Vector getSetOrder(String getOrSet, String orderNumber, 
                                String orderId, String customerNumber)
      {
        ...
      }
All it takes is a quick trip to the documentation to see what the vectors will contain ...

Order Vector

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

And sure, you may need to constantly pepper your code with things like, "poNumber = ((orderVector[4]=="shipped")?orderVector[6 ]:orderVector[5 ])", but you see, that's the beauty of it. Pepper makes everything taste better.
Αυτά και άλλα τέτοια διασκεδαστικά, πλην όμως αληθινά στο http://thedailywtf.com/

Posted: Tue Apr 04, 2006 9:55 pm
by Argi
:shock: :shock:
Απλά απαίσιο, σε πιάνει ναυτία που το διαβάζεις!

Το όλα σε ένα μου άρεσε:
indicates what action to take. can be: "get", "set", "close", "find"
και αντίστοιχα έχεις και το return :-D

BTW, το άτομο που το πόσταρε φαίνεται Έλληνας από το όνομα.
lol όχι βέβαια ότι είναι δικός του κώδικας...

Επίσης, Payback rules!!!

Posted: Tue Apr 04, 2006 10:28 pm
by Einherjar
payback is hell θα έλεγα! :)