The Caffeinated Penguin

musings of a crackpot hacker

The problem with pushing object oriented design

Posted By on March 7, 2005

Now, I realize that object oriented design can be quite useful, specifically in regard to things like abstraction and polymorphism. However, where it starts to get really stupid is when you have an object Foo and an Object Bar. Both Foo and Bar declare a function Baz. Now, if you want to make Baz in both of them, but that they do different things (such as the typical “new”), that's fine. Heck, if you wanted to make an implementation of something like WriteLog() which logs info about the object, that's cool too, because it belongs to that object. But, when you do something like Baz, and Baz prints “Hello World”, and Baz ALWAYS prints Hello World, and Baz is just copied and pasted from one to the other, then why not just put that in a library, or, for something simpler, just toss the declarations into a header file, and have a source file do the implementation, and build that into your project? Oh, I'll tell you why – because “Object Oriented” is a marketing buzzword, and it's gotten to the point where it's enforced by the damned development environment. The only way around it is to make a Globals class, which is declared as a Static Globals class, and then you call Globals.Baz() from inside Foo and Bar. Does this work? Yes. Does anyone do this? Not usually. Most folks just copy and paste the function.

And then your code becomes an unmaintainable mess.

Square peg, round hole wonderfulness.

Call me old fashioned, but C# really seems like two steps foreward, one step back. Sure, you get nice things like garbage collection and that type of stuff, but you lose a lot of the niceties of old C (like the aforementioned inclusion thing). I hate to say it, but it looks like C++ and/or Objective C were probably the best way of doing things. Toss in some really good bindings and libraries (GUI toolkits, XML parsers, etc.) and I think you've got it made.

Of course, this means that Apple (Objective C and piles of libraries) is one up on Microsoft (C# and .Net). Big surprise there.

Plus, the more I get into this .NET stuff, the more it becomes obvious that this is just a “Me Too” product. Let's see, where else have a seen an object oriented language and robust framework with lots of (some would say too much) shit in it. Oh yeah, here,

I should go exercise. Stay tuned for further rants on the state of development tools under Windows later tonight.


Comments

Loading Facebook Comments ...

Leave a Reply

Please note: Comment moderation is currently enabled so there will be a delay between when you post your comment and when it shows up. Patience is a virtue; there is no need to re-submit your comment.