Coding Horror

programming and human factors

Discipline Makes Strong Developers

Scott Koon recently wrote about the importance of discipline as a developer trait:

Every month a new programming language or methodology appears, followed by devotees singing its praises from every corner of the Internet. All promising increases in productivity and quality. But there is one quality that all successful developers possess. One trait that will make or break every project.

Discipline.

An undisciplined developer will not be able to ship on time and will not write code that is easy to maintain. A disciplined developer will not only enable the success of a project, but will raise the level of productivity in others. Software architects and developers do themselves a disservice when they attribute their success to whatever methodology they have adopted. It really boils down to how disciplined you are.

It's an interesting coincidence, because I recently gave a presentation to a group of developers on the topic of source control, and I found myself repeating that very same word throughout the presentation: discipline. Discipline. Discipline! I repeat it because the mere presence of a great source control system doesn't obligate anyone to use it in a structured, rational way. No. That takes discipline.

And not many shops, at least in my experience, have the right discipline. All too often, what I see in source control looks more like this Windows desktop:

messy windows desktop

Instead of a nice, structured set of projects with logical branches and tags, what ends up in source control is a hairy furball of crazily named folders with no logical structure at all. Just like the average user's desktop.

And it doesn't matter what language you use, either. You can write FORTRAN in any language.

So I'm inclined to agree with Scott. Without discipline, things like tools and languages are irrelevant. But repeating the word "discipline" isn't exactly helpful, either. Perhaps what entry-level developers need is a programming mentor who isn't afraid to personally advocate the necessary discipline, someone hard, someone like Dave Cutler, or perhaps someone with the right motivational techniques to inspire discipline, like Gunnery Sergeant Hartman:

If you ladies leave my island, if you survive recruit training, you will be a weapon. You will be a minister of death praying for war. But until that day you are pukes. You are the lowest form of life on Earth. You are not even human f**ing beings. You are nothing but unorganized grabastic pieces of amphibian s**t. Because I am hard you will not like me. But the more you hate me the more you will learn. I am hard but I am fair. There is no racial bigotry here. I do not look down on ni**ers, kikes, wops or greasers. Here you are all equally worthless. And my orders are to weed out all non-hackers who do not pack the gear to serve in my beloved Corps. Do you maggots understand that?

You can find the same advice stated in more prosaic terms in McConnell's Code Complete:

It's hard to explain to a fresh computer-science graduate why you need conventions and engineering discipline. When I was an undergraduate, the largest program I wrote was about 500 lines of executable code. As a professional, I've written dozens of utilities that have been smaller than 500 lines, but the average main-project size has been 5,000 to 25,000 lines, and I've participated in projects with over 500,000 lines of code. This type of effort requires not the same skills on a larger scale, but a new set of skills altogether.

In a 15-year retrospective on work at NASA's Software Engineering Laboratory, McGarry and Pajerski reported that the methods and tools that emphasize human discipline have been especially effective (1990). Many highly creative people have been extremely disciplined. "Form is liberating", as the saying goes. Great architects work within the constraints of physical materials, time, and cost. Great artists do, too. Anyone who has examined Leonardo's drawings has to admire his disciplined attention to detail. When Michelangelo designed the ceiling of the Sistine Chapel, he divided it into symmetric collections of geometric forms, such as triangles, circles, and squares. He designed it in three zones corresponding to the three Platonic stages. Without this self-imposed structure and discipline, the 300 human figures would have been merely chaotic rather than the coherent elements of an artistic masterpiece.

Discipline takes many forms and permeates every aspect of software development. Start small. Say your database schema contains three primary key table columns named list_id, ListId, and list_value. There should be a Gunnery Sergeant Hartman on your development team who will.. gently.. remind the team that it might be a good idea to fix problems like this before they become institutionalized in all your future code.

You don't necessarily have to have a strict, rigid military code of conduct. Even though software engineering is a young field, there are a lot of accepted conventions that make up modern software development. All it takes to benefit from those conventions is a little old-fashioned discipline. And if it doesn't start with you, then who?

Written by Jeff Atwood

Indoor enthusiast. Co-founder of Stack Overflow and Discourse. Disclaimer: I have no idea what I'm talking about. Find me here: https://infosec.exchange/@codinghorror