6.03.2011

C Advantages over C++

It's interesting how many actual advantages C has over C++. Of course, both are equal when rating in accordance to their respective domain, but C is in general more "upwards" compatible than C cause it's one level lower. My "beloved" (I'd textually vomit here if I only could) lecturer can't deny that a completely inlined C++ wrapper for a OOP-ish C API is as efficient as it's native C++ counterpart. Thiscall on a side, most work of program isn't done through the this pointer but rather on an alghorithmic level. Compilers can surely optimize on their own to detect any widely used symbols. Imagine a function that's only used to get some parameters from an object and works on completely unrelated things later. No this pointer necessary, it's register could be used more efficiently for internal use or even completely rearranged when inlining. Even if one DOES actually need a highly responsive this/self parameter, there's still the possibility to flag it is a register...

Whatever, using C gives me the ability to code in C++ too, using a simple wrapper. I like the idea the feed both ways to program cause not everyone is used to classic procedural programming. All in all, good designs in C and C++ are most of the time as equal as efficient. So if a lecturer or student wants my codebase to also be OOP - well, wrapping is not much a work for me... Unbelievable that there's such a huge difference between both approaches. I mean I guess wouldn't have turned into a C-only programmer if OOP wouldn't be so stupid in C++ or other OOP languages. I have the feeling that designers of OOP languages are either ones that learned OOP as their first language or just some lame procedural programmers who couldn't bear the shame of writing spaghetti code. Or just some guys who want to force others using their designs. Yep, that could be. Whatever.

I guess my struggles with OOP implementations and designs can be read in large quantity in this blog... We all should take a deep breath and try to "code in harmony" instead of bashing ourselfs. Or maybe that war does only exist in my and my lecturer's head... Some students I know do even feel a bit "useless" if it's about those non-highlevel details and programmings. The whole holy war of OOP might be a problem limited to a few expression-heavy people like me or my lecturers! So if this bitch wouldn't exist, I would of course not choose the hardliner path. She loves forcing all people around her using OOP. I'm currently using the "backdoor" and code my project with another group doing Qt and C++ instead of Java and JSP. Seriously, nobody needs those millions of web frameworks. I don't say we don't need them in general, but there are more frameworks and web programmers than anything else a level below. Somehow stupid. The higher abstraction and lower do-it-yourself goes, the more weirdos and lunatics come in claying the throne of information technology for themselfs. The fact that there's even hardware able to execute Java bytecode it realtime makes it even more scary...

One day, I say you... one day I'll put a complete alternative to OOP programming that's more efficient, more minimal, more generic and way more flexible than any OOP incarnation - all at once! However, this will take some time and it's good to know that I'll probably live atleast 20 years more. After that... yeah, I should've archieve something by that time. But since I'm currently writing all the stuff in C I couldn't write before in C++, it has already started. And then - one day - my language will be ready and loaded for maximum carnage.

No comments: