Lazy Object Orientation
Touched off by a post by Chris Hanson:
Collections are quite widely used in a lot of the code I see posted to the Cocoa-dev mailing list and elsewhere. Unfortunately, many times they’re not used to represent collections of objects but rather to represent objects themselves.
If I may speculate a little about why this is, it’s that perhaps a lot of programmers are coming from the Ruby/Python/PHP/JavaScript web development world, in which an object is usually an XML document or a database row, and interacting with your data model is defined in terms of xmldocument.getElementsByTagName() or db_row[’colname’]. It’s lazy object oriented programming, a style in which objects are constantly instantiated and called, but only either a) language or framework objects or b) utility objects representing really base primitives like a database or the filesystem.
It’s not that there aren’t real O/R mapping toolkits out there for these technologies (RoR’s ActiveRecord comes to mind, and, well, I haven’t seen any for JavaScript over XMLHttpRequest yet), it’s just that everything in the web developer world seems to be done in the name of fast, fast, fast. Your competitor(s) are copying your features relentlessly and the drive to innovate trumps pretty much everything else. “Modeling” is in some cases viewed as a sugar coating over the bare metal of the AJAX response or the database row, one which will also need to be maintained in a rapidly-changing environment. And everything’s gotta be serialized into some form for transmission to a client using an unknown technology (probably XML), so what’s the point of having classes in between?
So, I don’t fault the programmers who code like this — this is perhaps the world with which they’re the most familiar. And, outside Mac OS X, the tools just aren’t as good for writing well-factored code both easily and quickly. And once a habit is learned, well…
About this entry
You’re currently reading “ Lazy Object Orientation ,” an entry on stuffonfire.com
- Published:
- 12.24.06 / 4am
- Category:
- Programming
10 Comments
Jump to comment form | comments rss [?] | trackback uri [?]