3 ms·
It would probably be instructive to consider what it would mean if you extend this out further. If we have a function that also ships it out on a socket, are we
by jerf 14y ago
It would probably be instructive to consider what it would mean if you extend this out further. If we have a function that also ships it out on a socket, are we going to get
send_router_message_header_as_xml_string(...)?
If it also does error handling of some sort, are we going to embed that in the name?
My point is still ultimately the same as others here, but I'm trying to demonstrate it from the other direction. It isn't that the long function name is OK, it is that it is poorly decomposed into tasks. But digging another "why" back, the root cause for that is what you say later, that it "increases the overall complexity of the bookkeeping" etc., and the reason for that is that C isn't really that good a language for abstraction. After 40 years of experience with it we've managed to create some best practices that carry it far further than anyone could have imagined at the beginning, but when it gets down to it, when you have a language that doesn't abstract very well, you do eventually end up paying the price in functions like that. It probably is the right answer in C, no sarcasm, but that's not the same thing as saying it's the right answer in a more general sense.
(And to be more concrete, C has poor facilities for composing abstractions together without complication and loss. On a feature-by-feature basis you can make it do pretty much anything you want, Turing Complete etc etc, which makes it hard to see in blog-post-sized examples, but they don't wire together very well.)
- jacquesm 14y agoWhat surprises me more is that given that it is 40 years old how well it holds up. Sure there are other languages that deal with namespaces better. But none of them is without warts and the trade-offs involved make C in spite of its age a pretty good contender for systems level stuff.
- jerf 14y agoTo be clear, I agree entirely. It is a credit that it has lasted this long. But I do think that we are well into a time where C should no longer be your default answer, but rather something you get backed into because there is no other valid choice. (Which still certainly happens.)