Reading Other People’s Code

I really enjoy reading other people’s code, it allows you see how others solve common problems, and sometimes even provide parables on what you shouldn’t do with yours. It also teaches the much needed skill of reading other people’s code.  Unfortunately there isn’t a convenient and fun way of reading other people’s code. 

Now, ask yourself two questions:

  1. how many hours a week you spend writing code?  
  2. how many hours do you spend reading code written by someone you don’t know or have access to?

The brave might even ask:

  1. how much of that code am I confident I understand, and could contribute to?

Many people avoid reading code simply because they hate being outside of their comfort zone. Documentation is an effective use of time if it does what it says. Often times documentation is outdated and unreliable and maybe even lies. Only thing you can be sure of is the source

Entire businesses have been built on the idea of sharing and writing code, but not reading.

Reading

What about reading?  I would argue reading code is as integral to writing as listening is to talking. Everyone likes to talk/write its a form of expression; the art behind the craft, but neither can be appreciated without their counterparts listening/reading. 

If I were to hand you a book and ask you to take me to where you would start reading, you would flip past the acknowledgements, table of contents,  and other credits and go to the first page, or chapter one. Fantastic. 

Now if I were to hand you a stack of code I printed out could you tell me where to start reading it as easily? Could you break the code up into chapters as easily? Should you the reader have to? What if it doesn’t have a main method? :)

Before I answer that, I would like to tell you a story.

When I first started out, I loved writing things from scratch. The clarity of how everything worked together made me feel powerful. I understood everything because I wrote it, I didn’t need to read it, because I wrote it.  NIH (not invented here) is basically a thing because rewriting is actually easier than reading the source in developers minds; developers develop and winners win.  

Why would anyone rewrite a program so they could add some functionality, when they could just as easily patch the already existing program to do what they want?

This involves the following things:

  1. Obtaining the source
  2. Reading & Understanding the source
  3. Contributing/Patching
  4. Testing (hopefully)
  5. Sharing

Most would agree step 2 is probably what they are trying to avoid for the most part which brings us back to our original question. 

Where is the first chapter or first page in a piece of software? In my opinion its where the writing begins. This shares many analogies with book writing in general. The architecture of a book may not change (beginning, middle, and end) but they share many parallels to software development having  an end goal in mind at the start. 

So to answer the question:

Where do you begin reading software? It’s where the writer starting writing it. Thats irregardless of it actually does anything. Does an unfinished story say anything? You can still read it right?

Rainman

That being said, today I am going to start working on Rainman. A tool that will use git repositories (to start out) to allow the replay of git commits and diffs in a sane manner providing transparency of the software writing process.

So you might be thinking that commits are too large to be useful. That might largely be the case, thats why I also intend to provide a recording tool that will allow developers to record their software development process and allow a replay that is more granular and indicative of the development process. 

This is still in the inception phase and welcome feedback and ideas in the form of issues here

Edit: Its been a busy year. I will get to this. If you are interested in helping out, please get in touch.


Subscribe!

Want to be notified about new blog posts and various thoughts on releasing announcing and creating products? I’ll let you know. All you need to do is enter your email below.

I hate spam too, so you have nothing to worry about.

No spam ever, just useful content. Unsubscribe at any time.

74 notes

  1. trethfarrel reblogged this from dustyprogrammer
  2. enki2 reblogged this from master-sergeant-maniacal
  3. master-sergeant-maniacal reblogged this from dustyprogrammer and added:
    The best part about reading code is when you stumble on a part of code that does not do what it says. After staring at...
  4. famthegeek reblogged this from dustyprogrammer
  5. nickdoesdesign reblogged this from dustyprogrammer
  6. masterke reblogged this from dustyprogrammer
  7. awaningendeavour reblogged this from dustyprogrammer
  8. learningcat reblogged this from dustyprogrammer
  9. mobocracy reblogged this from dustyprogrammer
  10. objectsareevents reblogged this from dustyprogrammer
  11. stardustcrusade reblogged this from dustyprogrammer
  12. ebriceno reblogged this from dustyprogrammer
  13. evandrix reblogged this from dustyprogrammer