Vector Oriented Programming

Συζητήσεις για γλώσσες προγραμματισμού και θέματα σχετικά με προγραμματισμό.
Post Reply
User avatar
Einherjar
Venus Project Founder
Venus Project Founder
Posts: 3751
Joined: Tue Jan 27, 2004 4:42 pm
Academic status: Alumnus/a
Gender:
Location: Washington DC, USA
Contact:

Vector Oriented Programming

Post by Einherjar » Tue Apr 04, 2006 8:50 pm

Τυχαία έπεσα πάνω σε αυτό το νέο 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/
[Better to understand a little than to misunderstand a lot]
User avatar
Argi
byte level
byte level
Posts: 122
Joined: Tue Nov 09, 2004 7:22 pm

Post by Argi » Tue Apr 04, 2006 9:55 pm

:shock: :shock:
Απλά απαίσιο, σε πιάνει ναυτία που το διαβάζεις!

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

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

Επίσης, Payback rules!!!
I am a nobody, and nobody is perfect; therefore I am perfect.
User avatar
Einherjar
Venus Project Founder
Venus Project Founder
Posts: 3751
Joined: Tue Jan 27, 2004 4:42 pm
Academic status: Alumnus/a
Gender:
Location: Washington DC, USA
Contact:

Post by Einherjar » Tue Apr 04, 2006 10:28 pm

payback is hell θα έλεγα! :)
[Better to understand a little than to misunderstand a lot]
Post Reply

Return to “Προγραμματισμός”