Ohohohoh, sorry I keep laughing and can’t stop. Tonite I want to make fun of “functional programming” people. Let me state that clearly: they live in another world. Helloooo?! It’s 2010, the second half. Please don’t advocate anything for that. You would just waste your time. Beside I do know something about functional programming and its philosophy, I truly hate it! It’s just pointless and a straight way to spaghetti code (another funny topic I’ll start blogging about soon).
A few months ago I had to study a programming language that is a failure itself (besides it’s the best of them, probably the most modern one): OCaml. There is some coolness in it, but it’s still a functional programming language, so it really sucks nowadays, and don’t tell me the fairytale about automatic unit testing and crap like that, it’s just bullshit (sorry for being so rude).
So, why am I talking about all this? Simple, when I code using Python or C/C++, I take advantage of the fact that I can pass pointers to functions across functions themselves (as arguments). Well, every time I do that, I end up with an odd feeling: is my code readable? Is my code getting closer to spaghetti style? Unfortunately yes. Being able to pass functions across stack frames is cool and very handy at a first sight, but you’re going to pay the consequences in the long run, because your code will become harder to read and to maintain.
So please, use the mantra in subject with caution, in an event-driven model, passing callbacks over is good and generally accepted, any other use of it, in non-functional programming, is just very bad.
My today’s coding quality pill ends here. More will come about that. As you may have seen, I don’t want (for now) to get too much technical, I leave the exercise to you.