The Ferengi Programmer

Chad Moran wrote:

I don’t need a set of rules to help me make sure my product is flexible, reliable and easily maintainable. I can do that with my own judgment and insight.

OH REALLY? From your blog I see that you are 23 years old. And with that infinite amount of professional experience, you feel qualified to basically say Hey…I’m so damn smart, I don’t need to listen to anyone else’s advice

Your insight and judgement is not perfect, not honed and certainly not very experienced at the ripe old age of 23! You have much to learn my young programmer.

I just hope others finally realize like I did that these rules really only hold back the experienced programmers.

That statement is so laughable it barely warrants a comment. Experienced programmers? Who is that? You? At…23? Dude…really…get a reality check. You don’t have enough experience to really know. You might know tons about specific topics, but unless you were consulting for large companies in elementary school, you just don’t have enough real world experience to understand what the hell you are talking about.

Here’s some advice that I’m sure you will ignore. It comes from someone that has been doing this for A LIVING for over 20 years: If you don’t have at least 10 years doing this for a living, then please don’t tell someone who has that you are smarter than them. You might be right, but the odds are certainly not in your favor.

I agree 100% following general guidelines is good, following rules avoiding to take design decisions (as this can be inferred from rule X) just bad.

Guidelines, particularly in the absence of experts and mentors, are useful.

It’s just a shame that so much education is still focused on the rules rather than to explore the landscape to evaluate the most important guideline to consider.

@Wookie: 'Good programmers know the rules, and when to break them, and, therefore, say I need no damn rules!.

Crappy programmers see the good programmers saying that and just repeat them, skipping the first 2 steps.’

If I could up vote this I would!!!

I wish I could read all the comments here but they are too many! So many man/woman/monkey hours… gone for ever! Is there a way to distil their wisdom and offer it in the form of another post?

Please! Work out a way! Maybe just find some guest writters who are up to this amazing task. Then, the new post based on the old comments, will attract new comments which will need to be distilled to a new post again. With enough iterations we will be able to condence all the wisdom into something as thick as dark chocolate.

Then, you will be able to make the move from programmer to chocolateer.

Sorted.

Programming is still a craft. and all the rules are rules of thumb. Design patterns, anti-patterns, Go4 etc. etc. Are all rules of thumb and ideas from other craftspeople.

If it could be systematised like a factory making cars it would have been, but programming is actually designing the factory and its systems not making the cars. It isn’t a factory kind of enterprise and may never be.

I think I read this either here or the Pragmatic Programmer years ago and I always have to resist jumping on my soapbox and saying - rules are no substitute for thinking. Design patterns are no substitute for actually understanding what you’re doing…

So these guidelines are useful, but they are guidelines. You need to know why before what or how. Most people just jump into their comfort zone and start throwing code over the wire.

This is true of every creative endeavor whatever: music, painting, playing Go. The experts say there are no rules because they have internalised them. This confuses the newbies who, after an oldtimer tellse them this, then gets told you’re doing it wrong.

Never let an expert tutor a newbie. Newbies should be tutored by people who still remember what being a newbie was all about, and what it’s often about is memorizing and applying rules whose point you only really understand later.

They are called principles, not rules, and they should be treated as principles, not rules.

@Jeff
Man, you are misleading a lot of young software developers who read your blogs for advice.

If we treat young developers like they can’t think for themselves, then they won’t!

That is not true. The solid principles will help young developers to think about writing better code. How many of us have not seen complex classes with several thousand lines of codes from novice developers, classes with dependencies to other enormous classes. The SOLID principles in combination with agile thinking will contribute to a better code.

By reading all of these comments, it certainly appears that philosophy is a favourite hobby of developers. No wonder there are so many blogs around! And I don’t mean that in such a bad way, there’s a lot of usefull knowledge and experience being shared to the public. The only problem is some of the articles get people excited as if they were reading the works of the Mesia or the Antichrist - replace these with other fictional characters if you like!

If someone is trying to use some past experiences (theirs or their peers) into works of art/philosophy/science and draw conclusions based on them, then maybe they should get themselves familiar to the logical process that leads to such conclusions. Namely: induction or inductive reasoning. Please do not confuse this with deductive reasoning used in mathematics!

Inductive reasoning is employed to formulate laws based on limited observations of recurring phenomenal patterns. While past observations of these phenomena provide certainty that the formulated laws work in the past, there’s no guarantee that they will work in the future or for unobserved phenomena. This is the main reason why great philosophers like David Hume and Karl Popper argue its validity and call into question empirical claims made through the scientific method. Basically, don’t mistake an inductive law for the truth!

But amateur philosophers fall into yet more traps:

  • most of them do not employ the scientific method in the first place; while this method does not guarantee they will find the truth, it helps to increase the degree of certainty for their hypothesis and in most cases it will infirm it.
  • humans suffer from the confirmation bias and most of us fall victims to it; we only need to see a handfull of instances confirming the hypothesis to be convinced of their truth, no matter how many other instances infirm it (we will even consider these as anomalies in order to exclude them)

