Alone in the dark

A few weeks ago, I stumbled upon a database schema that had been created by a solo engineer who worked in isolation for months. All tables were 3-letters long, with up to 30 columns that had 3 letters each. No-one understood what was going on, we had to restart the whole thing from scratch…

Code that has been entirely designed and authored by a single person often produces code smells and architecture pitfalls. If you are doing it alone, you are most likely doing it wrong. There is simply too much value in having code go through proper code reviews.

When one writes code meant to be shared and seen, one becomes more concerned about its quality, testability and correctness. Readability improves, because there is a desire for code to go beyond the author’s scope. Feedback from others makes greater coders over time. This is where open source software can really shine.

Don’t code alone in the dark. Great code is always refined through the fire of analysis and criticism.

17 Comments

Mario Prawirosudiro says (November 25, 2014 at 7:29 am):

It’s scary how true this is.
When we code together with our peers/colleagues/coworkers/whatever, we’re under constant pressure to keep our code clean, whether we realize it or not. Once we’re left alone, our exploratory instinct kicks in, and we start playing with code, neglecting quality for quick solutions, so that we can get to the next challenge, and so on.
I think this is the reason why pair programming is trending right now, and why most coders ‘feel’ they’re more productive in such environments.

Nicolas Bize says (November 25, 2014 at 8:13 am):

I think you’re right!

Jonas Hammarberg says (November 25, 2014 at 8:05 am):

Being the only programmer in the company doesn’t leaves much choice but code “in the dark”. On the other hand — being the only one also means that I’ll have to maintain my own code, even 10+ years after it first saw the light of the day. And that’s not possible without taking really good care of the code.
Besides, as a bonus I get to see how much I improved during the years as I, almost, always sees a better way to accomplish nowadays.
Sincerely /Jonas

Nicolas Bize says (November 25, 2014 at 8:26 am):

Hey Jonas!
Having worked for a tiny company at one point, I completely understand your case. And I think that it’s great that you are taking care of your code knowing that you will be the one maintaining it later. However there is so much benefit to being able to share your code with others. Would your company agree to open source some of the things that you code? Do you still find time to work on some collaborative or open source projects on your spare time? I can really tell you from experience that it will be a trumendous gain for you as a coder.
Good luck, and thanks for reading! 🙂

Phil Murray says (November 25, 2014 at 11:31 am):

You are NOT your code!!!
Most of us try to do the best we can out of a sense of pride but due to the time and financial constraints of the real world this is sometimes not possible, especially in smaller companies.
Does this lead to technical debt? Absolutely, but sometimes this is unavoidable. Be pragmatic and do the best job you can.
Finally, the developer that created that database schema needs shooting.

Doug says (November 25, 2014 at 12:54 pm):

I would LOVE for others to look at my code. There’s little question that some knowledgeable programmer would reveal things that would leave me wondering why the heck I didn’t think of that to begin with. But I’m producing a prototype for a niche product that few others even understand the need for (because they’re not active users of this kind of software), I know how the entire integrated program must operate in order to have a chance in the market, and I’m painfully aware of how important it is for code to be as self-explanatory as possible — because I have to find and correct my own bugs. No one else has any incentive (financially or interest-wise) to look at my code, so finding someone qualified to analyze it is darned near impossible. On earlier coding projects, the pitfalls of shortcuts became very obvious, so I avoided most of those earlier errors in this project. But I’m certain that another pair of eyes on this would be enormously beneficial. So I absolutely agree with the author’s point here — while fretting that there’s no way to include that insight in my current project.

Eric Bishard says (November 26, 2014 at 11:50 pm):

I am a novice .Net developer, I felt the same way. Until I decided to start reaching out. I have a Twitter account with almost 500 followers. That’s not a lot, but they are almost all .Net developers and front end developers. There are three different way that I have reached out and found others to review my code. 1) Post a status message on Twitter that says: “Looking for a .Net Mentor, someone to share a screen and talk code with”. I got two takers right off the bat and I’m talking to one of them on Skype as I write this and he has helped already in helping me refactor and think about my code differently. 2) I take Pluralsight courses and ask questions to the instructors. 3) I have read some articles I really like online and reached out to those people and asked them to help. In each scenario I have found others that were willing to look and some that were willing to stick around. Just put it out there, ….. ask.

Nicolas Bize says (November 26, 2014 at 11:57 pm):

Thanks for sharing that thought, I agree 100%. Developers are a weird species but when asked genuinely they are almost always there to help out, especially when asked for feedback. I’ve never had a bad experience myself.

Tony Dunsworth says (November 25, 2014 at 3:31 pm):

I also an a one man shop, but I asked I’ve of my colleagues who used to program years ago to review my code to ensure that I kept it as clean as I can. It also seemed to help by having sometime who isn’t a daily coder look at it forces me to explain my code and I can catch things I missed, even if he didn’t.

Clay Shannon says (November 25, 2014 at 5:27 pm):

I don’t know – I’ve only worked one place where we even had code reviews.
I consider my style of development SODD (Stack Overflow Driven Development). So, even though I’m “alone” in a sense, I really draw from the “wisdom of the crowd” to try to stay on the “straight and narrow.”

Frans says (November 25, 2014 at 5:49 pm):

I agree and disagree.
What you are writing is true for a lot of programmers.
However: a really experienced programmer can perfectly write quality code without the need of code-reviews.
Frans.

Nicolas Bize says (November 25, 2014 at 6:26 pm):

Of course, I never implied that because one is writing code in a solo process it will necessarily be bad code. In that sense the term “code smell” is incorrect.
However, any code produced by an experienced programmer will be of higher quality if 1/ written in the intent of beeing visible code and 2/ the code is discussed with others.

Ron says (November 25, 2014 at 8:56 pm):

…and any experienced programmer who believes their un-reviewed code to be perfect, is probably deluded.
Ron

Suraj Soni says (November 26, 2014 at 4:28 am):

thank you for sharing this great thought..nice

Allan Jes says (November 27, 2014 at 7:34 am):

Thanks for this insight. Indeed as coders we are weird!
I am currently on 3 php mysql projects but unfortunately what you are stating is exactly what I have been doing for the past 3 years.
I try as much as possible to be clear in code and do the documentation but I agree, we should always let others review for us.
For my case time and budget constraints factor in since ours is a small private company.
Though we are two, I take on the senior developer role most times, but it is really disturbing when I have to be called upon each and every time to rectify a ‘simple’ bug.

Gordon says (April 28, 2016 at 8:14 pm):

This is the first blog I’ve read all of and enjoyed! Really good points, there’s always a bigger fish and your code can always get fatter! ;D
I work in a team of 11 and only two of us can code, everyone else is a designer but you’ve spurred me on, I’m going to try get some code review’s set up!
Thankyou!!

Ninja Team says (February 28, 2017 at 11:59 am):

Gosh, you make the convention of coding less painful 😀

Comments are now closed

dark
sans