2015-09-26

Is my mentor's concern for code quality excessive?

There is this question that was asked on Programmers SE on Jun 12, 2015 which I answered, and as a result I received plenty of reputation, as well as a silver badge. Unfortunately, after a few days the question was closed as primarily opinion-based and then deleted.  Since I now have sufficient reputation to view deleted questions, I was able to find it, and I am posting it here for posterity.

Is my mentor's concern for code quality excessive? [closed]


Score: 75 (79 upvotes, 4 downvotes) Favorites: 28

To tell you a little about myself: I'm a newbie programmer working internships and learning a lot from experienced programmers. I can't believe I used to think I was good in college.

The one I'm doing right now is pretty great due to the amount of time and resources that the company is putting into helping and mentoring me and another intern. I'm learning a whole lot and for the first time, I feel like I get close to being competent.

The only "problem" are the massive code quality concerns of one of my mentors. It's to the point that anything takes a whole lot of time because I have to find the best way to do it or else it's a waste of time. It also feels like my creativity doesn't matter because there is only one right way to do everything. I don't mind any of this at all but I wonder, and this is mainly what I'm asking, if it's normal in the industry.

Also, when I get assigned a little feature and this guy reviews my code, he actually reviews the whole codebase I'm working on, pointing out loads of mistakes, most of them from before I was even hired. I have spent this whole week fixing code (that worked) written by their full-time programmers, even some things that are best practice according to other mentors.

Tags: [] [] [] []

asked Jun 11 2015 at 18:51 by CyborgFish
The question received 14 answers before it was closed.

The highest ranking answer was by Thomas Junk, with 130 points (gold bage is awarded at 100 points.)

The next answer was mine, with 71 points. (silver badge is awarded at 25 points.)

Here it is:


Let me quote from Page xxii (Foreword) of "Clean Code" by Robert C. Martin from Prentice Hall.
Back in my days working in the Bell Labs Software Production Research organization (Production, indeed!) we had some back-of-the-envelope findings that suggested that consistent indentation style was one of the most statistically significant indicators of low bug density. We want it to be that architecture or programming language or some other high notion should be the cause of quality; as people whose supposed professionalism owes to the mastery of tools and lofty design methods, we feel insulted by the value that those factory floor machines, the coders, add through the simple consistent application of an indentation style. To quote my own book of 17 years ago, such style distinguishes excellence from mere competence.
I would like to suggest that what the author observed as "consistent indentation style" was most probably in fact a "consistent coding style", which in turn shows discipline. So, is discipline important? You bet!

Yes, you may be grunting now; yes this is probably a drag; but it is short-term, within less than a year you will have learned to do things correctly, and this will stay with you for decades, so it's actually very good.

The author says it is what distinguishes excellence from mere competence. So, none of this means that you are incompetent; but your mentor actually wants excellence from you; and that's something you should be glad about.

Early in my career, (actually, precisely when I was fresh out of college,) I also had to work for some people who were hell bent on telling me how to do things down to the comma, and I am glad now that I went through that process back then.

Also please keep in mind that your creativity will best manifest itself in building designs, not in formulating code. Creativity in formulating code is a synonym for disorder; creativity in designs is what all the good stuff are made of.
It is worth also including some of the comments to my answer, which were quite insightful.  Most importantly, dodgethesteamroller's comment is about an issue which I should have addressed: correlation vs. causality.

26

> consistent indentation style was one of the most statistically significant indicators of low bug density. Totally true for python (: –  ecoologic Jun 11 at 23:49
23

However, beware Goodhart's law (en.wikipedia.org/wiki/Goodhart%27s_law). Once you notice that indentation is strongly correlated with good code, and argue on that basis that the code should be indented consistently in order to pass review, then typically you should expect the correlation to weaken and eventually disappear, because ill-disciplined people now learn to fix their indentation without becoming more disciplined in any other respect. –  Steve Jessop Jun 12 at 9:35
8

"Also please keep in mind that your creativity will best manifest itself in building designs, not in formulating code. Creativity in formulating code is a synonym for disorder; creativity in designs is what all the good stuff are made of." This :) –  TheCatWhisperer Jun 12 at 12:45
4
Programming is actually quite tolerant in that respect. Creativity in chess is all at the strategic level; inventing new moves for your chess pieces is frowned upon ;) –  MSalters Jun 12 at 15:16
  
@SteveJessop: Right on. Very perceptive. That quotation does nothing to improve my already low opinion of Uncle Bob and his ilk. Sounds like a classic case of correlation mistaken for causation. –  dodgethesteamroller Jun 13 at 0:33
1
@dodgethesteamroller: in particular, you can get consistent indents just by running a linter over whatever junk some cowboy throws out. Clearly this will not reduce bug density, although I suppose it might help future maintainers avoid introducing more bugs. –  Steve Jessop Jun 13 at 0:59
  
@SteveJessop Good, then we will move to the next offender and teach them one good practice at the time. –  Davidmh Jun 14 at 14:24 

No comments:

Post a Comment