2017-01-18 09:23 oldhand [permalink]
Am I becoming an 'old hand'? Every time I see someone that doesn't have done as many years of work in Pascal, ask something about generics, I'm troubled again by this generics thing. I don't use it (much). I don't need it. I've been perfectly fine all of this work without them. Yes there is some hype nowadays about functional programming, but there's a grand glacial movement at the base of it: stong type systems. It all started even on the big metal, where some bright minds had the sense of taking writing logic into a domain of itself with a gentle nod to mathematics, statistics and other adjacent domains. And a lot of great work was done in this domain. A lot. Some great names that now stand on their own came forth.
A recurring theme throughout of it is type systems, or the lack thereof. Or having it bolted on at a later stage. So by the time K&R came along, they took what they needed, what they could make work for them, what they needed to summon the Unix spirit from the depths. Pascal existed at the time, but C, like JavaScript much later, was born out of necessity. Created by the people there and then that needed a new wrench to tighten the new bolts of a new machine. With personal selections here and there, and careful considerations that copy a bit of the zeitgeist of the time.
What's left for us to do is try not to repeat ourselves too much. One way is keep a look-out for patterns and in new projects, know when to apply which one. Or even better, when to switch to another one. This, I think, is where it's starting to get really tough for the younger generation. There's a lot of base-knowledge to cover, some of it is superceded or obsolete, but we can't replace it with studying patterns. I've seen newbies take it on as law, as if it's forbidden to deviate from the design even just a little. Attacking establishments on the base of their deviations from a pattern. There's something to say about attacking the establishment, but blind fury will get you nowhere.
So this generics thing... It also is in danger of being percieved as a rule, getting over-applied. As if the one true way is using it everywhere or as often as possible. Which is strange from where I stand, since I still see it as a convenience, where you can save on writing bits of code that would otherwise be painfully similar anyway. In operation the work would get handled by this extension to the type system, checking things for you in the background, making sure everything fits. But in the end the things that need to happen, occur much in the same way as if you would have written all those specialisations out in full.
That's why, as it turns out, I don't use them all that much. Perhaps it's also because of my fading belief in the object-oriented way. That too was presented some years ago as the way to go. Everything was supposed to be objects living on the internet. But it too kind of degraded in my view to a convenience, only one of the ways to manage the things inside of your program. Luckily before any of the ORM craze could tinge me. It makes you look around the horizon, in the past where you did more with arrays and pointers, and sideways where others pass messages around all the time. For now I feel like I'm stuck here, waiting for the ground to crack open and offer a new middle ground between interfaces, pointers, traits, channels, monads, and all of the above.
But that's just my humble opinion. I can't tell for sure what the next 60 years of programming machines will bring us.