small medium large xlarge

14 Nov 2010, 22:39
Diego Zamboni (69 posts)

I have a question about code examples that I write during this month.

Would you advise code examples to be fully developed, tested and debugged at this time? I find often while I am writing code samples that I know there are a couple of small bugs to fix or improvements that need to be made, but I don’t want to break my flow of writing, so I put in a “representative” code sample, make a note to myself (in the text itself, [like this]) to fix and improve this later, and keep going. However, I wonder if I should spend more time doing them correctly the first time, and then perhaps I would uncover some other interesting details to talk about in the book, at the risk of “going down a rabbit hole”, as Travis aptly described it in some other thread.

What are your thoughts about this?

15 Nov 2010, 00:41
Bob Cochran (170 posts)

Hi Diego,

No you should not. You simply do not have the time to both write a book and write and test code in the timeframe we have. Your focus should be on the book itself, the code examples can wait. I think chasing after code is a big mistake this early in the life cycle of writing a book.

I guess we all can write code. Anyone can. The challenge with PragProWriMo is quite different: to focus on writing a book.


16 Nov 2010, 13:23
Travis Swicegood (117 posts)

Hey Diego;

I would say it depends. Bob is correct in that you can spend all of your time writing/perfecting code if you’re not careful. Writing is the core idea here, but sometimes the code does help flesh that out. My book is being written around the code. It’s about a technology, but the showcase for that technology is a project that we’re spending the majority of the book writing to exercise that tech. Without writing the examples as I go (and running and occasionally debugging them), I think I would have missed a few things. I know of at least two cases where writing out code made me realize a few things I had missed and/or glossed over.

The kicker is finding what works for you. As long as you’re careful and aware that you might be peering down the rabbit hole you should be able to realize when you’re headed that way.

One thing I do is use the “pomodoro timer”: Every odd minute I get a growl notification which helps serve as a quick “am I still on track” token. Keeps my tangents down to 2 minutes or less if I’m always mentally double checking that I’m working toward the right goal.


You must be logged in to comment