"How I Code" Books vs "How It Works" Books
Sunday, January 13, 2008

Scenerio: A developer, or aspiring developer, walks into a bookstore seeking a means of self-education. He or she is faced, however, with a forest of literature, all claiming to be the best route to understanding. The developer thumbs through various selections, and discovers one with pages and pages of example code. The developer tucks that book under his or her arm, and walks off to the checkout line, confident they will soon have new ability and new understanding. Unfortunately, it is far more likely that they have just set themselves up for failure.

To The Making of Books...
"To the making of many books there is no end, and much devotion to them is wearisome to the flesh." - Ecclesiastes 3:12

If one could chop down books and make them into trees, one could imagine the destruction of all technologically related books allowing the restoration of a decent percentage of the South American rainforests. There are hundreds of books on every technology one can think of, with more coming out every day. Finding the right set of materials to read is a chore, truly "wearisome to the flesh." How does the developer choose the right book? There is one deadly assumption that many make when choosing their self-education material: the more example code the better. Developers who make this assumption will find themselves inside an insidious layer of abstraction that is not obvious upon first glance.

The Example Taxi
Example code is a wonderful thing. Developers are often faced with problems which have already been solved by someone else. A quick search on the internet reveals that slice of code which saves him or her a great deal of time. This is useful. However there is a difference between example code for specific needs, and the attempt to teach concepts or development methodology through coding examples. Understanding the difference is imperative to good self-education.

Let's illustrate why learning by example code is an insufficient method of self-education:

Imagine a man gets a job as a taxi cab driver in New York City. This is a job which requires a demanding amount of self-education. One needs to know how to travel from any point A to any point B that the passenger requests. Now we introduce the 'example taxi.' Let us suppose that, rather than studying maps of New York, a second, more experienced taxi cab driver is utilized whom the new driver follows. Whatever the passenger requests the example taxi is notified of. The new driver simply follows the example taxi to the desired destination.

Has our new driver successfully carried out his duty? On the surface, the answer is yes. What's more, if that driver needs to travel from that exact same point A to point B again, he may remember how to do so. However, does the driver truly understand how to travel through the city of New York? Clearly not. He knows only one particular route (someone else's favorite route, at that) to his destination. However, that is almost never the only path, and it may not be the best under all circumstances. What is a better route during the busier times of day? What if there is construction? Without understanding all the possibilities, and without getting the 'big picture' of New York, our driver will soon discover the inflexibility and lack of self-sufficiency in his education.

The fatal flaws in our driver's education are the same flaws in the education of a developer through example code. Someone else's code is merely one route to solving a problem or implementing an idea. However, it is never the only route, and not always the best one. Simply parroting another's code without understanding it, nor understanding the alternatives, is like following the example taxi. One arrives at their destination, yes, but one will soon hit roadblocks (such as requirements and assumptions different from those of the example code). Once hit, those roadblocks will bring into focus the inflexibility and lack of self-sufficiency in their education.

A lack of self-sufficiency is manifested all the time, for example, in newsgroups and forums on the internet. Developers leave messages asking for 'the code to' do some task. One message seen was a new developer asking for 'the code to' build an address book. The fundamental lack of development of problem solving skills is staggering in a request like this. There are hundreds of ways to approach an application like an address book. There are dozens of possible pieces of functionality, each with varied ways of implementing them. It is also easy to design the application very, very poorly! This newsgroup poster will soon find himself with a library of code, and the headache of having no real idea what to do with it.

When it comes to self-education, avoid the example taxi. Choose reading material that teaches you concepts and core units of knowledge that promote understanding. Then use example code for ideas and inspiration, not for an education. How can one recognize proper reading material? We separate the developer's reading material into two categories: "how I code" books, and "how it works" books.

"How I Code" Books
"How I code" books are very easy to recognize. They are clogged with example code and example scenerios. Normally a scenerio is presented, and the developer steps piece by piece through the code they would write to implement a solution. At the end, they may then show all of the code together so the reader can happily copy it in order. This is rather like sitting and looking over another developer's shoulder while they code. You may learn something, yes, but what you learn isn't how to code.

In books like these, you are learning one developer's approach to designing a piece of software, which is fine if you are able to call the author on the phone and ask for the code to implement every problem you come across. If you can't do that, well, then there was little point to your exercise. One taxi following another around is not learning a city. Watching a painter paint, is not learning to paint for yourself. Looking at the database someone designed to support an address book application is not learning normalization and relational database design. One is an exercise in implementing a concept, the other is a concept itself. Without the latter, the former is nearly useless.

"How It Works" Books
"How it works" books are harder to find, but are very much worth the effort. They explain concepts, and use brief scenerios (and usually even briefer snippets of code) to demonstrate, not to educate. Look for books that detail how a technology was implemented, not solely how to use it.

A good example of this are the various books available for teaching ASP.NET. The ultimate purpose of this technology, like JSP or PHP, is to deliver HTML to the user. The framework allows for quite a wide array of tasks to be accomplished behind the scenes, but the medium of final delivery is still the same. There are mountains of "how I code" books on ASP.NET, detailing how to build various kinds of websites (image management systems, time tracking systems, shopping carts, etc.) For the new developer, the example based route can be quite tempting.

On the other hand, there are good ASP.NET and .NET framework books out there that explain how ASP.NET works. How does this technology move from the abstract concepts the developer uses to implement their solution to the HTML delivered to the user? If one understands the core architecture, one will not need so much example code to solve whatever scenerio is presented to them!

These kind of books promote understanding. Once you understand, you can do anything. Thus, be wary of "how I code" books! They can be useful, but one should first have a core understanding of whatever technology it is discussing. You don't want to learn how someone else codes. You want to learn to code for yourself. Only then will you progress as a developer.



Tags: books, asp.net, php  |  Category: Coding  |  Permalink  |   0 Comments »

  AddThis Feed Button

 leave a comment

  Name   

  Email (never shown, just to prevent spam) 

  Website (optional)

  Comment 

  

 

 comments

widget things

Coming Soon! Widgets for your office intranet or group website...

blog things

find blog posts in the following categories...

»Tech
»Coding
»Web
»Music
»Movies/TV
»Books
»Games

recent posts

»GooPinion - Yahoo BOSS running on Google App Engine  

»Microsoft Acquisition of Yahoo  

»Iron Man TV Spot  

»ELMAH still a great error logger for ASP.NET  

»Star Trek XI - Trailer and Viral Site  

tag cloud

asp.net   Bluray   books   boss   browser   C#   daily show   development   elmah   enterprise   error handling   error logging   games   google   goopinion   Hancock   HD DVD   html   http handler   Hulu   incredible hulk   iron man   jj abrams   software   yahoo  

search blog