There was a little brouhaha recently about some comments Joel Spolsky made on our podcast:
Last week I was listening to a podcast on Hanselminutes, with Robert Martin talking about the SOLID principles. (That's a real easy-to-Google term!) It's object-oriented design, and they're calling it agile design, which it really, really isn't. It's principles for how to design your classes, and how they should work. And, when I was listening to them, they all sounded to me like extremely bureaucratic programming that came from the mind of somebody that has not written a lot of code, frankly.
There's nothing really objectionable about Bob's object-oriented design principles, on the face of it. (Note that all links in the below table are PDFs, so click accordingly.)
| The Single Responsibility Principle | A class should have one, and only one, reason to change. |
| The Open Closed Principle | You should be able to extend a classes behavior, without modifying it. |
| The Liskov Substitution Principle | Derived classes must be substitutable for their base classes. |
| The Dependency Inversion Principle | Depend on abstractions, not on concretions. |
| The Interface Segregation Principle | Make fine grained interfaces that are client specific. |
| The Release Reuse Equivalency Principle | The granule of reuse is the granule of release. |
| The Common Closure Principle | Classes that change together are packaged together. |
| The Common Reuse Principle | Classes that are used together are packaged together. |
| The Acyclic Dependencies Principle | The dependency graph of packages must have no cycles. |
| The Stable Dependencies Principle | Depend in the direction of stability. |
| The Stable Abstractions Principle | Abstractness increases with stability. |
While I do believe every software development team should endeavor to follow the instructions on the paint can, there's a limit to what you can fit on a paint can. It's the most basic, most critical information you need to proceed and not make a giant mess of the process. As brief as the instructions on a paint can are, they do represent the upper limit of what most people will realistically read, comprehend, and derive immediate benefit from.
Expanding from a few guidelines on a paint can into a detailed painting manual is far riskier. The bigger and more grandiose the set of rules you come up with, the more severe the danger. A few broad guidelines on a paint can begets thirty rules for painting, which begets a hundred detailed principles of painting..
Pretty soon you'll find yourself believing that every possible situation in software development can be prescribed, if only you could come up with a sufficiently detailed set of rules! And, of course, a critical mass of programmers patient enough to read Volumes I - XV of said rules. You'll also want to set up a few messageboards for these programmers to argue endlessly amongst themselves about the meaning and interpretation of the rules.
This strikes me as a bit like Ferengi programming.
The Ferengi are a part of the Star Trek universe, primarily in Deep Space Nine. They're a race of ultra-capitalists whose every business transaction is governed by the 285 Rules of Acquisition. There's a rule for every possible business situation -- and, inevitably, an interpretation of those rules that gives the Ferengi license to cheat, steal, and bend the truth to suit their needs.
At what point do you stop having a set of basic, reasonable programming guidelines -- and start being a Ferengi programmer, an imperfect manifestation of the ruleset?
Like James Bach, I've found less and less use for rules in my career. Not because I'm a self-made genius who plays by my own rules, mind you, but because I value the skills, experience, and judgment of my team far more than any static set of rules.
When Ron says there is an "absolute minimum of practice" that must be in for an agile project to succeed, I want to reply that I believe there is an absolute minimum of practice needed to have a competent opinion about things that are needed -- and that in his post he does not achieve that minimum. I think part of that minimum is to understand what words like "practice" and "agile" and "success" can mean (recognizing they are malleable ideas). Part of it is to recognize that people can and have behaved in agile ways without any concept of agile or ability to explain what they do.My style of development and testing is highly agile. I am agile in that I am prepared to question and rethink anything. I change and develop my methods. I may learn from packaged ideas like Extreme Programming, but I never follow them. Following is for novices who are under active supervision. Instead, I craft methods on a project by project basis, and I encourage other people to do that, as well. I take responsibility for my choices. That's engineering for adults like us.
Guidelines, particularly in the absence of experts and mentors, are useful. But there's also a very real danger of hewing too slavishly to rulesets. Programmers are already quite systematic by disposition, so the idea that you can come up with a detailed enough set of rules, and sub-rules, and sub-sub-rules, that you can literally program yourself for success with a "system" of sufficient sophistication -- this, unfortunately, comes naturally to most software developers. If you're not careful, you might even slip and fall into a Methodology. Then you're in real trouble.
Don't become a Ferengi Programmer. Rules, guidelines, and principles are gems of distilled experience that should be studied and respected. But they're never a substute for thinking critically about your work.
The nice thing about all of the programming rules is that there almost always one that fits what you really want to do. Of course following that rule may break several others!
The way I see it the analogy of having a garage full of tools, just allows me to pick the tool I want. If I have just a few tools, well you can pound in a screw with a hammer, but a screwdriver works better, and a screw gun works even better then a screw driver.
You do have to learn to recognize which problems are screws and which are nails.
I think We stretched this analogy about as far as it will go.
Jim C on February 11, 2009 1:01 AMJeff,
I am wondering how you jumped from principles to rules. Rules are usually only good for beggining developers, or anything really. Principles are deeper. When you run into a situation in which you have no prior experience what do you use? Guess work seems a little hackish too me. I always fall back on first principles. Without principles how is one to improve and further the practice? Experience and talent only get you so far. Without principles one can not stand on the shoulders of giants (Parnas reference).
Mike Polen on February 11, 2009 1:02 AMAlso, don't become an Amish Programmer.
Robert S. Robbins on February 11, 2009 1:43 AM@Andrew:
That being said, if you can't see the ROI on unit testing, then you are not acting like a professional. The one instance I will conceed is if you own your own company and design your code for interal uses, but if you are working for a in a development capacity, you should be developing good code that is maintainable, that is one of the reasons they pay us the big bucks.
Ah, if the ideal world we all pine for could only exist. Have you ever tried to explain to upper management, a non-technical supervisor, or a client, the value of maintainability? Of testing? Of documentation? Of best practices (whatever you take them to be)? Or even something as basic as clearly writing down requirements before starting development? (Rhetorical question; I've no doubt you've been in those shoes.)
They're always all for it, as long as it doesn't take any more time or cost any more, in the short term. But they never get it beyond that. A developer is generally given a vague set of requirements, which must be met within an arbitrary timeframe and budget. I can't recall how many times I've pleaded with the decision-maker to allocate more resources for testing before deployment. Not once have I ever gotten it.
So, as a professional, I do what I'm being paid to do: get the job done within the constraints given me. That's all the people paying me care about. If I fail at that, then I'm unprofessional in their eyes. They don't give a hoot about whatever principles or philosophy I use to get the job done.
In practice, that often means throwing out a whole lot of things I really want to do, like unit testing. So, should I be professional in the eyes of you or other experts, or in the eyes of whoever is handing out the bucks? I'll take the bucks. If I've done my best to explain what I think to the client, and they ignore it, then I've done all I can to be ethical and professional, other than delivering the expected result. It's their responsibility to factor in all the variables I know nothing about and set deadlines and budget, not mine. Similarly, it's their fault if problems arise later (as they invariably do.)
Of course, I get blamed anyway. As long as they pay me, I don't care. It's part of why they pay me the big bucks (to deliver as expected, AND to be a scapegoat!)
Rules, principles, methodologies, silver bullets, etc. are only relevant to me if they help deliver. That is often the case, sometimes, for some of them. Other times, as in my previous posts concerning inexperienced programmers, that is definitely NOT the case. I wish I could work with guys like you, and the others here touting SOLID, TDD, Agile, etc., who actually understand this stuff already, without requiring years of (time-consuming, expensive) handholding. In practice, I don't (news flash: good developers in short supply).
You do understand, don't you, that you all are the exceptions?
Jeff R. on February 11, 2009 1:50 AMYou want to know how to paint a perfect painting? It's easy. Make yourself perfect and then just paint naturally. -- Robert Pirsig, Zen and the Art of Motorcycle Maintenance
I can't help thinking that a lot of this business about design rules is just misguided -- you need to have a feel for design, and I don't think it can be taught. Some people have it, some don't. The ones that do can get better at it by practice, but for the most part I doubt that the people who are really good at this stuff have spent much time memorizing rules.
Do you think that Jonathan Ive (designer of the iPod: http://en.wikipedia.org/wiki/Jonathan_Ive) has books full of rules in his office that he consults all the time? Somehow I doubt it.
BillAtHrst on February 11, 2009 2:00 AM@Jeff R et al
Please don't confuse the principal with the implementation of the principal. The SOLID principals are sound...the difficulty in making them happen is your own creation.
SINGLE RESPONSIBILITY - DON'T MAKE A BIG BALL OF MUD.
OPEN CLOSED - DON'T MAKE A THING THAT CAN BE INADVERTANTLY TROUNCED BY ANOTHER THING.
LISKOV SUBSTITUTION - WHEN POSSIBLE MAKE THINGS MODULARLY SO YOU CAN CHANGE LESS LATER.
INTERFACE SEGRATION - DON'T MAKE A CLIENT DEPEND ON INTERFACES THEY DON'T NEED.
DEPENDENCY INVERSION - DON'T MAKE SOMETHING CONCRETELY DEPENDENT ON SOMETHING ELSE, RELY ON ABSTRACTIONS
Those make sense...which pattern you chose, how you actually get it done are language issues and shouldn't be confused with the difficulty of understanding the principal..which I disagree with you, they can be taught in minutes...the how might take longer if they don't know the common pattern solutions, but that's a seperate issue.
And again...like has been said...they are principals not rules. A subtle but important distinction.
For my money SOLID principals fall into the same camp as Write the code as though the guy who is maintaining it is an axe murderer who knows where you live.
http://www.codinghorror.com/blog/archives/001137.html
http://www.codinghorror.com/blog/archives/000610.html
I'm currently working on an ASP.NET MVC based product (read: site) and after hearing/reading many of blog posts about this rule, that rule, this idiom. I thought that for a new project I'll try to follow them. After about 3 weeks of coding I feel like I had gotten nowhere and everything was just so over-complicated. Then it hit me...
I'm experienced, I've been programming since my Commodore 64 and QBASIC. 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.
I completely agree with what you said Jeff. I just hope others finally realize like I did that these rules really only hold back the experienced programmers.
Chad Moran on February 11, 2009 2:03 AM@Ryan:
they are principals not rules. A subtle but important distinction.
I see the point several of you have made about the difference. It's a good point. I'll have to think about that, and on how to use the terms more precisely. Learning something new every day.
Jeff R. on February 11, 2009 2:07 AMFerengi in Hindi means white guy.
V on February 11, 2009 2:12 AMRules/Principles are not in themselves bad. Used wisely, they make life easier.
People who form a naive and concrete fixation on the one true way based on parroting but not really understanding said rules - often forming a circle and parotting the rules together around a great big whiteboard - that's bad.
The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts.
- Bertrand Russell
I agree with you about the importance of not become in a Farengi
But thsi quote is a really bad moment
Quality Doesn't Matter That Much
You cannot say in any proffesional context and not to expect to be hardly criticized
@chad
The irony is that you are probably using this principals, but by another name. The goal of them is to get to that flexibility you mentioned. If you know the principal as another thing in another shape and form...good on ya.
I think it's a common trap for beginner and experienced a like to try to take a 'new' concept and apply it too liberally and rigidly.
Ryan on February 11, 2009 2:22 AMThis is such a strawman.
sean on February 11, 2009 2:33 AMProgramming is complicated. There are different levels of complexity though. The simple contact form that takes a few fields and saves them to a database and/or email is on the low end. It doesn't need any of the above principles. Enterprise applications with complex business rules and multiple integration points are on the other.
OOP, DDD, SOLID and other design patterns and techniques are principles that gear towards the more complex. Yes there will be dogmatic programmers that learn the singleton pattern and try to use it for everything. That's no reason to disparage the learning or use of patterns. I agree that critical thinking is still required, but Joel again has missed the point. These principles are something that help developers write better code for more complex solutions. Once they are absorbed, the developer no longer has to adhere to them as a dogmatic set of rules. They become part of him.
This goes hand in hand with Joel's statement quality doesn't matter. As others have already mentioned, that's just plain irresponsible. I think thats because joel either doesn't do much real programming anymore, or he just hacks crap together. Quality does matter. I'm stuck maintaining a very low quality application that could use a few of those patterns and principles, and the lack of quality costs the client money, money, money.
How do you write higher quality code? By learning principles and practices that other, more experienced developers discovered before you. Same as any other industry.
Bureaucratic programming. Please. The majority of developers do not suffer from too much design patterns, or too much SOLID, or agile, or waterfall for that matter. They suffer from whipping out cowboy code in a pure chaos environment, using simplistic drag drop, data driven, vb-like techniques.
craig on February 11, 2009 2:39 AMOMG! A Pirsig ZATAOMM fanboy posting here, followed shortly thereafter by a Bertrand Russell quoter. You guys just made my day!
Here's another from Russell, then I'm done pontificating on this thread:
The secret of happiness is to face the fact that the world is horrible, horrible, horrible.
Jeff R. on February 11, 2009 2:41 AMMaybe the issue with those that try to follow these rules dogmatically and use them everywhere is that they are trying to tackle it all at once. Start with one. See if and where that helps you. Then add another. And another. Soon you'll find the way you program has slowly changed for the better.
craig on February 11, 2009 2:43 AMI can't decide on this debate. Is there some publicly available code representing the two sides we could judge against each other? Maybe even Jeff/Joel code versus Uncle Bob code?
other wayne on February 11, 2009 3:23 AMI like Andy Hunt's view of the subject: the people who need the most context-free rules are the absolute beginners (this is from Pragmatic Thinking and Learning: Refactor your Wetware)
Dalton on February 11, 2009 3:27 AMI would be more willing to take this article seriously if Jeff and Joel could show some evidence that they actually know what these principles are. Sorry, but linking to them is not sufficient evidence.
tieTYT on February 11, 2009 3:39 AM@Jeff R.
In practice, that often means throwing out a whole lot of things I really want to do, like unit testing.
I know it sounds counter-intuitive, but you will find that you are *more* productive writing unit tests than not. You need to get the hang of it first (it takes about a week, IME), and to pick your time. You shouldn't bother with the UI (there are better tools for testing that), although you can test UI logic if you package it up right. You won't be able to test report layouts very easily either, and you shouldn't test 3rd party code (assume that database, 3rd party library, etc works).
When you next have to write something with a bit of logic, give it a try. You don't have to tell managers and clients everything ;-)
@Desmond
It's nice to see satire in action :-)
Are we forgetting the most important rule. KISS. If we keep complexity at its lower limits, our code will be both easier to maintain and run more efficient. I have seen OO designs that would have worked better as procedural code. There are other times where OO reduces complexity. There is spaghetti code out there that works wonders(just don't try to reuse). Whatever it take to Keep It Simple Stupid.
Mark on February 11, 2009 3:53 AMIt's a great idea but, there are always self important fools who think that they have to do something to help out the future generations when the best thing to do in most cases, is nothing at all.
Although geared more towards politics, this argument fits. Jefferson said it best: the government that governs best, governs the least .
Too bad there are self important fools in EVERY field of practice.
George on February 11, 2009 4:07 AMI went crosseyed trying to read that list.
Bill on February 11, 2009 4:36 AMInteresting, V, that:
Ferengi in Hindi means white guy.
Also, in Ethiopian Amharic, Ferenge means foreigner but colloquially, white guy.
Scott Hanselman on February 11, 2009 5:21 AM*If* we reached the point where programmers relied so heavily on rules that it hindered their ability to code, then yes, we would have a serious problem on our hands.
The problem is that this scenario is so laughably far from the reality of what average programmers are like that I wonder if Jeff and Joel are secretly just messing with us to see how much commotion they can stir up.
If anything, we should be *encouraging* developers to think more about their code and abide by some sort of best practices.
Kevin Pang on February 11, 2009 5:24 AMMan, you are misleading a lot of young software developers who read your blogs for advice. You can't be so irresponsible.
Minhajuddin on February 11, 2009 5:27 AMThis blog should be condensed to this. The rest was blah, blah, blah. Your getting better talking about useless crap though.
Rules, guidelines, and principles are gems of distilled experience that should be studied and respected. But they're never a substitute for thinking critically about your work.
jm on February 11, 2009 5:39 AMI get what you're saying here, but I don't think it's coming across quite right. Rules, patterns, etc, are still excellent things to learn and practice. Certainly don't follow them because you're supposed to, but because they make sense to.
A programmer might have 90% of the thought in their head and knowing about some of these proven techniques may complete that other 10% of the puzzle. Understanding techniques can save you a poop-ton of work before you code yourself in to a deep hole.
The point I *think* you're trying to make is to use your head. Make good decisions. Make educated decisions. Do what's right for the given situation.
Ian Suttle on February 11, 2009 5:40 AMSheer ignorance.
mendicant on February 11, 2009 5:44 AMWhat makes someone articulate on things like use this pattern, or follow this guideline? Some have pure thoughts, others have hidden agendas, but it all comes down to passion for their work. So having said that, let’s just let everyone express themselves and be grateful we have access to all these readings. Problem is when software houses enforce these insights as rules upon developers. It’s the failure to understand, yes that OOP is nice stuff, but can it give me that 100% CPU performance I’m looking for? Or maybe, you’re not concerned about performance but things like versioning and code reusability. Perhaps, both! Costs, schedules, discipline also get involved to make matters worse. But one must realise there are so many possibilities (a.k.a. real-world scenarios) that it would be naive to put them under a single faith.
On the other hand, the... rely-on-the-team-of-super-experienced-programmers-only is so disconcerting. There has to be another way, and there is... become a plumber!
No wonder the Java and Ruby communities think we're idiots!
dauchande on February 11, 2009 6:24 AMCowboyism strikes again. Have fun leading your little horde of outlaws, Jeff.
Jesse James on February 11, 2009 6:43 AMI value the skills, experience, and judgment of my team far more than any static set of rules
Seems shocking to me, that Jeff and Joel continue to absolve themselves while *still* clearly illustrating that they *don't understand* anything about SOLID. Not even that they are simply guiding principles.
SOLID principles are not a static set of rules. Jeff's continued ignorance in the face of learning is annoying and damaging to the community.
Please have the basic discipline to actually learn what you are arguing against before you describe it falsely and then shoot it down. Please also check out what is a 'Straw Man' debate tactic - it's clearly your favorite device.
But slavishly following the no rules mantra is also a path to failure.
I'll tell you one thing, the Gang of Four book is probably one of my most disappointing programming reads of all time. Completely useless to me. Strange that I can have a successful programming career without understanding that book...
Oh and Scott Ambler blows too.
Brian on February 11, 2009 7:30 AMYes, strict adherence to the rules is like filling your garage with a huge number of shiny power-tools. Then, for every project you do, you feel obligated to make use of all of the tools you have, in order to justify them. That's work for a few huge projects, but how do you use a nail gun when hanging curtains? Sweeping up leaves?
Extreme behavior begets extreme results. :-)
Paul.
Paul W. Homer on February 11, 2009 7:41 AMI completely agree with this post. You summed up my thoughts exactly. Strict software development methodologies are an attempt to guarantee good software using (good|bad|random) programmers.
For me, the most valuable thing a methodology offers is a common vocabulary for a team to use, so that it's easier to communicate as you solve programming problems. Beyond that, it's just one of a million different ways that code could be designed and written.
The only true indicator of success is the quality of your people. Hire really smart coders and don't constrain them any more than necessary.
Eric Z. Beard on February 11, 2009 7:41 AMI see these object oriented rules as guidelines for my design. Obviously there are some that will be followed (I'd be stupid not to) and others that won't be followed.
Brian on February 11, 2009 7:43 AMThere's nothing objectionable about his principles, you say? I can't be bothered to find out, mainly because there's something very objectionable about presenting anything as big lists of individual PDF files.
Ciaran on February 11, 2009 7:48 AMInteresting time for a post like this, because it comes at a relevant time as I am learning the adapter design pattern, which constitutes my first real foray into these things. Anyways, my thoughts on the matter are that for rules and principles, it's my opinion that you should follow them strictly at first, and then modify them as need be. They serve as a good starting point, but inevitably, in trying to apply them, you will modify or discard some or all. Eventually, you'll gain enough experience to know when a rule is applicable.
Delmania on February 11, 2009 7:52 AMGood 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.
While you don't explicitly say that what you're saying is meant to be in opposition to what Bob Martin is saying, it's implied. If you intended that, then you've probably never seen Bob speak or read his writing aside from those principles. Yes, he advocates remembering these principles and taking them into account, but that's a small part of what he advocates. The primary thing he advocates, by far, is taking responsibility for your choices and working in a professional manner. That's exactly what he's all about. The SOLID principles, etc., are just a way to help remember how to do that (in the context of object-oriented design), but I think Bob would have nothing but contempt for the idea that they could replace independent thought.
(Help! The two developers who've inspired me more than anyone -- Bob Martin and Joel Spolsky -- are fighting! What am I to do?)
JacobM on February 11, 2009 7:54 AMWhile I agree with Jeff's overall points in regards to methodology, I don't think OO design principles constitute a methodology. Like the instructions on the paint can, the OO principles are applicable and correct most of the time. The trick is having the experience to know when they do not apply, and that is often just a question of granularity (don't sweat the small stuff) and cost (don't build a Ferrari where a Chevy will do).
I don't think it's helpful to set everything up as a false dichotomy -- You either follow these principles to the letter, or ignore them! That's just not the way the world works, but I guess it makes for more exciting blogs and podcasts. :-P
Bruce Johnston on February 11, 2009 7:54 AMI have to get a chuckle when I hear we follow the foo principle of software design.
IMHO, software engineering isn't wash, rinse repeat.
Coleman on February 11, 2009 7:55 AMIt's funny to me that until I finished I pictured the Ferengi Programmer as the *good* thing to be. I was thinking that he would be an example of having rules and concepts that are generally helpful ideas but feeling free to ignore or tweak them if your experience and knowledge says it's for the best.
Josh on February 11, 2009 7:57 AMThis post perfectly illustrates the danger (yes Jeff, you *are* the most dangerous blogger on the Internets ;)) of blogging. That is, the SOLID principles are constructed in such a way to minimize many common pitfalls of software development. They help to form a guideline for building robust, easily extensible, and maintainable code that are all but proven to work toward these ends. However, as is usually the case, a blogger can come along, dispense some anecdotal perspective, and effectively nullify everything that makes SOLID, well, solid.
-m
aargh.
Harry M on February 11, 2009 8:04 AMI find lists of programming rules very helpful, but I don't actually use them.
So what does that mean? Reading and trying to understand them is helpful because it helps me distill lessons from my actual experience. It helps to crystallize and consolidate concepts I already know, but may know only vaguely and can't articulate.
I also enjoy revisiting some of my favorite rule sources -- Code Complete being a prime example -- from time to time, because the experience acquired since the last reading will always make a few previously overlooked principles jump out and shout.
But actively using them ... that's foolish, I think. No set of rules can capture the infinite landscape of constraints and trade-offs in every real project. Navigating that landscape takes experience, flexibility, and some ability, not mindless adherence to some mantra. And those mantras are absolutely useless to novices; rules and methodologies are incomprehensibly abstract without actual experience to ground them.
Jeff, I generally like and agree with what you say. On this, unit tests, and TDD you and Joel are completely off base.
SOLID is not laws. SOLID is a set of guidelines that you should be mostly following anyways, even if you don't subscribe to the latest fads in the agile community.
TDD is not about quality, that is just a pleasant side effect. TDD is about creating loosely coupled architectures, and prooving your assumptions before going off and writing massive amounts of code.
It is really easy to build straw men with this stuff, and I am not going to do that (although Joel did when he went off on TDD not that long ago). However I think you genuinely don't understand what you are talking about
Matt Briggs on February 11, 2009 8:07 AMOh boy did I agree with the comments you and Joel made. One of you used the word bureaucracy, and I thought that perfectly expressed the misguidedness of SOLID. Bureaucracy is not inherently bad. I actually like a certain amount of administrative fussiness. Bureaucracy becomes bad when its starts inflating itself for its own sake and becomes an exercise in micromanagement, the illusion of control, and (if you'll pardon the expression) a bunch of mental masturbation.
Andy Lee on February 11, 2009 8:08 AMI keep thinking of things to write about this, and coming back to one thing. Aargh.
Harry M on February 11, 2009 8:08 AMHmmmm, perhaps the comments themselves are more interesting than their content?
That so many people can make reasonable arguments on either side, implies that the target of those arguments is subjective.
Engineering, if it is nothing else, is a quantitative, objective approach to consistently building something. Art is subjective, science is not.
That leaves these comments as a testament to knowing how 'little' we know about actually consistently building software. Any group of professionals that is this highly polarized over basic issues barely belongs to anything that could (or should) be called a profession.
Paul.
Paul W. Homer on February 11, 2009 8:09 AMCould someone who actually agrees with this forum post, please give a non-trivial example of how not adhering to any of the SOLID principles leads to a better design?
Just wow on February 11, 2009 8:14 AMA VERY good article!!, thank you for your insight. I really feel a sense of relief.
regards
Jorge Diaz Tambley on February 11, 2009 8:23 AMWhen ENIAC was designed John von Numan used serial architecture for the bus.
Before the machine's bus was constructed he came up with the parallel architecture.
He realized that the machine would be far faster and cost less to construct if they switched the design from serial to parallel.
So, Johnny boy went to the Army with the proposal (ENIAC was built during war time under Army control).
The two star sitting there picked up the original (serial) spec book and showed it to von Numan stating that 'we are building this thing to spec'.
Bottom line: ENIAC was finished in time to make a significant impact on the war (atom bomb calculations among others) but if they had listened to von Numan it would have been finished sooner, at lower cost and ran faster.
So much for the rules...
In all fairness to the Army it was war time and they were greatly worried about Nazi Germany's progress on atomic weapons. Even though (unkown to them) the German scientist were so afraid of Hitler that they would not dare propose building an atomic device because the lead time was multi-year and Hitler had a very nasty habit of having people shot for being late on a project...
So what does this have to do with rules?
Too strict an eforcement of rules results in:
a. Low or no creativity
b. In extreme cases (such as the German scientists) no attempt at creativity what so ever (can you blame them?).
Good thing for us...
In that instance strict rule enforcement saved the world!
@Just wow:
Could someone who actually agrees with this forum post, please give a non-trivial example of how not adhering to any of the SOLID principles leads to a better design?
Yes: when a challenging project with specific requirements needs to be completed on deadline by a team of limited experience. In other words, the real world.
There's nothing wrong with the SOLID principles; they make sense to me. But I've been programming since the days of card readers and teletypes. They WON'T make sense to those with little experience. They don't know when or how to apply them appropriately. They get bogged down in the attempt.
So trying to follow them changes the focus from result to process. And that's deadly.
It's the job of the lead programmer or manager to see that good principles are followed, perhaps by guiding others invisibly, without explicitly mandating or even mentioning those principles.
Jeff R. on February 11, 2009 8:31 AMProgramming is bringing fluctuations to the discret all-or-nothing world of computation.
Steve Schnepp on February 11, 2009 8:33 AMThat is, the SOLID principles are constructed in such a way to minimize many common pitfalls of software development.
This reminds me of something Paul Graham wrote:
One of the differences between big companies and startups is that big companies tend to have developed procedures to protect themselves against mistakes. A startup walks like a toddler, bashing into things and falling over all the time. A big company is more deliberate.
The gradual accumulation of checks in an organization is a kind of learning, based on disasters that have happened to it or others like it. . . . It's natural for organizations to learn from mistakes. The problem is, people who propose new checks almost never consider that the check itself has a cost.
http://paulgraham.com/artistsship.html
The principles of SOLID or any big M Methodology are intended to prevent people from making mistakes. The problem arises because the cost of preventing these mistakes often exceeds the cost of the mistakes themselves. Unfortunately, corporations seem to love this sort of penny wise, pound foolish thinking.
Chris on February 11, 2009 8:34 AMReminds me a lot of Eric S. Raymond's *excellent* rules for Unix programming (except Eric's aren't teh suck). I'm not a Unix guy at all, but I keep them posted on the wall of my cube. I like how there are 17 of them, too. He didn't feel the need to make up 3 more just to have an even twenty. Anyway, here they are:
1. Rule of Modularity: Write simple parts connected by clean interfaces.
2. Rule of Clarity: Clarity is better than cleverness.
3. Rule of Composition: Design programs to be connected to other programs.
4. Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
5. Rule of Simplicity: Design for simplicity; add complexity only where you must.
6. Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.
7. Rule of Transparency: Design for visibility to make inspection and debugging easier.
8. Rule of Robustness: Robustness is the child of transparency and simplicity.
9. Rule of Representation: Fold knowledge into data so program logic can be stupid and robust.
10. Rule of Least Surprise: In interface design, always do the least surprising thing.
11. Rule of Silence: When a program has nothing surprising to say, it should say nothing.
12. Rule of Repair: When you must fail, fail noisily and as soon as possible.
13. Rule of Economy: Programmer time is expensive; conserve it in preference to machine time.
14. Rule of Generation: Avoid hand-hacking; write programs to write programs when you can.
15. Rule of Optimization: Prototype before polishing. Get it working before you optimize it.
16. Rule of Diversity: Distrust all claims for “one true way”.
17. Rule of Extensibility: Design for the future, because it will be here sooner than you think.
Derek Martin on February 11, 2009 8:35 AMRules, guidelines, and principles are gems of distilled experience that should be studied and respected. But they're never a substute for thinking critically about your work.
I've always seen these things as tools for thinking critically about your work. They are all a little too abstract to try to apply directly without any real thought, anyway.
They also provide a common vocabulary for discussing code, so you can say things like this class doesn't follow the single responsibility principle very well and other people will (hopefully) understand what that means.
Martin Cron on February 11, 2009 8:39 AM@ Jef R.
So the design that is produced by inexperienced people working to a tight deadline is better than that of one done to SOLID principles?
oh wait..
Just wow on February 11, 2009 8:40 AMThe principles of SOLID or any big M Methodology are intended to prevent people from making mistakes.
Really? Have you read them?
Seems to me that SOLID is all about fostering agility in large OO code-bases (not excluding small of course). Agility is coding is something that Paul Graham has preached over and over.
-m
So what you're saying, Jeff, is the opposite of what Martin suggests; don't use any rules v. use rules. So then your rule is to have no rules. In the end, you're both suggesting following a rule, they're just different rules.
So what's the argument about again???
Mark S. on February 11, 2009 8:47 AMMaybe what he's saying is; I only have one rule for you, and this is the only rule you should follow...
Don't follow any other rules.
:p
DrewG on February 11, 2009 8:55 AMHow would it be different if SOLID wasn't about rules, but about principles? Oh, wait, it is.
How would it be if there were demonstrably good principles that, by our understanding and awareness of when and how to apply them, made it possible for us to write software that worked better, got released faster, failed less frequently, cost less and made our customers happier?
I'm just askin'
I've only been writing software for 30 years or so*, and my understanding of SOLID doesn't get much past SOL (and I'm still a bit shakey on L) but what I do understand of it definitely helps me deliver satisfied users better than before. And isn't that really a large part of what it's all about?
(* I'm not bitter, you understand, just old and a little tired.)
Mike Woodhouse on February 11, 2009 8:56 AMBrute Force Development - a href=http://softwareindustrialization.com/BruteForceDevelopmentBFD.aspxhttp://softwareindustrialization.com/BruteForceDevelopmentBFD.aspx/a">http://softwareindustrialization.com/BruteForceDevelopmentBFD.aspx/a">http://softwareindustrialization.com/BruteForceDevelopmentBFD.aspxhttp://softwareindustrialization.com/BruteForceDevelopmentBFD.aspx/a
Uncle Bob had some valid points, but then he turned to outright insults and lost all credibility.
@Just wow
It doesn't. The point is that sometimes such rules are excessive and unnecessary. It would literally take *years* to refactor my current projects to fit these principles. The projects are working and don't have any issues. The company I work for would gain absolutely nothing, aside from maybe one problem down the road may take slightly less time to debug. This would be a terrible return on investment.
That's the point.
Practicality on February 11, 2009 8:57 AMJeff you make a good argument by backing it with the Dreyfus model but these rules that Uncle Bob advocates are really targeted at beginners and advanced beginners to practice so we can have a bare minimum of software quality. So I believe the SOLID principles are perfectly valid for being introduced to all members of these groups. As they progress to competent and expert levels it is ok for them to make more decisions about what works and what doesn't from the SOLID principles as long as they don't make negative progress. It would at the very least reduce the submissions to TheDailyWTF if everyone had a grip of these basic software design principles.
o.s. on February 11, 2009 8:58 AMI think this post can be summed up as:
I am surrounded by coding ninjas, therefore, I do not need to follow SOLID principles because my guys rock.
The funny thing is that if you looked at the code, the ninjas are probably following many of the SOLID principles anyway.
-m
@Just wow:
So the design that is produced by inexperienced people working to a tight deadline is better than that of one done to SOLID principles?
A design produced by inexperienced people trying to adhere to SOLID principles won't get done on deadline, or at all. If it does ostensibly get done, it'll be a pile of crap.
The point is, trying to fit a project into the rules, when the people don't have the experience to know how to use the rules, distracts from their actual responsibility: getting the job done.
Again, it's up to those who are more experienced and in charge, to manage things according to whatever principles apply, based on their experienced judgement. At that level, the rules are wise and productive.
It's like the dichotomy between a coach and a team. Good coaches have much deeper understanding of the sport than their players. But they DON'T try to jam that knowledge into the players and force them to follow it. That overloads the players, getting them so distracted and confused that they play worse. Instead, the good coach applies his experience on a play-by-play basis, with specific instructions to the players -- not general rules.
It would literally take *years* to refactor my current projects to fit these principles. The projects are working and don't have any issues. The company I work for would gain absolutely nothing, aside from maybe one problem down the road may take slightly less time to debug. This would be a terrible return on investment.
As long as you stay with that company forever, then you are probably correct. You've got the system figured out, so why would you ever want to refactor to the SOLID principles? And then if you leave that company, who cares anyway?
-m
@Jeff R.
In response to Just Wow's question:
Could someone who actually agrees with this forum post, please give a non-trivial example of how not adhering to any of the SOLID principles leads to a better design?
You responded with:
Yes: when a challenging project with specific requirements needs to be completed on deadline by a team of limited experience. In other words, the real world.
Sorry, your answer just doesn't make any sense. You've not shown that ignoring SOLID has produced a better design, just that in the real world often projects are designed ad hoc. What have you proven?
Let's face it, it's not like learning the individual principles of SOLID is difficult, they're easy simple guidelines. Let's take your real world example for a second, if a manager spent a grand total of 5 minutes with his/her team of limited experience programmers he/she could easily teach them one of the principles, say Dependency Injection, how is that a hard?
Maybe you aren't aware that the majority of time spent on a project is maintenance, including something as simple and trivial as Dependency Injection goes a long way in maintaining the testability of existing code.
Should every application follow every single rule of programming? No, of course not, especially if you are building a small application of limited use. But saying be your own unique snowflake, don't follow the rules has resulted in more bad code than good code, I can guarentee you that.
The point is, trying to fit a project into the rules, when the people don't have the experience to know how to use the rules, distracts from their actual responsibility: getting the job done.
You keep saying this. Presumably we are minimally talking about recent C.S. grads. What makes you think that they would not be able to understand SOLID principles? Nothing in them that I have read requires 30 years of experience to wrap my head around.
-m
This is utter nonsense. The best programmers from the '50s and '60s had little of this.
Maybe start blogging more and advertising for you and Joel less...
Pardeep on February 11, 2009 9:07 AMProgramming is not manufacturing.
It requires a thinking brain and, often, breaking the rules to arrive at a solution.
Solid principles are ingrained in quality work.
Enforcing solid principles onto programming process is like enforcing plot rules on a poorly written novel.
BugFree on February 11, 2009 9:09 AMI guess that's why they're principles and not laws. It's up to you the developer to decide, which of those principles may need to be sacrificed dependent upon what the objectives and more importantly the constraints of the project are.
If you set out to adhere to as many as possible then prioritise those, which are most useful to your business / problem domain.
Most importantly, once you've decided, which SOLID principles to follow, remain consistent.
SOLID principles are just a collective of sound OO advice collated by an articulate, talented and busy engineer over his career. I for one am glad he took the effort to write down his and other peoples observations and to come up with a mnemonic for us to remember them by.
I look forward to his guest appearance on your podcast Jeff.
Ed on February 11, 2009 9:13 AM@Fogus
Really? Have you read them?
I have read them.
@Fogus
Seems to me that SOLID is all about fostering agility in large OO code-bases (not excluding small of course). Agility is coding is something that Paul Graham has preached over and over.
Paul Graham doesn't think much of OOP in general. I think there are five reasons people like object-oriented programming, and three and a half of them are bad http://www.paulgraham.com/noop.html
@Jeff R.
It's like the dichotomy between a coach and a team. Good coaches have much deeper understanding of the sport than their players. But they DON'T try to jam that knowledge into the players and force them to follow it. That overloads the players, getting them so distracted and confused that they play worse. Instead, the good coach applies his experience on a play-by-play basis, with specific instructions to the players -- not general rules.
A good coach is constantly teaching his players and doing whatever he can do get the best performance possible out of them, so I'm really not sure where you are going with this analogy.
Let's put it this way, when I coached baseball years ago, if I noticed that a batter was dipping his back shoulder or was pulling off the ball, I'd teach him not to, and more importantly, I'd explain to him why it is bad. That is part of my job as a coach, to help him become a better player so next time he's up, he won't make the same mistakes.
Coaching on a play-by-play basis is just micormanagement to the nth degree, and in any sort of long run will fail. If a ball is hit to deep right field, my right fielder needs to know where the cut off man is going to be standing and the cut off man needs to know that with a man on second, he's going to have to get that ball to home ASAP to have a chance to get that runner at the plate. Coaching this on the fly will result in failure 99% of the time, having your players know what to do at least gives you a chance for success.
An IT manager's job is very similar. If a programmer has limited experience, you teach them how to code the right way. It might not help you on a current project that is already a big ball of mud, but it will help on future projects. That is what teaching (or coaching) is all about.
Andrew on February 11, 2009 9:19 AMPaul Graham doesn't think much of OOP in general.
Oh in that case, SOLID sucks.
-m
@Jeff R
There's nothing wrong with the SOLID principles; they make sense to me. But I've been programming since the days of card readers and teletypes. They WON'T make sense to those with little experience. They don't know when or how to apply them appropriately. They get bogged down in the attempt.
You have it backwards. If you study the Dreyfus model:
a href=http://pragmaticstudio.com/dreyfushttp://pragmaticstudio.com/dreyfus/a">http://pragmaticstudio.com/dreyfus/a">http://pragmaticstudio.com/dreyfushttp://pragmaticstudio.com/dreyfus/a
that Jeff used to justify his post then you would know that beginners or those with little experience need a recipe and rules to follow so they can start their journey to becoming experts. In short, it actually makes perfect sense to introduce the SOLID principle design rules to beginners and this is also backed up by numerous studies. It's important to also note that the rules are meaningless unless they are also accompanied by a goal.
Oops entered the comment without entering orange and the blog software clobbered the link when it tried to translate it to HTML.
http://pragmaticstudio.com/dreyfus
@Andrew
Let's face it, it's not like learning the individual principles of SOLID is difficult, they're easy simple guidelines. Let's take your real world example for a second, if a manager spent a grand total of 5 minutes with his/her team of limited experience programmers he/she could easily teach them one of the principles, say Dependency Injection, how is that a hard?
I completely disagree there. They are NOT easy, they are VERY abstract. You and I understand them because of lots of experience. Most of them won't make a dime's worth of sense to novices. And yes, they are hard to teach. 5 minutes? More like 5 years!
Why do I say this? Been there, done that. I started programming in the early 70's. Still do it frequently. Still learning new stuff every day. But have spent as much time in the last 20 years or so managing others, starting businesses that require developers, and occasionally teaching. The issue of how to get real work done with inexperienced hires is not a theoretical exercise to me -- it's a continuing challenge that affects me personally, including how many dollars are in my pocket!
But the qualifying word in this argument is inexperienced. Those who understand the principles on first reading already understood them BEFORE reading them, at least intuitively -- and that's due to experience.
So, it's ironic: the rules, formulated by the experienced to help the inexperienced, are really only understandable by those who don't explicitly need them!
I'm disagreeing with the idea that these rule lists, sets of principles, methodologies, etc. are appropriate to feed to novices, not with the rules themselves.
Later you wrote:
An IT manager's job is very similar. If a programmer has limited experience, you teach them how to code the right way. It might not help you on a current project that is already a big ball of mud, but it will help on future projects. That is what teaching (or coaching) is all about.
I completely agree with that. The important thing is to have that manager, coach -- somebody who know the ropes -- there to do the guiding and teaching, rather than expecting newbies to figure it out on their own by mandating a bunch of generalized, abstract rules.
Jeff R. on February 11, 2009 9:43 AMRight, software is not like manufacturing. It has more in common with building architecture, which has a set of principles that architects use in *most* cases.
I think this is the mistake that Jeff is making, confusing Principles and Rules. If as a discipline we can't say we have Principles that guide how we do our craft then how do we even talk about what it means to be a good developer. How do you judge a good developer? Just because some geek can hack a linked list doesn't mean anything. But Principles aren't rules. Principles are guding lights. Rules are rigid do's and don'ts. If you go against a Principle, there is a high liklihood you are wrong, but there are cases.... If you go against a rule, if it really is a rule, you are always wrong.
The SOLID principles have been discovered over many years of collective developer experience. It makes no difference to me that the best programmers of the 50's and 60's didn't have these principles. I don't use punch cards. I use C# or java, or python. Would a building architect ever speak of architectural design principles as bureaucratic? Would you hire one that did? He might be able to satisfy you once, but how reliable will that architect be ignoring all the principles of his craft?
But, they are principles, and when I have good reason to, I go against them. I don't need good reason to go with them, but I do need good reason to violate them.
jeff on February 11, 2009 9:48 AMThey are NOT easy, they are VERY abstract. You and I understand them because of lots of experience. Most of them won't make a dime's worth of sense to novices.
Exactly. Beginners should focus on things like which data structures to use when, basic algorithmic ideas, and how to use revision control and development tools effectively.
How many applications are going to require a pure interface anyway? Seriously, it seems like every Java developer goes through a stage where everything is an interface. Until they realize that's not necessary 99% of the time.
These are good best practices to know and understand. But I don't think they are beginner concepts in the slightest.
asdf on February 11, 2009 9:53 AM@Andrew:
Coaching on a play-by-play basis is just micormanagement to the nth degree, and in any sort of long run will fail. If a ball is hit to deep right field, my right fielder needs to know where the cut off man is going to be standing and the cut off man needs to know that with a man on second, he's going to have to get that ball to home ASAP to have a chance to get that runner at the plate. Coaching this on the fly will result in failure 99% of the time, having your players know what to do at least gives you a chance for success.
By the way, I agree with you there and understand the point. I think what you've done there is flesh out my skeletal analogy with more nuance. In other words, you overturned my generalized rule with a specific, real-world counterexample! Which is another reason to not slavishly follow rules -- they're too brittle and lacking in nuance to apply all the time, but others here have made that point well already.
Jeff R. on February 11, 2009 9:57 AMMy opinion on this topic is:
Rules are good only if they tell people what *NOT* to do and also explain *WHY NOT*. They are bad if they try to tell people *WHAT* to do or *HOW* to do it.
If rules tell me what I must do (or how I must do it), they take away my freedom more than anything else. They pretend I'm a stupid moron, incapable of making my own decisions. They force me to do something or do it in a certain way, even though every fiber of my body may tell me it's wrong, just plain wrong.
On the other hand, rules that tell me not to do something may sometimes be necessary. Laws work like that most of the time. Or at least they should work like that. Most laws don't tell you what to do (though these exist as well), but they make up a very long list of things you must not do. Of course this limits your freedom as well, but if a rule says Don't do it that way ..., it still leaves me the freedom to go for any other way I want, as long as its not that way. This is much more freedom than saying Do it exactly that way ..., which leaves me no freedom at all.
And finally, a rule without a justification is just harassment. If I ask somebody Why shouldn't I do that? and the reply is Don't ask stupid questions, just don't do it, okay?. Then this is no reply and the rule is bullshit in my eyes. I can understand why there is speed limit on streets that are in the middle of a residential subdivision or pass a school or kindergarten. It makes sense to put a speed limit there for all kind of reasons. A road that goes somewhere through the middle of nowhere, is absolutely straight, you can see 2 miles in every direction, it has hardly any traffic, no woods, no animals, but it has a very restrictive speed limit - bullshit. There is no justification for it. Leave it up to the driver to judge the situation: Taking into account his driver skills, the condition of his car, the weather, etc. he should be able to make a reasonable decision on how fast one can go and if goes to fast and dies in an accident that could have been avoided at lower speed, well, things like this happen. You can't put the whole world into cotton to prevent that anybody will ever die again because he made a mistake. People make mistakes and some are fatal.
Mistakes in software development are rarely fatal, so it is okay to allow people to make mistakes. Just set up rules if you can justify them, if you can explain why somebody should not do something when getting asked. If this justification is *sound*, the person will understand it and won't have an issue following that rule.
Mecki on February 11, 2009 10:01 AM@Jeff,
I completely disagree there. They are NOT easy, they are VERY abstract. You and I understand them because of lots of experience. Most of them won't make a dime's worth of sense to novices. And yes, they are hard to teach. 5 minutes? More like 5 years!
Come on now, you're just being silly at this point. 5 years to understand one principle of SOLID?
There are some horrible developers out there, and since the IT industry pays so well, I'm sure that will never stop. So I will freely admit that there are people out there who are practically unteachable. But how often do you give important new development to those people? Almost never.
A lot of development these days is maitaning and enchancing existing applications. If an application was designed right in the first place, it's actually very easy for any developer to follow the existing structure. They don't even need to know why they are passing in IDataStore in the constructor of a class, just that it's the way it's done. Doing it differently would actually be more difficult, so they could churn out good code all day long and not even know it, throw in a code review here and there, and they might even learn something.
Andrew on February 11, 2009 10:03 AM@jeff
I think this is the mistake that Jeff is making, confusing Principles and Rules.
I don't think that Jeff is the one making this mistake. An awful lot people, especially novice coders and clueless managers, latch onto the rules of some Methodology and treat them as holy writ, even if the Methodology calls them guidelines or principles. This is the problem with Methodologies. People with little experience tend treat them as hard and fast rules, while people with enough experience to treat them as guidelines are usually experienced enough to do the right thing without having to consult the Methodology.
Chris on February 11, 2009 10:06 AMNever forget that They're Just Rules:
http://www.xprogramming.com/Practices/justrule.htm
http://c2.com/cgi/wiki?TheyreJustRules
The irony being... rule questions make up a huge portion of the stackoverflow site.
My beef with rules or best practices is, is that some people may read about a best practice, (a square), and then fit that best practice into their task at hand (a circle).
theman on February 11, 2009 10:10 AMYoung Mr Atwood,
You say:
When Ron says there is an absolute minimum of practice that must be in for an agile project to succeed, I want to reply that I believe there is an absolute minimum of practice needed to have a competent opinion about things that are needed -- and that in his post he does not achieve that minimum.
Ron Jeffries is hugely more experienced than you at this stuff:
http://en.wikipedia.org/wiki/Ron_Jeffries
I've conversed (on a mailing list) with the man, and he really does know his onions.
On the other hand, there are a few people who come out of the woodwork every time some sort of software engineering topic is mentioned. In particular, things like the SOLID principles and design patterns and so on get them all hot and bothered.
If anybody doesn't think those things are worthwhile, then what they're really saying is that it is possible to write good code without understanding what good code is. Be a bit of a fluke if they did, IMO.
I used to wonder how people could possibly object to this stuff (although I've seen enough poor code to know that not many people take any notice of it).
Then I read about the Dreyfuss model, and that seemed to be a possible explanation. Have a read of chapter 2 of Pragmatic Thinking and Learning, then read Jeff's blog and the comments, and see what you think. I reckon the second-hand incompetence stamp could be used fairly freely :-)
It's kind of worrying thinking about your self image, too, after that chapter.
To those who have a problem, I would say that these things really do only seem prescriptive up to a certain level of skill. Beyond that point, they become more internalised and intuitive. Eventually you may move beyond them and become a thought leader yourself (although don't expect many of us - myself included - will ever be that).
Personally, for some years I've used questions about these topics to sort out who to employ. I don't care if someone can write a regex off the top of their head. I do care whether they can write, or have the potential to write, good code*. To me, that means they have to have thought about how to do that.
*Actually, now that I think about it, being able to write a regex off the top of your head might be a strong contraindication :-)
Odd to hear Bob Martin's SOLID railed against as if it were a Methodology (big-M). I have been around for a while, and there were originally over 11 important principles (and no methodology, by the way). Here is a promotion of the five most design-oriented principles, and explanations of how they work.. and so this is a Big-M Methodology with a lot of subrules and strictures and creativity-killing, brain-numbing requirements?
Mind you, there is an agile methodology, but it basically boils down to test your stuff as you write it, have short iterations, work together, and keep track. It even includes 'retrospectives', whose entire purpose is to let the team choose how it is going to work together. I lived through SDLCs and RUPs and Structured and you-name-it. Agile is the anti-methodology.
This whole series of strawman-bashing posts here is too silly to swallow.
@asdf,
I feel the exact opposite to be honest. Knowing what structure to use, how to connect to a database, the difference between an Abstract Class and an Interface, etc. (you know, the basic interview questions people as developers) are all available on google.
Give me an inexperienced young developer right out of college who understands how to build an application over an experienced developer who is responsible for developing horrible, unmaintainable applications any time.
Andrew on February 11, 2009 10:14 AMYour mother is a Ferengi!
CynicalTyler on February 11, 2009 10:14 AM@Jeff R.
Sorry, it's not my fault you gave a horrible analogy. ;)
Andrew on February 11, 2009 10:15 AMI regard OO rules as a dictionary of terms for explaining what I'm doing.
Lev on February 11, 2009 10:17 AM@Jim Cooper
The text you quoted isn't by Jeff Atwood, it's from a blog entry by James Bach (http://www.satisfice.com/blog/archives/174) that Jeff is quoting.
Better design is better design.
If in your real life your real boss tells you to make it fast and ugly, or you have any other reason to sell better design for something else - do it. That does not make better design worse.
If you do not understand how to make better design, it does not make it worse. If you can not get benefit from better design - it does not make it worse.
For me those principles are just to know them and do what I think is appropriate. Very often I think following them is a good idea. Following them blindly is like following any rule blindly.
Actually SOLID is not that hard. It does not take much time to extract interface for client. It does not take much effort to depend on abstraction, etc. And it gives you fine grained control over your code, which I think is very agile.
Macloud on February 11, 2009 10:21 AMIf you know someone who reads the book and immediately follows everything in it without any doubt - I hope that's a girl :) I know few good principles for her.
I've never thought about any book as something that limits my freedom to develop software how I think it should be developed. And for junior who thinks that everything in his program needs to be in one static method of one class - those principles are a good start to try thinking in different way. That's what books are for, to let you think in different way.
Macloud on February 11, 2009 10:28 AMJeff .... for the principles involved (Bob Martin, You/Joel), how about this .... have the programming community come up with a project (nothing too involved, but enough to exhibit one's programming methodology) and you guys code it (Jeff and Joel can work together since they see eye-to-eye on this). Display the finished projects on the web so that everyone can look at the code and make their own judgements about which one is better (more readable/maintainable/extensible/etc.) - even let us vote on it and show the results publicly. I think this would be better (and more educational for all involved) than these endless theoretical tiffs.
Chris adf471587879rzq on February 11, 2009 10:40 AMThis is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
| Content (c) 2009 Jeff Atwood. Logo image used with permission of the author. (c) 1993 Steven C. McConnell. All Rights Reserved. |
Posted by: |