[development] OOP
Sam Tresler
sam at treslerdesigns.com
Wed Feb 22 16:59:29 UTC 2012
"I don't think anyone can argue that object oriented is also equal to
bloat. I need a user's name, I load a user object from a user ID which
does a million queries or so."
No. That would be poor coding. To avoid it, I generally build a few
static methods into managers for handling simple tasks. Not sure how
Drupal does it currently, but in another fully object oriented framework
I work with it looks like:
UserManager::get_username(uid);
And runs one query. I do not, however, have a static method for
non-commonly used things, such as a user's last login time, or join date.
Object Oriented most certainly does not mean bloat. Bad code and
architecture mean bloat.
Regards,
Sam Tresler
On 02/22/2012 11:46 AM, Ashraf Amayreh wrote:
> Hold on your horses. First off, I don't think object oriented is ALL
> bad. Some things naturally map to objects like user, node, menu, etc,
> what I am talking about is trying to fit everything into objects.
>
> I don't think anyone can argue that object oriented is also equal to
> bloat. I need a user's name, I load a user object from a user ID which
> does a million queries or so. As Joe Armstrong, the inventor of Erlang
> put it:
>
> "The problem with object-oriented languages is they've got all this
> implicit environment that they carry around with them. You wanted a
> banana but what you got was a gorilla holding the banana and the entire
> jungle."
>
> When an addition application turns into two objects from the Integer
> class using the + method, and when some wise-ass architect wants you to
> objectify everything, it does get quite ridiculous. Of course not to
> mention the 10 times CPU and memory resources used to achieve it.
>
> Finally, I don't think many will disagree that when you start thinking
> about a problem and its solution, you don't start thinking objects.
>
> Would love to get the opinions, or better yet, the experience of people
> who've read others' code written functionally vs OOP. Again, we're not
> talking about small systems or lousily written ones, but large
> enterprise systems. I for one get driven crazy following classes,
> inheritance and finding that each variable is a new class somewhere
> that's an aggregate of 10 other classes that I have to understand to
> debug a simple problem. It could just be me of course :)
>
>
> --
> Ashraf Amayreh
> CEO | O-Minds
> Cell. 962 78 8099997
> Tel. 962 6 5655150
> Fax. 962 6 5675150
> Skype: aamayreh
>
> www.o-minds.com <http://www.o-minds.com>
> web development | web design
> user experience | branding design
>
> Connect with us on Twitter
> http://twitter.com/ominds
>
> Connect with us on LinkedIn
> http://www.linkedin.com/in/aamayreh
More information about the development
mailing list