Steal the Code

October 28, 2010 holman

Learning anything is easy. Internalizing it is difficult.

Something I’ve found myself doing in my last few projects is to steal ideas from other projects. Not actually “stealing”, of course, but browsing your favorite projects and developers and stealing concepts from them. Design patterns. Refactoring methodologies. How does Chris deal with command-line arguments in hub? How does Wayne transition between shell scripting and Ruby in rvm? Anything that conceptually requires you to come out of auto-pilot programming mode and think, “hey, how do I actually do this?” is a great place to start.

Once you reach that point, sure, you could google a blog post to get the answer. But by “stealing” it from someone else, you achieve two things:

  1. You form a mental connection between your concept and that specific project.
  2. You acquire “ownership” in that concept.

“Acquiring ownership” in something you “steal” is counter-intuitive, but think about it: you spend the necessary time to understand the concept, and then you apply it to your own problem domain. The mental act of doing that can be an intensely satisfying process. Once that bell clicks, you’ll start understanding why the author may have refactored that method, or why they needed a separate helper class.

Don’t get me wrong; hammering things out on your own is great. That’s almost an entirely different class of learning, and it works well in the majority of cases. But sometimes learning others’ best practices is the quickest way to enlightenment- not in terms of fixing your problem at hand, but of substantially understanding the forces involved.

By seeing how others have tackled your problem, reaching the point of your own personal understanding, and then reshaping it to fit within your viewpoint, the concept then becomes “your” concept and you then have it in your pocket for your next project. It may be just another word for “learning”, but as soon as I thought of it in this concrete, compartmentalized fashion — Oh, this is just like that inheritance strategy I stole from Homebrew in my other project a few months back — my ability to retain knowledge has gone way up.

Once you’ve reached that level of internalization, that difficult concept becomes just another concept you can auto-pilot.