6.23.2011

stackage

The more I think about more or less completely replacing the standard C library with my own set of stuff, the more I notice how awesome the stack compared to the heap is. Seriously, it's the best temporary dump ever! A few months ago I wouldn't have been able to realize that: using C++ and it's new quite often, always allocating around, just to get a simple temporary array done. I don't know why, but I think it's simply because I was too much into that OOP stuff to realize how bad it actually is. Or did I realize it but didn't want to have it real? Well, I don't know exactly. However, I haven't thought about more clever solutions to automatic memory mangement - the stack IS such a clever solution. Simply go up and down, use a relative position and we can do anything we want. The is no real difference to the heap except that it's managed automatically - so why bother with the heap all the time? Thinking about that, I start to see even more beauty in C's core concepts and how it will be translated to assembler code. So much stuff is done on the heap today, even for the smallest, highly temporary operations! What a waste, I say you. We are NOT in Java, we are in the world of conceptually viable programming languages. Therefore, I can only distrust C++ more than before. Dynamic memory is still an operating system problem today - not if you do your own management system of course. I started to redesign my own programming language to be more sensual about that matter and think it is the best to get a bit away from my initial concept, but still having every command as a bytecode. I'll try to get a symbiose between comftable highlevel BASIC programming-like simplicity and direct stack/heap relations like from C or Assembler. Most programs out there don't even NEED any dynamic memory. But still, they use it all the time and don't think about what might happen if they drop all the shit and go classic. It's totally possible to do custom dynamic allocation: just allocate a bigger memory and manage it on your own. Of course, it's easier to just call new/malloc, cause they do exactly the same but within a greate scale of course. Memory management is WAR, totally. Like it is with CPU time and other resources. Therefore, the less you have to parcipate in such kinds of brawls, the luckier you'll go out! Simple. That said, I can now only feel joy about how simple I can design my functions, the overall interface. I like clean and efficient code and I simply guess the prejudice found around OOP programmers that C is old shit and results in spaghetti, is stupid. I on the other side know the differences and can clearly say that both have very, very different assumptions about what good program design is. Instead of saying anything bad about C, I'd rather Java programmers spaghetti coders cause if something turns out wrong cause their models are too fuzzy to be understandable, they don't get what it is and start adding more stupid frames around it. Similar to how Windows grew weirder every now and then, those guys tend to not get it.

That's the problem with OOP: you can teach them how to use it and how to design the spaghetti models, but you won't be able to teach them it's underlying system with only that knowledge. If they try to enter lower levels, they'll stumble and rather hurt themselfs instead. But well, we always need pawns to sacrifice and triumph.

No comments: