I still remember the pleasure I enjoyed, as a kid, of reading the badly-printed, barely-readable code listings from old computer magazines, curled up in bed, with only a faint light to help me see. It was late at night, and I wasn't allowed to use my computer, so I had to imagine by myself what each of those mysterious codes would be doing.
The sources were full of annotations, lines beginning with REM
at first, and later semicolons, sometimes even more cryptic than the code they tried to describe. Each author carried his own voice, and tentatively explained the code
he wrote, with varying results.
It was obvious, in retrospect, that many of those people, the writers of my favorite magazines, were not professional writers with years of experience, but young, enthusiast coders, like you and me, who found themselves in a dream job that I envied so much. That genuine quality, that coding can be whimsical and fun, made me fall in love with code, and become the person that I am today.
Twenty years later, I am not forced to hide under blankets anymore. I can binge on the internet, and stay up hacking, for as long as I desire. Yet, the desire to disconnect, travel with my mind on those magical incantations, never left me.
This collection attempts to recreate that same feeling, by providing fun, concise, and readable code listings, that can be read and fully understood in one snack-sized bite. The programs will be short and to-the-point, will treat interesting problems, and of course will be fully annotated, with plenty of insightful comments, quips, and links to additional material.
I'd like you to read this code, and lose yourself, fantasizing on all the cool ideas you could implement, and how great your version of the program will be.
So rock your chair, grab a cup of tea, or put up your favorite tunes. It's all up to you. Then just sit back, and enjoy the code.