How Benjamin Franklin Would've Learned To Program

Fri 20 September 2013

Filed under Blog

Tags practice writing benjamin-franklin

Practice programming like you would practice writing

Good programming is notoriously difficult to teach. Programming books generally all start out in the same way: "Here is an example of an X, and here is an example.". Teaching the building blocks is easy. There are only so many. The hard part is teaching the consequences of each choice. The common advice is to write a lot of code to get good. This is necessary but not sufficient. To learn we still need to decide what code to write, and how to improve that code.

We will explore the closely related field of writing to get advice on improving our craft. In many ways programming is like writing. Both are centrally concerned with getting your thoughts down into an easily communicated form. We find both hard because our ideas are densly cross-linked whereas text is depressingly linear. The infinite variety of ways in which thoughts can be represented in text makes learning the art of writing, as well as programming, difficult.

Thankfully, Benjamin Franklin recorded a method that he used to develop proficiency. As evidence of his writing prowess, we need only look at the Amazon Biography best seller's list. His biography is still one of the best selling books after x hundred years. If that's not proof then I don't know what is.

Benjamin developed his method in his early teens and worked hard at practicing his craft. Here is the exceprt with a few added line breaks for legibility.

About this time I met with an odd volume of the Spectator. It was the third. I had never before seen any of them. I bought it, read it over and over, and was much delighted with it. I thought the writing excellent, and wished, if possible, to imitate it.

With this view I took some of the papers, and, making short hints of the sentiment in each sentence, laid them by a few days, and then, without looking at the book, try'd to compleat the papers again, by expressing each hinted sentiment at length, and as fully as it had been expressed before, in any suitable words that should come to hand. Then I compared my Spectator with the original, discovered some of my faults, and corrected them.

But I found I wanted a stock of words, or a readiness in recollecting and using them, which I thought I should have acquired before that time if I had gone on making verses; since the continual occasion for words of the same import, but of different length, to suit the measure, or of different sound for the rhyme, would have laid me under a constant necessity of searching for variety, and also have tended to fix that variety in my mind, and make me master of it. Therefore I took some of the tales and turned them into verse; and, after a time, when I had pretty well forgotten the prose, turned them back again. I also sometimes jumbled my collections of hints into confusion, and after some weeks endeavored to reduce them into the best order, before I began to form the full sentences and compleat the paper. This was to teach me method in the arrangement of thoughts.

The Benjamin Franklin Programming Practice Model

  1. Find a program that you greatly admire and read it.
  2. Takes note on the roles, inputs, and outputs of each major component.
  3. Take notes on how the components interact.
  4. Rewrite the program.
  5. Compare your code with the original.
  6. Note where you can improve and study acccordingly.

Don't just write more programs. Super charge your abilities by studying great programs, and then trying to imitate them.

How do you get better at programming? Tweet me (@practicepython) your practice methods. I would love to hear how you practice our craft of programming.

Oh and if you found this helpful, please share it with your friends. Sharing is caring :]

Like what you just read? Subscribe to Python Practice Projects for more insights on practice, programming and the slow path to victory.


Python Practice Projects © Louie Dinh Powered by Pelican and Twitter Bootstrap. Icons by Font Awesome and Font Awesome More