It’s hardware’s fault that software sucks!

I had a really cool chat today with Darryl Chantry, our Architect Advisor, about procedure oriented programming (pop) and object oriented programming (oop). Daz was saying that no matter what, pop would always be faster, and I had to agree with him, even though I’m an avid oop fan.

Then it occurred to me, it’s all hardware’s fault!

See, hardware, specifically CPUs, work from instruction sets, clock cycles, and sometimes (more often than not) pipelines too. But at the end of the day, you’re talking to the computer in a series of discrete operational instructions; you know, move a into x then subtract y. You’re not saying, execute the walk method of the dog. So anything oop will always be slower, unless, it’s purely a high-level abstraction of the low level instructions. This really got me thinking, how many OO languages and compilers actually do this? How many from the point you hit build, actually take the dog object, work down through the compiler and assembler, and output pure instruction codes?

What would be even better, would be if the hardware machine language was object oriented! Wow! And then you wouldn’t need assembly language or generational languages, you could talk directly to the machine! Urghh, actually, I don’t know that I’d trust myself to do that, but it would sure be better for oop all round! Now I can’t wait for the first purely object oriented machine to arrive, with and oo machine interface and assembler, and a plug-in for VS!!! Woohoo!

Comments (2)

  1. Jay R. Wren says:

    I’m sorry but I have to disagree with you 100%.

    OOP is a methodology which is almost always 100% expandable into a POP equivalent. The perfect example is actually doing OOP with C. Yes, I said C, not C++. Linux folks have been doing this for years. This is the platform which GTK and GNOME are build upon. From a certain abstract POV Win32 is the same way. Consider all the APIs in which there is a HANDLE of some type, and all the functions(procedures!) which take this HANDLE and maybe some other arguments and do something with it. Well, in a OOP world that HANDLE would be some pointer to an object, the class would have members and be able to access all the things to which HANDLE points.

    That is a bit of a rant, but ultimately C++, and I’m sure C#, VB.NET et all, turn the OO code into a set of procedures (the member methods) and a set of data (the member fields). It really is no different. Ultimately OOP programs yield procedures which operate on data, just like POP. Ultimately it is machine langauage (even if it is JITed).

  2. Brian Stanton says:

    I agree with Jay here. Just talk to the C++ compiler folks who wrote the code optimization stuff and you’ll find out all the tricks they do to maximize the performance of OO code. Even with that you can still write really bad OO (and non-OO) code. If I could only choose between hardware and software I would say software is still the reason software sucks. I really believe it has to do with requirements/features/complexity increasing over time.