14 Jun

Good coders copy, great coders steal

Source: http://img.d3.ru/comments/416555/
Source: http://img.d3.ru/comments/416555/

Good artists copy, great artists steal. - Pablo Picasso

What Picasso meant is that good artists duplicate the work of other artists without changing it. But great artists take the work of other artists and make it their own.

I believe programming can be an art, or at least something we should aim for. (For the record, here’s my favorite piece of art… err! code, Lua’s bytecode. If you have the patience to wrap you head around it, I guarantee you’ll believe me when I say this is a piece of art. But let’s stay on track here…)

To become a better programmer you have to first copy, and then steal.

Copying

A painter that copies another painter’s work, for example, will reproduce every lines and colors one at the time. This makes you realize how many parts come into play to make an amazing piece of art (or software). So when I say copy, I certainly don’t mean copy-paste code from StackOverflow. I mean: recode the thing, line for line or in your own style or language, by looking at the original.

This might seem dumb at first, but it works for the same reason taking notes helps you remember things. Even if you don’t go back to read them. It’s also better than simply reading the code. As you can’t get lazy and skim over some parts.

The first open source project I ever created was called WebAccept. An horrible idea I know… But I learned so much! I copied most of the design and code from NAnt, also a copy, or as they said: a .NET port of Ant, the Java build too, which probably started as a copy of Make. That project taught me more than I ever learned in school and at work about good software design, documentation, tests and all.

I’ve been applying the same approach ever since. With Thin, I copied Mongrel. With TinyRB, I copied TinyPy and Lua. Each time learning more and more.

That’s why I think the best way to learn is to copy, recode, recreate from scratch. And also why I use this approach in all my presentations and classes.

Stealing

Stealing is the next level. You can copy some code and still not understand how it works. You can also copy some code and not see a better way to do it. But, you become great when you adapt the code to make it better.

This is how the world of software evolves. Making baby steps towards greatness by building on the work of others before us. Making things a tiny bit better each time. There should be no shame in this kind of stealing.

After copying Thin from Mongrel almost line for line, I rewrote it six times to steal it and make it my own.

Lets copy together!

OK! Want to give it a try?

To get you started and show you how I do it, I’ll be teaching a new class in which I’ll rebuild a Ruby web server from scratch.

And here’s the kick… it’s free!

Sign-up bellow and join me this Friday, June 21st at 1PM ET. It should last about an hour and I’ll take some questions at the end.

However, because of technical limitations, only 100 people can attend it live. But, recordings will be available if you sign up.

All you need is basic understanding of web dev with Ruby (with Rails, Sinatra or other) and a browser with Flash.

I hope to see you in class! :)

Like what you just read? Subscribe to my newsletter to learn how I make a living selling my products online.

Or if you're into coding, join my free class on rebuilding a Ruby web server.

blog comments powered by Disqus