Habit 6: Reuse Is For Wimps

Today’s Habit is brought to you by the letter “R” and the number 1.

Seven Habits of Highly Dysfunctional Enterprise Developers:

  1. Blame Everyone But Yourself
  2. Confuse Motion With Action
  3. Use Complexity To Demonstrate Intelligence
  4. Keep Important Information Secret And Safe
  5. Fix It Later
  6. Reuse Is Overrated
  7. Principles Are More Important Than Results

Reuse Is For Wimps

recycle
Not Just For Plastic, Glass and Cans

Feeling that urge to rewrite qsort?  Convinced you can write a better Hibernate than Hibernate?  Positive that there is no XML parser out there that will suffice for your project?  Um.  Put down that Erlang compiler a sec and listen.

I completely understand why these urges come up.  We love to solve problems.  And sometimes, writing a billing application isn’t nearly as fun as say, creating a custom persistence layer that converts XML to binary ZIP and inserts it into a BLOB in the database.  But you won’t get a promotion because you reinvented the GOTO in your custom Haskell extension.  You might get a promotion because you shipped a working product on time, under budget that delighted your customers.

The goal of every software project is to launch.  Anything that gets you to launch quicker is good.  Previously developed libraries, even beta-grade ones, can be a win for you and your team.  That’s not to say you should create a Frankenapp by bolting every Open Source project together within reach.  But making judicious use of the right technologies can substantially reduce your time to market.

The one (and I do mean ONE exception) is creating something that is part of your core competency.  If you’re Intuit, then accounting software is your core competency and you’d better write some cool 401(k) prediction algorithms to help people use Quicken more effectively.  But what about a web framework?  Intuit isn’t in the business of creating frameworks.  Should they write a brand new one?  Probably not.  Understand what you’re in the business of doing, and write THAT.  Find help for everything else, as much as you can.

Habit 5: Fix It Later

We examine the power of procrastination in today’s post, and why you should never underestimate the impact on your future.  If you missed the early habits, they’re linked here:

Seven Habits of Highly Dysfunctional Enterprise Developers:

  1. Blame Everyone But Yourself
  2. Confuse Motion With Action
  3. Use Complexity To Demonstrate Intelligence
  4. Keep Important Information Secret And Safe
  5. Fix It Later
  6. Reuse Is Overrated
  7. Principles Are More Important Than Results

Fix It Later

How many times have you said to yourself,

“Bah…I don’t have time to do that now.  I’ll fix it later…

bug_costs
Anything is More Believable When It's Graphed

Yeah, I thought so.  I do it too.  But a disciplined developer will stop right then and there, think about the future cost of that mistake and then correct it on the spot.  It’s the difference between knowledge and wisdom.

Comp Sci majors are taught from basic coursework (usually in their ONE software engineering capstone course, sadly) that the cost of fixing errors goes up non-linearly as you move forward in a project to later phases–fixing a bug in the requirements during say, design, is cheaper than fixing the same bug in production.  A practiced engineer will apply that knowledge to fix problems BEFORE they get into the next phase by proactively understanding the consequences now and altering the course of history.

The temptation (and sometimes the stick that is whacking you on the backside) is to say you don’t have time because of The Schedule.  The Schedule will always be there.  You’ll almost never work on an open-ended project with infinite time to “get things right.”  You will have to ship, eventually.  That comes with compromises.  We defer changes out of fear.  Fear of impacting others.  Fear of being wrong.  Fear of having more work to do.  What’s that you say?  “I’m the exception!  I can’t just go changing that class because it’s already in production and I don’t know what it will break.”   Thank you, that’s the point.  THAT bug made it to production because someone said, “I’ll fix it later.”  So fix it now.

Habit 4: Never Share Information

Lessons from Lord of the Rings, why you really did learn all you needed to know in Kindergarten and the value of opening your kimono.

Seven Habits of Highly Dysfunctional Enterprise Developers:

  1. Blame Everyone But Yourself
  2. Confuse Motion With Action
  3. Use Complexity To Demonstrate Intelligence
  4. Keep Important Information Secret And Safe
  5. Fix It Later
  6. Reuse Is Overrated
  7. Principles Are More Important Than Results

Keep Important Information Secret And Safe

All that knowledge you’ve worked hard to acquire over the years…it should be jealously guarded, like a treasure in a cave.  Never shared.  My PREH-SHUSSSSS!

Filthy Colleagues-es!  They wants the Precious!
Filthy Colleagues-es! They wants the Precious!

Who are you, Gollum?  You may remember it didn’t work out so well for him.

The best developers actively share and disseminate their practices, tricks, tips and past pitfalls with everyone and anyone who will listen.  They teach and mentor new developers, write good documentation (OK, they at least write it…), send emails to the team letting them know about new tools and techniques for making things better.  They do Brown Bag seminars talking about the latest project and how it was useful to them, the company, or their peers.  They see problems in training and make up for it by creating Wikis for new team members.

There is no point in holding on to useful information that could make others better developers.  That is, unless you’re trying to stay in the same job forever.  Ask yourself, who do you want to work with on your next job?  The person who helped you write that complex algorithm on their lunch break, or the guy who hissed at you when you walked into his cube:  “Mine!  Stay away, filthy Hobbitses”.

Yeah, I thought so.

Habit 3: Complexity Demonstrates Intelligence

Smart people naturally create…chaos?  Today’s habit is about the value of parsimony in your work.  Previous habits linked here:

Seven Habits of Highly Dysfunctional Enterprise Developers:

  1. Blame Everyone But Yourself
  2. Confuse Motion With Action
  3. Use Complexity To Demonstrate Intelligence
  4. Keep Important Information Secret And Safe
  5. Fix It Later
  6. Reuse Is Overrated
  7. Principles Are More Important Than Results

Demonstrate Your Intelligence With Complexity

escher-relativity1
Ow, my head hurts...

Project complexity creeps in from two paths.  First, there’s accidental complexity.  As developers we love solving ALL kinds of problems–that’s usually why we choose this field.  Often times we start solving the problem before thinking about it first.  The result is stream-of-consciousness code, where even YOU won’t understand it in six months.  With comments.  As Mr. T would say, “I pity the fool”.

How about the developer that actively accidentally obfuscates their code by using counter intuitive algorithms, poorly named variables, or seven levels of indirection.  This intentional complexity is even more insane.  I’m not sure if this comes from some Napoleon complex in software, lack of training/experience or just a naive repertoire of coding tools.  Either way, it sucks for everyone else down the line from your code.

Simple code is easy to read, easy to maintain, and a joy to work on.  Sometimes, simple code will naturally evolve from complex code during the course of code reviews or pair programming efforts.  The best programmers I’ve ever worked with have one thing in common:  making complex things simpler.  And despite what I read about this Python library experience, simplicity pays for itself down the road.  Being afraid that a simple solution makes you appear less smart is crazy.  Want to prove how smart you are?  Try teaching some training class to your peers instead.

There are some easy ways to help fight both kinds of complexity:

  • Google the problem before you attempt solve it.  See if a solution already exists.  Understand that solution first.
  • If you only understand one solution to a problem, ask someone else for a different perspective, especially if you struggled with that answer.
  • Refactor if you don’t like it the first time.
  • Actively seek to reuse existing libraries.

Endeavor to make things easier for yourself and others.  The sanity you save may be your own.

Habit 2: Confuse Motion With Action

We explore the difference between work and heat in today’s habit.

Seven Habits of Highly Dysfunctional Enterprise Developers:

  1. Blame Everyone But Yourself
  2. Confuse Motion With Action
  3. Use Complexity To Demonstrate Intelligence
  4. Keep Important Information Secret And Safe
  5. Fix It Later
  6. Reuse Is Overrated
  7. Principles Are More Important Than Results

Confuse Motion With Action

Lots of people misunderstand the difference between motion and action.  Or in physics terms, the difference between work (energy put into a system that increases the potential of an object) vs. heat (energy expended but with no future value, like friction).   Steve Blank recently made a memorable post on it:

sisyphus
Sisyphus Enjoyed His Daily Routine...right?

Steve: Jim, how are we doing with getting Ansys ported?
Jim: Great, I have a bunch of calls into them.
Steve: How are we doing on the Nastran port?
Jim: Wonderful, they said they’ll get back to me next month.
Steve: How about Dyna 3D?
Jim: It’s going great, we’re on their list

Putting in the effort to look busy is not the same as making real progress towards a goal. I’ve sat in countless meetings listening to this sort of status reporting (at all levels, not just for developers either) and I’m sure you have too.  Oh, wait…you’ve given a status report like that?  Yeah, me too.  Next time you’re tempted to do that, look at the problem differently:

  • What goal do I need to accomplish?
  • What is in my way of doing that?
  • How can I get rid of those obstacles?
