5 ms·
If there's one thing we don't hear enough in the programming world, it's "all this code I didn't write sucks!" Oh wait, that's about all we ever hear. It make
by jrockway 16y ago
If there's one thing we don't hear enough in the programming world, it's "all this code I didn't write sucks!"
Oh wait, that's about all we ever hear. It makes for boring reading (and boring comments), so I'm flagging the article. When you write about how you've rewritten OpenSSL to be more flexible and featureful, I will enjoy reading about that. This? It just makes me mad.
(If you want to whine about a particular issue with a particular library, at least try to generalize it to something meaningful. The lesson here is "be careful writing a library that only one app uses and then calling it a library". A lot of C programs make this mistake; sure, they have a small app that calls libapp to do all the real work... but the functions that do the real work are things like read_config_file_and_then_handle_the_applications_foo_command, which is really unhelpful to everyone.)
Anyway... OpenBSD guy whining about code he didn't write? Big surprise. On HN, I want valuable articles that show me something cool or teach me how not to be uncool. This is just a rant that has no real value.
- dschobel 16y agoIn his defense, he does provide all of the code for how he ultimately solved his problem.
- rjurney 16y agoHe did rewrite it to be more flexible. So while you are right, I'm down-voting you for not reading the fucking article ;)
- acqq 16y agoI've looked at his code. He didn't rewrite it, just wrote the wrappers to the API calls to make his usage cases more convenient for him, which is what every beginner would also do.
- rjurney 16y agoHe gave it a sane interface for a broader use case, with sane code that he published. Mission accomplished. Not just complaining.
- acqq 16y agoBut I hope you understand that OpenSSL has order of hundreds of thousand of lines of code (don't make me counting now) and the guy made something like a hundred lines total separated in a few functions which simply call OpenSSL API step by step to do the given task. It certainly can't be said that he "rewrote OpenSLL" and it's certainly not something that gave him any right to feel superior -- he's just a user of the API.
- dkarl 16y agoPersonally, I found it educational that a vital piece of security infrastructure like OpenSSL is a tangled piece of sh... paghetti. When my coworkers and I write something security-critical in our code (not that I've ever touched anything as important as OpenSSL; I suspect OpenSSL is more critical to our security than any of the code we've written ourselves) we make it as dumb and simple and clear as possible and document it very well. With OpenSSL I would have assumed (did assume) the whole project was implemented that way, bending over backwards for clarity to minimize the chances for a vulnerability, either in the code or due to misuse of the code. It's shocking and interesting to find out that it isn't.
- jrockway 16y agoI'm surprised that you're surprised. It's old code that nobody touches. It's written in C. Of course it's going to be bad. (Why? Because "good" changes every year or so, and if nobody has needed to touch the code for a year, it's going to be bad by definition.) Sure, it's good to clean up old code to minimize the number of unanticipated failures. But this takes time and money; there aren't magic fairies that do things "because they should" or "because it's a critical piece of infrastructure". If it's boring and there is no money to be made, then it's not going to get done. The author shows why; sometimes, it's just easier to hack around the problems than to fix them.
- dkarl 16y agoThe definition of good C code hasn't changed that much. API styles change and compiler capabilities change (gotta love C code with 7-character function names inherited from ancient Fortran code) but undocumented and disorganized is never good. I've used C APIs that were procedural with no OO influence at all, each function taking dozens of parameters, many of which weren't actually used because it was easier to pass the same thirty parameters to each function than to try to remember a unique parameter list for each function consisting of the seventeen parameters it actually needed. I've used APIs like that and groaned and cried and pulled my OO-educated hair out, but some of those APIs were still well-documented, logically arranged, and cleanly implemented, and they were a lot easier to use correctly than code written poorly in a modern style.
- jolan 16y agoTo be fair he did write something in response to his rant: http://opensource.conformal.com/wiki/Agglomerated_SSL http://opensource.conformal.com/wiki/Agglomerated_SSL
- bborud 16y agoI disagree. How are people expected to learn from the mistakes made in OpenSSL if we mustn't be negative? OpenSSL is, by any sensible code quality metrics, a bloody mess. It is a miracle that this code has not caused more disastrous problems than it has. It is not only legitimate to criticize it: it is essential that we do and that we articulate what mistakes were made so that others may learn from it.