My conclusion (drawn through limited observations and employing inductive reasoning) is that sufficient empirical evidence to support these rules was not presented. Even if they had had done so, do not mistake it for the one an only truth (remember the Black Swan). Remain skeptical and try a hypothesis several times before you become convinced.

Being software developers you should know that there can be more solutions to a problem. As a perfect example of this is the Gang Of Four book that just gives you some solutions to a handfull of problems. You have a choice of which one to use and the book presents advantages and disadvantages to using each of those solutions - these came from real world experimentation. I don’t see advantages and disadvantages listed in the SOLID principles; I don’t know how good they are and if they mitigate the risk of bad design!

On a different note, if everyone would be following a set of rules, is there sufficient room for innovation?

Nice article, reminds me of this nonsense

http://www.ssw.com.au/ssw/Standards/Default.aspx

My personal favorite:

http://www.ssw.com.au/ssw/Standards/Rules/RulesToBetterPA.aspx

Ferengi nirvana!

in ‘agile software development’, bob specifically states that the SOLID principles are not prescriptive rules for developing your software. nobody in their right mind builds software that aims from the start to adhere to the interface segregation principle, for example. the point is that these principles often help when your codebase is getting intractable - when you need to add/modify some functionality and it’s harder than it should be. at that point, a newb thinks ah well, i’ll just hack it and ends up making the codebase even worse; an experienced and capable dev thinks how can i change this code so that it is more receptive to the idea of change? and then refactors. that’s when it often helps to think in terms of the SOLID principles and various design patterns that can improve the flexibility and longevity of your codebase.

I agree that you shouldn’t be a Ferengi programmer as you describe it, but I’ve never met one. Which makes me wonder whether we’re actually disagreeing about something else.

@Mike G

SOLID is a set of OO design principles, not rules, and while I agree with your points of philosophy and science and induction, they really don’t apply here. Yes, it is a problem, if people think these principles are some kind of universal truth, but that is hardly something to blame on a set of principles, is it?

The SOLID principles, while collected in the written work of Robert C. Martin, are not the experience of him alone. Robert C. Martin is just one of the guys who captured and described it. You can pick any textbook on OO design, and be able to see the same experiences and principles laid out there, just described in a different way. SOLID has become popular exactly because they boil down to the essential principles with which you can judge the quality of a design. These principles are gathered from many people over many years. Dismissing experience with an argument about missing empirical evidence is just far off, e.g. you don’t argue about missing evidence when a craftsman criticises another craftsman based on good craftmanship which is the experience of the trade as a whole gathered together over the years.

I also suspect alot of people missed the point that these principles really are just OO elaborations on the good old (familiar?) design principles coupling and cohesion. Is it really that difficult not to recognise this?

SOLID principles are not patterns either, so there is no discussion of advantages and disadvantages of course. You don’t need much experience to judge the quality of the principles yourself. They are about what makes a good OO design, not so much about how to mitigate bad design, although you can certainly use them that way.

Principles don’t prohibit innovation, how could they? Principles don’t prohibit thinking. People can innovate and think for selves and use principles just fine without any problems, given they have been encouraged to read and think of course, but if that’s not given, you have bigger problems than using/not using some set of principles.

Jeff Atwood wants us to think about our work without getting too locked up in principles and rules. Sure, fine, I agree wholeheartedly, but he sure picked a bad example and a bad way to show it, suggesting that he’s actually thinking only very cursory about the issues, which seems so typical for blog articles, but I still think a minimum of professional courtesy is in order, rather than blatantly making a small point at the expense of solid advise and experience offered elsewhere.

As far as instructions on a paint can goes, they may have their value, probably to begin with, but I can only say that if people aren’t that prepared to read and study about what they are doing, I don’t think they should be doing it at all. This may seem harsh, but it’s not really. I don’t have a problem suggesting that a little professionalism, and a little pride in the business we’re in, is in place. Other businesses have this too, and to a much higher degree even, so I don’t think I am out of line suggesting this. That’s why it’s just so out of place to point a finger at SOLID which has nothing to do with these instructions on a paint can.

Imagine this was 1979, and Jeff had argued against structured programming and the design principles of cohesion and coupling, because the types of developers who could benefit from them aren’t a) thoughtful enough about their work to care and b) won’t read much of anything, and that instructions on a paint can to the 1979-programmer would be better in some sense, then maybe it’s more clear why it’s so out of place what Jeff is saying.

@Jeff Atwood
The types of developers who could benefit from SOLID a) aren’t thoughtful enough about their work to care and b) won’t read much of anything.

Wow, that’s a bit harsh on someone just starting out, don’t you think?

Actually, the list is shorter:

The types of developers who could benefit from SOLID
a) Any developer who doesn’t understand and apply them

What anyone writing in an OO language should be asking themselves is this:

Does *my* code live up to those guidelines? Should it? 