<li><a href=”http://www.lessonsoffailure.com/software/seven-habits-highly-dysfunctional-enterprise-developers”>Blame Everyone But Yourself</a></li>
<li><a href=”http://www.lessonsoffailure.com/software/habit-2-confuse-motion-with-action”>Confuse Motion With Action</a></li>
<li><a href=”http://www.lessonsoffailure.com/software/habit-3-complexity-demonstrates-intelligence”>Use Complexity To Demonstrate Intelligence</a></li>
<li><a href=”http://www.lessonsoffailure.com/software/habit-4-never-share-information”>Keep Important Information Secret And Safe</a></li>
<li><a href=”http://www.lessonsoffailure.com/software/habit-5-fix-it-later”>Fix It Later</a></li>
<li><a href=”http://www.lessonsoffailure.com/software/habit-6-reuse-wimps”>Reuse Is Overrated</a></li>
<li><a href=”http://www.lessonsoffailure.com/software/habit-7-principles-important-results”>Principles Are More Important Than Results</a></li>

Seven Habits of Highly Dysfunctional Enterprise Developers

With apologies to Steven Covey and Jack Ganssle, who have their own lists on the topic, I bring you the

Seven Habits of Highly Dysfunctional Enterprise Developers:

  1. Blame Everyone But Yourself
  2. Confuse Motion With Action
  3. Use Complexity To Demonstrate Intelligence
  4. Keep Important Information Secret And Safe
  5. Fix It Later
  6. Reuse Is Overrated
  7. Principles Are More Important Than Results

Blame Everyone But Yourself

finger-pointing2
Who me?

There’s always plenty of people on enterprise software projects.  Everyone shares the responsibility…and the blame.  Developers often use this situation to deflect the blame.  I call this the Code Kingdom Problem.  That’s not MY code, it’s YOUR codeI didn’t write that module, S/HE did…And so on.  Maybe this statement rings a bell:

“Hey Bob, since you wrote that parsing module and the bug that came up seems to be a parsing error, why don’t you fix it?

Tempting though this may be, consider the collateral damage caused by this causal remark:

  • Bob may resent you pointing out his failures
  • Bob may not want to collaborate with you on future work
  • Bob may not recommend you on future jobs
  • Bob may spit in your coffee when you’re not looking

Rather than risk Bob’s heinous salivary wrath, why not proactively fix the problem (Cooperative Code Sharing), or help Bob find it and suggest a fix if Bob is struggling with it? (Pair programming).  Bottom line:  Their is no MY code vs. YOUR code.  It’s OUR code. If you’re on the project, you share it all–failure, success, or mediocrity.  You can’t have pride of ownership without ownership.

Simplicity is the goal

My first day of Physics class in high school, we were given English homework:  find the definition of the word Parsimony.  My teacher was trying to underscore a point about the study of physics–while it explained the most complex of phenomena, the underlying theories and equations usually boiled down to a certain level of simplicity.  And as a corollary, if you found yourself trying to add in all kinds of complexity to an explanation, chances are you were running down the wrong road.  Which is not to say physics wasn’t filled with contradictions, despite my teacher’s mighty attempt to make it all seem elegant and grand.  I struggled with Quantum Mechanics because it violated every rule of simplicity learned to date in science.  And String Theory too.  Even Occam’s Razor is still one of my favorite things to trot out when folks are getting too mired in their own story.

Yet, we do the same things as developers all the time.  Brian Kernigan of C language fame has a famous quote:

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”

In other words, if you are at the limit of your skills in WRITING the code, you are far beyond your reach in debugging and MAINTAINING the code for the time to follow.  Where does the complexity come from?  That’s easy–we’re constantly trying to optimize the code.  That nagging voice pops up in my head when I start appending Strings in Java–”Ooooh.  That’s TERRIBLE.  That could be performance bottleneck!  You’d better optimize that…” 

Take a deep breath and step away from the StringBuilder. Donald Knuth said it best:

“We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.”

Premature optimization is the root of all evil.
When Donald Speaks, You'd Best Listen.

Yes, we mean that string code, or that database query, or whatever you’re working on.  I mean MOST of code you write.  We code for the unexpected and then accidentally mire ourselves deep in complexity all for the sake of optimization. 

It’s easy to forget the 80-20 rule (80% of the program execution time will be spent in 20% of the code).  There’s also a 90-10 variant of the rule (which makes the point even more harshly).  Let’s put this rule another way.  Your optimizations and complexity are completely wasted in 80% of your code

