"Clean code has always been about money, and has never been about art."Apparently this took a few people by surprise. One person comented:
"...I thought we were talking about craft, and the cost-cutting as a subproduct..."So what is the difference between a craftsman and an artist? And just to add some spice, how do they differ from a hacker and a novice?
I realize that I am making a Myers-Briggs type error. People cannot truly be classified using binary attributes. A person classified by MBTI as an introvert, certainly has some extrovert characteristics. By the same token a programmer who shows some attributes of a hacker, probably also shows some attributes of a craftsman.
Still, I think the definitions of these terms can be useful as a way to classify programmer behaviors.
What is the difference between the Hacker, the Novice, the Artist, and the Craftsman? It's all about their personal definition of "Done".
The Artist is done when the structure and behavior of the artist's code has achieved perfection in the artist's eyes. There is no consideration of money spent, or money to be earned. The artist does not care about ROI. The artist does not care how long it takes. The artist cares only about the final result.
An artist will spend hours, days, even weeks, on a single line of code. An artist will throw away whole functions and modules because they somehow don't feel right. An artist polishes, and polishes, and polishes in pursuit of some elusive goal of perfection.
The Hacker is done when the behavior of the code achieves some personal goal. The Hacker is not concerned with ROI. The Hacker does not care about the code at all. The Hacker does not care about how much, or how little, is spent creating the code. The Hacker does not care if anyone else ever uses the code. The Hacker only cares about making it work -- once. After that, the Hacker loses interest.
The Novice is done as soon as the code works "well enough". The Novice strives to minimize initial coding time. The Novice is not concerned about ROI. The future cost of the code is of no concern to the Novice. Nor does the Novice care about the number of hidden and/or subtle defects left in the code. The Novice simply wants to get to the next task as soon as possible. The Novice is driven by schedule; or rather, the Novice is driven by pleasing managers who are driven by schedule.
The Craftsman is done when ROI has been maximized. The Craftsman strives to be a good steward of the monies being spent. The Craftsman want to make sure that every dollar goes as far as it can, and earns as much as it can in return. Therefore the Craftsman makes sure the code works, and can be kept working with minimum extra cost.
The Craftsman understands that most defects in behavior and structure will be very expensive to repair later and very inexpensive to eliminate now. So the Craftsman pushes towards a very clean implementation. But the Craftsman also recognizes that some rare defects in behavior and structure are going to cost more to eliminate than to tolerate; and so the Craftsman uses judgment, acquired over years, to maximize ROI.