12 ms·
Exploring the impact of code style in identifying good programmers (2022)
- sidlls 4y ago"Code style" is about more than formatting, and this article isn't identifying "good programmers," it finds a rather weak correlation with people who are good at doing programming contests--the two are not necessarily the same.
- toolslive 4y ago... but, most repositories have linters that enforce style uniformity across developers ?!
- jmfldn 4y agoThat only addresses superficial concerns like formatting. A linter can't rewrite the code and change the style.
- MathMonkeyMan 4y agoI didn't read the whole paper, but a lot of it looks like that.
- jmfldn 4y agoYeah it does to be fair. Code style to me means something more than this.
- DaiPlusPlus 4y agoPerhaps things like casing conventions? That would be covered by a linter too. Or does it mean style-of-semantics (if that's even a thing), for example in C#, preferring to define explicit constructors instead of a parameterless ctor and trusting the user to set properties in the post-ctor initializer correctly? Or use of higher-order/FP techniques (like map/filter/reduce/fold) over explicit for-loops? The summary says this (note the last remark): > The results demonstrate that good programmers may be identified using supervised machine learning models, despite that no particular style groups could be attributed as a good style. Obviously they're not saying, for example, that one particular bracing style is better than another (1TBS tho!), nor that co-incidentally "good" programmers prefer one style over another; but despite knowing what they're not saying, I don't know what they are saying with that...
- toolslive 4y agoIn python, something like "black" will most definitely change the style. Anyway, they looked at C++ code and measured things like the number of tabs, number of spaces, number of white lines, avg line length aso (table 2) Most of which get standardized automatically by the IDE these days.
- PartiallyTyped 4y agoSame with TypeScript and JS.
- deleted 4y ago[deleted]
- 4pkjai 4y agoI'd be surprised if most repositories have linters. I've worked on tons of projects that didn't care about enforcing code style.
- PartiallyTyped 4y agoSame, even in a corporate environment, linters - and even more so linters within the build process - may not exist.
- userbinator 4y agoI've seen a lot of very different styles of code over the years, and I can safely say that some of the most productive programmers I've worked with have been ones with surprisingly unusual styles. That said, using a programming contest as a judge is also likely to bring out the more unconventional styles, like minimised whitespace or indentation.
- blatant303 4y agoWhat do you think of my coding style ? https://gcdnb.pbrd.co/images/hgHbrzHh2mWT.png?o=1 https://gcdnb.pbrd.co/images/hgHbrzHh2mWT.png?o=1 Over the years I came to use more and more custom vertical alignment of short code lines (whatever the language is). This makes semantic similarity/symmetry stand out, elicit functional decomposition, and enables one to have a complete one-screen bird's eye view over complex problems like this MQTT pulser that trigger interrupts in unison (because musicality of what appears in my MQTT console matters too): https://gcdnb.pbrd.co/images/kpJaZMfoWPtP.png?o=1 https://gcdnb.pbrd.co/images/kpJaZMfoWPtP.png?o=1
- TeMPOraL 4y agoLove it. I need to figure out a way to get this automatically, because it looks super useful as high-level view - I could then switch back and forth, using clang-format to go back to company-accepted style.
- whstl 4y agoLove it too. Reminds me of the terseness of Haskell, which I also enjoy. Whenever I need that "high-level view" you mentioned, I enjoy seeing the whole module without having to scroll/search. In codebases where I gotta jump around too much, I feel disoriented and slowed-down. Like for example on Rails classes where single-use variables are replaced by single-use private methods, that are often far away from it's original usage point. I understand the rationale for doing it but it still tax me mentally when trying to get a holistic understanding of the code. But then again, some people get used to sparse code and for then I assume such terseness can be overwhelming. Oh well. I just wish they could see my point of view too.
- blowski 4y agoThis seems to focus on code style in terms of placement of brackets and new lines. From personal experience, I know there are some programmers with awful code style - random brackets, lines and indents everywhere. But above that low bar? I don’t know how it would matter. I’d be more interested in the commonality of design patterns and standard data structures and algorithms.
- s-xyz 4y agoHow do you measure a good programmer? Haven’t gone through article yet, but that’s my first question that pops up.
- dstick 4y agoMy guess would be with a binary ruler
- omeid2 4y agoProductive, in the commercial sense.
- tester756 4y agoknows his/her shit, delivers, is aware of the trade offs, is easy to work with.
- yodon 4y agoDo they read the article before posting about it
- azherebtsov 4y agoI’d suspect that using GCJ as a data source they assume that “good” = solving a given round of competition. The further you reached in rounds - the better programmer you are. Not the best measure if they really used it. Coding competitions have almost nothing in common with day to day work of software engineer.
- nathias 4y agoI think what is really encoded in the otherwise arbitrary choices of code aesthetics is the care one puts into it and overall greater readibility/understandibility that you get from consistency.
- gleenn 4y agoTo not appreciate code style is to not appreciate art. I have almost no freedom trying to accomplish the extremely robotic task of pushing some silicon to do something correctly perhaps also efficiently. The fine line between those things separates the people easily between those who are paying attention and those who are falling asleep at their jobs.
- dt3ft 4y ago> Results show that, although style groupings were found, there were no specific groups with which good programmers could be associated.
- andai 4y ago> Although four style clusters were found, good programmers could not be associated with a particular cluster. However, supervised machine learning showed that stylistic attributes can be used to predict good programmers. Seven machine learning models were trained and evaluated using recall, macro-F1 and AUC-ROC. A Balanced Random Forest yielded the best results with 0.650 recall, 0.511 macro-F1 and 0.695 AUCROC. The results indicate that code style can be used as a measure to identify good programmers.
- arsome 4y agoSo what's the conclusion here? There are good coding styles but we don't know what they are? Thanks machine learning.
- marcosdumay 4y agoGood styles exist, but they are not simple enough to be described.
- Arch-TK 4y agoTo be fair, sampling from a very specific subset of programmers (ones who would participate in a code jam) to do this study just seems like it would introduce various kinds if sampling bias. I would like to see someone try to figure out a better sampling method before I would even consider looking at the results of such a study.
- Ideabile 4y agoI feel that should have been phrase as formatting style. This enters in the category of taste, I’m surprise that someone has investigate the assumption that could be correlated is something meaningful. Although when comes to programming there is still different styles, compositions over inherence, condition verbalization, etc… I wonder if that makes the difference. I believe makes better code, but some times I struggle explaining the value.
- rigelbm 4y agoI stopped at "Good Programmers". Seriously though, it would have been perfectly fine to phrase it as "Exploring the correlation between Code Style and Competitive Programming Performance". Everyone knows that competitive programming has constraints (e.g. small time limit, throwaway one-off deliverable, no collaboration) that favours a style of coding that you wouldn't normally find, for example, on a business setting. It's not clear whether this paper was accepted at the conference, but if it was, it is a testament to the low bar of the examining board. I like to follow the "if you don't have anything nice to say, don't say anything" mantra, but this paper deserves an exception.
- marginalia_nu 4y agoYou really should consider reading articles with a more generous mindset, not just stopping at the first ostensible flaw.
- deleted 4y ago[deleted]
- zopa 4y agoYou’re saying we should judge things on their substance as a whole, and not by superficial details? Persuasive! I wonder if we could apply that insight to any other field of endeavor…
- moffkalast 4y agoNah, that would never work.
- sdf4j 4y ago> You’re saying we should judge things on their substance as a whole, and not by superficial details? This is literally the goal of the study. Judge programmers based on the superficial details of competitive programming results.
- z3t4 4y agoNext you will read a paper about something you are not an expert in and will think every word is fact and truth.
- traceroute66 4y ago> Exploring the impact of code style in identifying good programmers Perhaps the paper should be re-titled "Exploring the impact of code style in identifying programmers who can configure their IDE" Modern IDEs have hundreds of knobs and dials you can tweak so that your code can confirm to any style you fancy. Therefore if you are identifying programmers by coding style, what you are most likely doing is identifying people who can correctly configure an IDE. Or, in other words, identifying people who can RTFM. ;-)
- lifeisstillgood 4y agoHonestly I am moving to a work-mandated IDE (very modern) and all I want is a big button saying "turn off all the helpers". I am I suspect being grouchy, but I don't think that saving me some typing strokes is worth all that effort. I love linting and really like real-time linting and syntax catching. But they usually just underline my typos. Anything else (like trying to prevent me from making the typos as I type, or worse adding in brackets just annoys me. I don't want to invest time in learning an IDE with a million knobs - i can write my own functions if I see the need - just mostly I need to work on actual work.
- 5e92cb50239222b 4y agoIf it's anything from JetBrains, enable power save mode (ctrl+shift+a → power save mode → enter), it will get you 90% there with a single "button".
- donatj 4y agoI worked with a guy ten+ years ago that used so much whitespace it was unreasonable. Literal full screen worth of newlines between thoughts. Indentation the reasoning behind only he knew - if there even were any. I've never seen anything like it before or since. I'd say otherwise he was a pretty average programmer. Interesting job, that. We all had our own projects fully ours unless we went on vacation, it made weird formating choices like that largely not a problem.
- treeman79 4y agoMy first programming job. Th owner had a rule that all equal signs lined up. Didn’t matter the purpose. Or how deeply nested his if else statements were. Which he would have 40 layers nested with tons of math between them. Was insane trying to read the code.
- tough 4y agoJust reformat it for reading and reformat it again before committing I guess
- xiaodai 4y agothis paper is extraordinarily bad. Like what variable makes a good programmer. doesn't say that. just says variable importance. so frustrating. at least show the signs of the values form logistic regression.
- jffhn 4y agoWorking on a system where we had no code review procedure, I liked that the worst developpers were also the ones respecting the least the codebase style, so that we could easily identify their code and check it when stumbling on it.
- nedsma 4y agoCode style and code formatting introduce so much friction in modern .NET and Java development teams, that despite any advantage these might have due to their ecosystem maturing, it's more efficient and sane to avoid these languages altogether.
- rwoerz 4y agoArguing about coding style appears to me like if left-handed or right-handed traffic is better. Both are fine, mixtures are not.
- toolslive 4y agoActually.... It's not. Continental Europe mixes priority-to-the-right with driving on the right side of the road, which is not that good. It would have been way better to mix driving on the right with priority to the left as it gains the driver a bit of reaction time. (Of course, driving on the left with priority to the right would have been fine too)
- deleted 4y ago[deleted]
- JonChesterfield 4y agoThere's a good chance one can identify bad programmers from coding style. A few symptoms come to mind: - fanatical about manual placement of whitespace - copy&paste&mutate large blocks of code all over the place - checks in blocks of commented out code in case they're useful later Identifying good programmers is much harder, there's a lot of variables in that.
- hanniabu 4y agoI feel personally attacked
- jameshart 4y agoIf you extract thirty style characteristics, you shouldn’t be surprised to find that some of them randomly correlate with ‘quality’ in your dataset. https://xkcd.com/882/ https://xkcd.com/882/
- redleggedfrog 4y agoInteresting that little correlation was found. My experience has been that "good" programmers follow the most prevalent conventions of the language so their code is easily parsed by other humans used to seeing it that way. Like I use a braces on their own lines in C# but an opening brace at the end of the line in Ecmascript. When in Rome...
- franciscop 4y agoExactly, that's my basic ask for anyone making a PR on any of my OSS code, and when doing a PR myself I try to do that as well, be it for work or for fun. The first code I wrote as a self-taught programmer had a lot of weird spacing, like I'd write `<div class = "hello" data-label = "...">`
- taeric 4y agoThis is somewhat silly, though. Prevalent conventions are followed by the majority by definition. Such that most of your experience will be with those conventions. Again, by definition of it being prevalent. I grant that conformity does signal education of the norms. Which can be seen as signaling effort. But I expect it to be so noisy that it will have little predictive power.
- ARandomerDude 4y agoGood drivers follow prevalent conventions, which is what makes them safer drivers.
- mistrial9 4y agoreductionist paper without stating all assumptions in the title.. This relates to a long-term, diverging trend in the practice of programming.. Vast numbers of highly skilled coders are paid money to meet requirements of a much larger system.. old-school is corporate but the cloud in general could be thought of this way.. Many strong programmers are on the opposite end -- dreaming of patterns and applying them diligently; much more like weaving or industrial arts.. not "paint by numbers" like the requirements work. There are many, many gray areas in that analysis. Like that physics class demo of a growing balloon where all points expand and diverge at once.. the practice of programming will never be contained into one or more categories.. But to call out "good programmers" without recognizing the breadth and depth, is shallow and at worst counter-productive to the craft. This labeling gives fodder to the "Henry Ford"s out there looking to make other humans work as efficient machines themselves.. personally I can do without that.
- lifeisstillgood 4y agoHonestly there are ... wait for it ... layers. Randomly incoherent layouts, spacing and so forth are just signs of (a good programmer exploring and or a bad one who thinks it's finished) But then there are other layers - too much going on, more than one thing happening, having to go back and work out what that call did. Just failing to follow a thread. Then business layers and oh I give in. Determining "good programming" is like determining "good literature" or "truth". You know it when you see it. And you vomit on the bad stuff. But you have to read a lot of it.
- ElFitz 4y agoOn that topic, I am more and more starting to believe that most of the "aesthetic" aspect of code style (ie types of quotes, wether or not braces should be on a new line, spacing, spacing type, line length, etc…) should be simply be an IDE settings determining how the code is presented. That way, everyone would get to see the code the way they want, and no one would have to live with other people’s mostly arbitrary choices. Basically, prettier, except you‘d have one (personal) setting for how things are displayed on your IDE, and one (shared) setting for how things actually are written to disk. The main issue I see, is that it’d be introducing one more error source.
- neilv 4y agoPlease don't let academics plant more ideas in the heads of students about what software development is. Last time we did that, we got the Google/Leetcode interview that too many people are still cargo-culting. (Not realizing that it was originally what a professor thinks is important in industry software development, and then morphed even worse, into stereotypical university fraternity class filtering and hazing. Now you have other people, who should be scrappy street kid fighters, deciding who can join their gangs based on how good their posh accent, because they want to make money, and posh accents is what rich people seem to do.) Academics should stay in their lane. And students should be very skeptical when academics swerve the school bus into oncoming traffic.
- furyofantares 4y agoWhat does industry interviewing process have to do with academics? Is there some history I don't know where it was pushed by academics? I think it's just a runaway process where some metric that's easy to measure was chosen, and it's become a worse metric that's more burdensome on candidates every year as it has become more and more gamed.
- neilv 4y agoDuring dotcom boom, you had PG recruiting student founders out of undergrad, and also students at rich-kid schools with no experience getting investor money forced into their hands. So, led by students, you were stuck with a student's idea of what software development is about. Which was heavily influenced by their classes thus far (and unaware that, traditionally, a new college grad is usually not much use until mentored). Then, pretty soon, "tech" jobs became seen as a big-money career, which meant gatekeeping and smugness.
- agentultra 4y agoThe sample data seems dubious. What do they mean by, "good?" I imagine most of the code in that sample set is going to be a mix of completely rehearsed, "I've written breadth-first search 500 times before," and complete messy hacks, "I need to cut down the number of comparisons at each node to limit the search space so I can get this in under time..."
- pklausler 4y agoMy own coding style has been whatever clang-format emits, with a few tweaks to its configuration agreed upon by all in the project. I think it's ugly, but it sure beats having a formatting fundamentalist hold up a review because they fear that the cargo may not flow.
- tomkwong 4y agoI have learned to not worry about coding style anymore, not because I don’t care, but because too many people care about that. Having worked with one of the largest monorepo, I’m happy enough to align with others with a standard coding style that is supported by a formatter and just let the formatter do its job. Humans are amazing when it comes to learning new patterns, and coding style is one that can be easily adapted to.
- kayo_20211030 4y agoThis nonsense garnered 102 comments? This is research?
- kayo_20211030 4y agooh 103
- mckirk 4y agoIf you've ever looked at the top submissions for any coding competition, you know that the premise of this study is flawed. I assume that the people who score well on these competitions are quite capable and would write good code in other circumstances -- but they definitely don't care about style during the competition.