5 ms·
Oh god that code is fucking hideous. If someone who worked with me wrote that I'd talk to them about it and make sure they never did anything like that ever ag
by ebbv 13y ago
Oh god that code is fucking hideous.
If someone who worked with me wrote that I'd talk to them about it and make sure they never did anything like that ever again.
From the terrible argument names to the abuse of the single line if syntax (which should never be used anyway, always use curly braces.)
- orangethirty 13y agoThats hideous? I see worse code everyday.
- ebbv 13y agoJust because there's lots of worse code doesn't make that good. There's worse songs than "Who Let the Dogs Out" but it's still a really bad song.
- cheald 13y agoYou would love this: https://feralbynight.googlecode.com/files/FeralbyNightv3_2_b_beta.cpp https://feralbynight.googlecode.com/files/FeralbyNightv3_2_b...
- danbruc 13y ago11k lines in one file - this is the way it should be done. ^^
- encoderer 13y agoMaybe it comes from using Python as my go-to language (and that it's my favorite language) but i personally like to avoid non-essential braces and other minutia. Yes, of course, I know the argument: a one-line bracketless "if" can set-up a future developer for failure if they need to add an item to the conditional block. And if they for some reason decide not to read the actual conditional. And if they don't test it. And I don't hate code that uses braces even when they're not strictly needed, but I personally prefer to omit them. And my feeling is that the dogma around braceless-ifs is a little overblown. Of course when working on a team that has adopted a no-braceless-if policy, I conform. Having consistent code is way, way more important than somebodies own favorite bracing style.
- Dylan16807 13y agoOdd, since python is all about using the best way and not variants, that you would want to have some with braces and some without braces.
- encoderer 13y agoSure, being "pythonic" is about having one best way. But you're taking it to a level for snark that really isn't warranted. I can think of at least 4 ways to iterate a list. It's about doing something the easiest/best way for the circumstance.
- pmarin 13y agoI find this code pleasantly readable. How about this one? http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=src/cp.c;h=e235b326d4d45b82aadaccef6a2f95da7137c1aa;hb=HEAD http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f...
- dasil003 13y agoMakes me wonder what the quality of the architecture is on your projects is though. Not that I think coding style is unimportant, but it's all too easy to criticize yesteryear's code with today's style standards and totally miss the forest for the trees. Are you doing work that measures up to the ambition of Plan 9?
- pjmlp 13y agoWe all know how well that ambition turned out.
- myg204 13y agoYes, (1) commercially it went nowhere, (2) technically it's a complete working os with original ideas implemented in a masterful way. Not bad I think!
- pjmlp 13y agoI can say the same for many other OSs, like BeOS or Native Oberon, just to name two of them, but in the end it is (1) that counts. It is like football, it does not matter how brilliant a team plays, but which one has higher score when the referee signals the end of the game.
- myg204 13y agoIMHO, (1) is the not only think that counts in the end. A 'failed' (as in (1)) concept may have a second life in future works. Also, in the case of plan9 some ideas did get traction (UTF-8 for example), some didn't so it's not all bad. Comparisons are tricky, you can compare an OS to a football team, and then yes maybe what you say is right. Or you can compare it to a work of art, then what matters is the influence the works has in shaping the future...
- pjmlp 13y agoYeah, maybe I was a bit too harsh. It is just that I personally never found Plan9 that interesting, except for its successor Inferno and Limbo. For me operating systems that explore designs done with regards to micro architectures or safe systems programming languages are much more interesting. So for me Plan9 tends to be just another OS. And yes I have used it.
- tzs 13y agoWhat did you find wrong with the argument names?
- papsosouid 13y agoIt is always the worst developers who fixate on arbitrary rules because they never developed the ability to read code. Go practice reading code, that's the only way to get better at it.
- jff 13y agoIt's a good thing they didn't use a goto, or this guy might have had an aneurysm.
- __david__ 13y agoNo. Single line if syntax is good. Gratuitous curlies make the code longer and ultimately harder to read (since you can't fit as much on a page). Being able to see your whole function/algorithm at once is more important that almost any other consideration.
- vy8vWJlco 13y agoYou may find astyle and indent personally useful if/when you go hoarse (hackers aren't really known for their conformity). http://man.cx/?page=astyle http://man.cx/?page=astyle http://linux.die.net/man/1/indent http://linux.die.net/man/1/indent