Vector Oriented Programming
Posted: Tue Apr 04, 2006 8:50 pm
Τυχαία έπεσα πάνω σε αυτό το νέο paradigm in software development και είπα να σας παραθέσω το πιο αντιπροσωπευτικό παράδειγμα
Για όσους δε το καταλάβατε... κάνω πλάκα. Κάποιος άλλος όμως δεν έκανε

Για όσους δε το καταλάβατε... κάνω πλάκα. Κάποιος άλλος όμως δεν έκανε

Αυτά και άλλα τέτοια διασκεδαστικά, πλην όμως αληθινά στο http://thedailywtf.com/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 ...
All it takes is a quick trip to the documentation to see what the vectors will contain ...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) { ... }
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.