Excerpts from ‘The Clean Coder'
Yos Riady Feb 17
What does it mean to be a true software craftsman?
Here are my highlights from The Clean Coder, a code of conduct for professional programmers.
Do No Harm
Software is too complex to create without bugs.
However, you must be accountable for errors even though errors are virtually certain. Apologies are necessary, but insufficient. You cannot simply keep making the same errors over and over. As you mature in your profession, your error rate should rapidly decrease towards zero. It is your responsibility to get as close as possible to it.
QA should find nothing.
Some folks use QA as the bug catchers. They send them code that they haven't thoroughly checked. This behaviour is just plain lazy and irresponsible. Releasing code that you don't know works is unprofessional.
You must know it works.
Test it. Test it again.
Every time QA finds something the development team should react in horror. They should ask themselves how it happened and take steps to prevent it in the future.
It is not your employer's responsibility to make sure you are marketable. It is not your employer's responsibility to train you, or to send you to conferences, or to buy you books. These things are your responsibility.
You should plan on working 60 hours a week. The first 40 are for your employer. The remaining 20 are for you. During this remaining 20 hours you should be reading, practicing, learning, and otherwise enhancing your career.
The best way to learn is to teach. Nothing will drive facts and values into your head faster and harder than having to communicate them to people you are responsible for.
First, your code must work. You must understand what problem you are solving and understand how to solve that problem. You must ensure that the code you write is a faithful representation of that solution. You must manage every detail of that solution while remaining consistent within the language, platform, current architecture, and all the warts of the current system.
Your code must solve the problem set for you by the customer. Often the customer's requirements do not actually solve the customer's problems. It is up to you to see this and ensure that the customer's true needs are met.
Your code must fit well into the existing system. It should not increase the rigidity, fragility, or opacity of that system. In short, your code needs to follow solid engineering principles.
Your code must be readable by other programmers. It requires you to craft the code in such a way that it reveals your intent. This may be the most difficult thing a programmer can master.
3 AM Code
When you cannot concentrate and focus sufficiently, the code you write will be wrong. It will have bugs. It will have have the wrong structure. It will be opaque and convoluted. It will not solve the customers' real problems. In short, it will have to be reworked or redone. Working while distracted creates waste.
The worst thing to do as a programmer is saying you are done when you know you aren't.
Ask for help
Learn how to ask for help. When you are stuck, or befuddled, or just can't wrap your mind around a problem, ask someone for help. This is a matter of professional ethics. It is unprofessional to remain stuck when help is readily available.
Collaboration is critical for effective programming.
As a professional it is your job to help your team create the best software they can. Everybody needs to watch out for errors and slip-ups, and work together to correct them.
Use your time wisely.
When you receive a meeting invitation, don't accept unless it is a meeting for which your participation is immediately and significantly necessary to the job you are doing now.
When the meeting gets boring, leave. You have an obligation to manage your time well.
- What did I do yesterday?
- What am I going to do today?
- What's in my way?
Each question should take no more than twenty seconds.
Professionals evaluate the priority of each task, disregarding their personal fears and desires, and execute those tasks in priority order.
Professionals fear messes far more than they fear blind alleys. They are always on the lookout for messes that start to grow without bound, and will expend all necessary effort to escape from them as early and as quickly as possible.
Keep your systems, your code, and your design as clean as possible.
Professional software developers do not make promises that they can't keep, and they don't make commitments that they aren't sure that they can meet.
A craftsman is someone who works quickly, but without rushing, who provides reasonable estimates and meets commitments. A craftsman knows when to say no, but tries hard to say yes.