4 ms·
> Part of the problem is that "well written code" is unbelievably subjective. I'd recommend you check out Code Complete if you haven't read it. It is an excel
by kansface 6y ago
> Part of the problem is that "well written code" is unbelievably subjective.
I'd recommend you check out Code Complete if you haven't read it. It is an excellent intro into best practices although its about 1000 pages and a bit dated. As it turns out, we as an industry do have an understanding of what makes code better, and it turns out, its mostly not very controversial - push complexity as low as it can go, simpler interfaces tend to be better, argument pass through causes errors, functions longer than 80 lines are associated with higher error counts, optimize code for human comprehension later (~70% of the effort that goes into code is maintaining it) etc etc.
- wildmanx 6y agoWhat I personally check out does not matter much. My point was a lack of consensus within the industry. It does not help if I read the same book as you and we two agree 100% what exactly we mean, when the next guy considers most of that nonsense. And that's what I observe with colleagues. > it turns out, its mostly not very controversial I don't believe this until proven otherwise with actual data. Any programming concept on this planet eventually gets an article on the HN front page that argues for why that particular concept is really bad and then we are having a huge discussion about it.
- luord 6y ago> I don't believe this until proven otherwise with actual data. I don't remember the last time that a piece by Uncle Bob or Martin Fowler—and they're just two examples, I've seen quite a few more who are generally met with agreement every time they're posted—was heavily criticized or disagreed with here. And when I do see disagreements, they tend to come from people who don't seem to have nearly as much experience as those guys do or who might have misinterpreted their point (much like how the idea of agile has turned into something that only reflects the manifesto tangentially, and accidentally at that) and who are, perhaps not coincidentally, likely to fall in the "programming is easy" camp. And even then, "controversial in hacker news" is hardly representative of what's controversial in the field at large (which I also understand goes against my own first point).
- Izkata 6y agoIf anything, Code Complete was for me further evidence of its subjectivity. I'd have to pull the book out again to find examples, but I remember finding a good 20-30% of the "better" examples actually more difficult to read, or there being a third way of doing it not mentioned in the book.