4 ms·
As a professional, I tend to think a distinct coding style is bad. You should try to write a code that is plain and unsurprising and reproducible. To me, this s
by euske 11y ago
As a professional, I tend to think a distinct coding style is bad. You should try to write a code that is plain and unsurprising and reproducible. To me, this study gives us another reason that we need a more uniform/standardized methodology and good education for the software industry.
- mordocai 11y agoWriting code that is plain, unsurprising, and reproducible not only is, itself, a style but also still leaves a lot of room for creativity/individuality.
- petke 11y agoWriting code is some ways a lot like writing in general. From the "elements of style" book: > Vigorous writing is concise. A sentence should contain no unnecessary words, a paragraph no unnecessary sentences, for the same reason that a drawing should have no unnecessary lines and a machine no unnecessary parts. This requires not that the writer make all his sentences short, or that he avoid all detail and treat his subjects only in outline, but that he make every word tell. https://en.wikipedia.org/wiki/The_Elements_of_Style https://en.wikipedia.org/wiki/The_Elements_of_Style
- codyb 11y agoConcise sure, but at the very least reasonably easily decipherable and preferably readable.
- grundprinzip 11y agoTotally agree, in the paper they only look at competitive programming contests. Ideally, it would be interesting if the same could be applied to a larger code base with more authors and if it's possible to find a particular author in such a code base.
- dman 11y agoIs this view unique towards programmers or do you extend it to artists and writers as well?
- superuser2 11y agoArtists and writers' products are supposed to be aesthetic; code is supposed to be readable and maintainable. I apply it to journalism, though. Newspapers have long had "house" style guides to keep things consistent across reporters.
- stilist 11y agoArtists and writers don't usually make things that will be modified in the future. Art also faces less risk of dependency hell.
- stephengoodwin 11y agoCall it a best practice for inexperienced artists and writers. If I, for instance, were to take up painting as a hobby, I would try to find some artistic formula or method to follow before branching out into a more unique style. I would consider this more important for writing than art, since reading novels involves much more of a time commitment from your audiences to appreciate, whereas art gives more flexibility in deciding how long your audience wants to spend with it. However, there's a difference between bad art and writing and bad programming. Bad art and writing lacks appreciation. Bad programming is full of errors, hard to maintain, and runs slow, giving an overall poor user experience.
- frankling_ 11y agoOne might argue that the things that could be taught as part of such a standardized methodology would either be extremely generic, or can and should be automated. "Design patterns" and "idioms" are definitely helpful and necessary for practical reasons, but to me they frequently seem like good candidates for automatization. Maybe in an ideal world, the parts of a solution that are "unique", i.e., not well-known and established, are even the only ones that should be required to be specified by a human.
- dietrichepp 11y agoThe original "design patterns" book, where the term comes from, talks exactly about that.
- ohyes 11y agoI think you present a false dichotomy. A distinct coding style does not indicate that the code is surprising or difficult to follow. A diversity of styles should help overall code quality in an organization because you get to pick and choose the 'best approach'* for a situation, and more importantly, learn from your peers. * whatever that heuristic happens to be... probably unsurprising and reproduce-able for you. I'd say the heuristic for me is 'concise, read-ably correct'. I've always thought of programming as closer to writing mathematical/logical proofs than anything else. If I can eyeball a program and say 'yup, that does what claims it wants to do,' then it's good. I don't think that heuristic always holds up in practice, simply because successful code-bases blossom proportionally to their success.
- jghn 11y agoThere's always more than one way to skin a cat in these things, we're talking about choices much deeper than where one puts their curly braces. For projects I work on I can guess with a high degree of certainty who wrote what just based on general patterns, naming conventions, phrasing in comments, etc. Most of these could be called "plain and unsurprising and reproducible" but people tend to leave little fingerprints here and there.