If the answer is yes, then they’re surely a good thing, and you can have no quarrel with them. If the answer is no - to either question - then you have some more learning to do.

@Jeff Atwood
If we treat young developers like they can’t think for themselves, then they won’t!

But it’s equally irresponsible to make them learn everything from scratch.

I’m not sure why you (and a lot of other people) can’t grasp the fact that these things are merely guidelines. There is absolutely no question that programmers need to understand and apply them. They also need to learn (possibly by guidance from better programmers) when they should not, of course. But that’s step number 2.

My own experience is that people who do not program along those lines write crappy, unmaintainable rubbish. Furthermore, those people usually either

(a) can’t tell that they are writing crap, or
(b) can tell, but come up with excuses like the customer made me do it, or developers need to think for themselves (no, this isn’t the first time I’ve heard that excuse) in order to deflect attention away from that fact

There is no downside to good design, people. It doesn’t take longer to write good code than bad (it’s usually quicker, both upfront and in the future). It doesn’t take longer to write (sensible numbers of) unit tests - you’ll get a payback in a matter of days, I promise.

Stuff like SOLID, design patterns, unit testing, refactoring etc are the basics of your profession, every bit as much as knowing about programming language constructs, or algorithmic complexity. You cannot be a competent developer without this knowledge and the skill to apply it.

Responded here : http://blog.dhananjaynene.com/2009/02/an-experienced-programmer-doesnt-use-solid-as-a-checklist-he-internalises-it/

@Petar Repac: It seems that what are you saying is read few instructions and go code, and learn on your mistakes.I agree that we all learn by doing and learn on our mistakes and get more experienced.

As Jim Horning said, Good judgment comes from experience. Experience comes from bad judgment.

Not exactly what I expected to read at coding horror Jeff. I have been reading your posts for a couple of years now and found your thought process quite sensible.

  Not this time though. There are far too many blokes, seemingly intelligent otherwise, who beleve the only things you need to learn about programming are looping constructs and conditional statements. I have had the misfortune of having had to maintain some really complex systems built this way. Learning the principles, are a must.

One thing that I think about when we as programmer are bending the rules is that it’s a bit like genetic mutation. A lot of times nothing happens and nobody cares. Sometimes something bad happens. But much more interesting are the times when a mutation happens and something good happens. If we play by the rules 100% of the time we’ll never have a chance of encountering a good mutation.

John

This type of discussion, or more appropriately disagreement, says a huge amount about our industry. While everyone is focused on who is right and who is wrong, I think the underlying truth is far more relevant:

I agree. I was a bit a hesitant at first but I now I am convinced by just reading the comments here. I made up my mind. I think I’ll start writing my own methodology too so that I can:

  1. sell my idea to developers
  2. be popular on the web
  3. be an author of religious books
  4. get very high paying consulting jobs

…developers these days doesn’t know how THINK, yeah, that’s the name of my methodology/technigue/principle/guideline or whatever. My THINK methodology doesn’t require for paid training or using tools. It only requires developers to use common sense.

Oh, and it doesn’t require 100 years of experience too. :stuck_out_tongue:

I think people are missing the point of what Jeff was trying to say. He didn’t say never use them. He’s saying they shouldn’t be a hinderment to development. It all comes down to academic theory and real life practice.

Personally I try to endever to the principles when I can, although I abhor engineering for engineerings sake. Sometimes you don’t need a sledgehammer, when a pin hammer will suffice. And not all projects need engineering the the n-th degree, a lot of times, the KISS principle should override all.

I believe in unit tests, although I practice what I call Test-After. At a certain point in a developers life, you can code most requirements with very little defect introduction and test first or test driven slows the process down. IMO, going in after the fact and proving that the code you just wrote is defect free allows for a lot greater freedom in refactoring and edge condition testing but doesn’t eat up as much time, refactoring your refactors. But at the same time, I’ve had 100% code coverage and had huge defects due to poor requirements and/or upstream services providing faulty data outside of my control.

I’ve worked at places where they’ve taken the principles to the N-th degree. Where it was the religon and if you didn’t drink the coolaid, you were in trouble. They required 99.999% code coverage on everything that could be coveraged, at the time of checkins. Clover reports were generated on EVERY check in, by EVERY developer (They would sometimes get queued for hours and you wouldn’t get reports till the next morning.)

Code reviews were done randomly and you were questioned why you didn’t use this princlple here or why you didn’t see that you could use that principle there. What Pattern you were using and why and why any other Pattern wasn’t choosen.

It made development a chore and I love to code. But when you are more worried about what Pattern, Principle and your code coverage, instead of the quality of your code. Make the code work any way you can and as you go in later to test and refactor you can apply a lot of the principles where needed, when you need them, but you don’t have to live by them.

My rules:

  1. Understand the principles that others prescribe.
  2. Throw those principles out.
  3. Make your own set form the principles that make sense.
  4. Don’t ever stop refactoring the way you approach your craft.