26 Apr
2009

There is no right way

I get this question a lot when talking about a particular technology or pattern: “What is the right way?”  I get this with an expectation that there is always one solution that is the correct answer.  Are we all studying for a test?  There is no RIGHT WAY.  There is no “One True Solution”.  There is no “This will be correct for all time”.  Please get over it.

There are right ways (notice the plural), there are better ways (notice the plural), and there are bad ways (of course this is plural, you all no that).  If you want further examples of this at work, just look at the recent set of posts between Greg Young and Ayende on how to make a repository.

http://ayende.com/Blog/archive/2009/04/17/repository-is-the-new-singleton.aspx

http://codebetter.com/blogs/gregyoung/archive/2009/04/23/repository-is-dead-long-live-repository.aspx

http://ayende.com/Blog/archive/2009/04/23/night-of-the-living-repositories.aspx

http://codebetter.com/blogs/gregyoung/archive/2009/04/24/more-on-repository.aspx

http://ayende.com/Blog/archive/2009/04/26/the-repositoryrsquos-daughter.aspx

I think I got those in order.  Here is the deal: they are both right for their particular situation.  Both have very good reasons for doing things the way they are, and both are probably correct for what they were doing.  Greg is actually very good at saying things like “yes, this is a good pattern, but please don’t use it in that context” (that quote is an out of context paraphrase). 

This isn’t just about design patterns or algorithms btw.  This applies to just about everything you do.  Technology stacks, design, architecture, , project management, planning, scrum, childcare, and lawn care.  If you have multiple kids, you know that every kid is different, requiring different approaches and handling.  One takes a timeout, the other needs their allowance docked.  Same goes for your code.  What is correct in one situation may not be best in the next.  Development requires nuance and wisdom.

So what do we have for you?  A long list of things not to do.  Stuff like: don’t use DataSets, ViewState can be evil, GOTO causes your brain to rot, and don’t have 500 lines of Ado.Net code inside of button clicks to update your view. Read TheDailyWTF for more.  What we have now are a long series things that are better than that.  Unit Testing is good, BDD is better, Agile is better than Waterfall, layers will help make code manageable, ORMs are better than raw SQL and Ado.Net.  But all of those are just better.  They are still not ultimate truth by a long shot.

So instead of asking “What is the right way?”, take a step back and ask, “Is there a better way?”  There probably is.

Find me

RSS
Facebook
Twitter
LinkedIn
SOCIALICON
SOCIALICON

Disclaimer

The opinions and content expressed here are my own and not those of my employer.