Let’s figure out the real cost of this: Suppose you spent an extra 8 hours per week working, debugging and perfecting that kind of code for 3 months on the project (in addition to your regular work).  You spent 96 extra hours on the project (a whopping two+ weeks!) and of those hours, almost all of them were a waste since they didn’t lend any real value to the end product.

Ouch.

The Rules of Simplicity are quite simple (c’mon, you knew it was coming):

  1. Make your code as simple as possible.
  2. If you think it needs to be optimized, run it through a profiler.  And then see Rule #1.

Simple code yields clear benefits over complexity to everyone:

  • Quicker maintenance
  • Easier extension
  • Fast bug fix times
  • Shorter up-to-speed times with new developers
  • Lower frustration levels with support engineers

Think any of those isn’t important?  Try spending time as a support engineer of your product sometime and maybe you’ll feel differently.  Or sit with a support engineer for a day and see how they have to work with, explain, and sometimes apologize for problems in the product.    Or just wait six months and try, just try to fix that extra clever code of yours.

I can hear the whines coming already:  “But what about an extra layer of indirection for database portability?”  Or maybe “the communication layer abstraction so you could talk to an ESB in the future, surely I have to plan for it”?  The answer is NO.  Unless you need it NOW, you ain’t gonna need it.

Complexity is our mortal enemy as developers.  It makes all of us dumber in the end.

Developers Are Not Presidents

I (heart) open source.  Deeply.  There are at least a few dozen libraries that I couldn’t live without anymore.  Tons of indispensable products like MySQL, Apache, Tomcat are part of my standard toolkit.  But the community hubris that goes along with it…Fuggetabouddit.  A recent quote by Django guru Jacob Kaplan-Moss concerning the balance of complex projects, features, release schedules and project management (collectively referred to in the quote as “these issues”) got my hackles up (full read here if you like):

“Open source cleanly avoids these issues by letting technical voices have the last say.”

Really?  So developers are now the President AND Congress? We write AND approve the laws?

Unfortunately, I think Jacob has missed the forest for the trees in this case.  From a broader perspective, the larger software product ecosystem looks like this:

Customers <-> Marketing <-> Engineers

We have Customers who have a need.  Marketing determines their desires, figures out features they want and asks the Engineers to build the product for the Customer.  (Obligatory Office Space joke)  Customer gets something that is Useful.  Everyone is happy.800px-PC_Load_Letter

In Open Source things are a bit different–we leave out the middlemen because we’re building tools and frameworks mostly.  We change the Customers a bit because Joe Six Pack, Joe Biden or your Grandma sure-as-heck aren’t going to be putting Django on their machines anytime soon and we get:

Engineers <-> Engineers

Open source sure has something easier to deal with than the earlier picture.  And no WONDER the developers get the final veto…chances are, they’re CUSTOMERS.  It’s great the Django has the luxury of saying to their developers, “Well, we’re not going to add in the toolbar to the next release” because in reality, that’s not a major loss to their customers.  They’re smart enough to find it on their own.  They are used to cobbling together things to get their end product working.  They’re highly technical and like to tinker.  They’re innovators and early adopters in Geoffery Moore’s terms.  They understand PC Load Letter (NSFW) on their printers.  But they’re the easiest groups to deal with when you’re a technical person.  It’s the other groups that are hard–and they’re the ones that make up a real product.

There’s a distinct difference between a project and product.  Project managers (like Jacob on Django) are responsible for the successful delivery of a project — a one-time endeavor with a goal, scope, deadline, budget, and other constraints. A project manager will work to align resources, manage issues and risks, and basically coordinate all of the various elements necessary to complete the project.  Product managers, on the other hand, are responsible for the overall and ongoing success of a product. Once the project to build the product is complete and the project manager has moved on, the product manager remains to manage the product through the entire lifecycle.  These two roles are often at odds with each other, but it’s clear that Django doesn’t need or have a product manager because Django doesn’t fit into the category of a mainstream product.  It won’t be sold or marketed like Photoshop or Excel.  You won’t have customers that nicely follow Moore’s technology adoption curve.

Feature set balancing for real products and serious projects requires more than just a bunch of architects sitting in an ivory tower with a REJECTED stamp and red ink pad.  There are revenue considerations to be made, customers that would buy your product because you now have feature X, and competitive analysis to determine market viability.  None of which has anything to do with the purity of the code base, what your UML diagrams look like or how clean you keep SVN.

Sorry Jacob.  That may work for Django but you might want to look at some broader, successfully released products before pounding your chest about the reason for your wild success on a project.