Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 9.6

REVIEW

Book: How To Count

Issue: 9.6 (September/October 2011)
Author: Marc Zeedar
Article Description: No description available.
Article Length (in bytes): 5,409
Starting Page Number: 12
Article Number: 9602
Related Web Link(s):

http://stevenf.com/pages/book.html
http://www.panic.com/

Full text of article...

I love the title of this book. I'm sure you're already disagreeing with it. But I know how to count. Do you? Are you positive? Can you count backwards in hex by 1011?

This is the first book in a new series called Programming for the Mere Mortal by Steven Frank of Panic fame (http://www.panic.com/), makers of Transmit and Coda and other cool Mac software. The goal of the books is to teach programming to the non-programmer. Steven decided to begin with the most basic of all programming topics, counting.

Now I'm mostly self-taught as a programmer so I've learned most of what I know from books and articles and my own experiments. What I know of binary and hex and numbers I've gathered in bits and pieces over the years, some of it learned the hard way, so I found this book to be very helpful in clarifying my thinking.

I still remember in high school forcing myself to go the computer teacher to find out why the Monopoly-like game I was writing wouldn't work with dollar amounts over $64,000. I hated having to ask for help, but I was utterly baffled. The teacher's explanation was so far over my head it was years before I understood that the numbers in the BASIC language I was using were only 16-bit and thus couldn't go larger than 65,535. (If you don't understand that, then you need to read this book!)

This book starts out at a fairly elementary level explaining literally how we count in decimal, binary, and hex, and it reveals some nifty conversion aspects between the bases I never knew about. (We're literally halfway through the book before we get an explanation that would have helped me with my high school problem.)

Next it covers signed and unsigned numbers, and then it gets into explaining data sizes (kilobyte, megabyte, gigabyte, etc.). Much of this you may already know, but even then, it's good to have a basic refresher.

Finally we get to the big dog: fractions, also known as floating point numbers. Here Steven doesn't get into much detail (which is probably for the best) but simply explains enough that we can see just how mind-numbingly complex floating point is internally. Fortunately, as programmers, we rarely need to worry about the specifics of how FP is handled by your language.

But then we come to fixed point, which I guess I never understood before. I always thought of it as floating point with a fixed amount of accuracy (like two, for working with money). But internally fixed point never actually deals with fractions at all—since it knows the precision amount is always the same, it just scales everything to a larger integer. For instance, with money, $12.50 isn't twelve dollars and fifty cents (a fraction), but simply 1,250 cents! This gives the computer precision (important with money) and since it's not using floating point, it's very fast and easy for the computer.

Overall this is a simple and elegant book and it reads quickly (it's about 70 pages). It's just complicated enough to be interesting and helpful, and it's terrific if you're self-taught like me, or brand new to programming. Advanced users probably don't need to apply, though going over the basics again never hurt anyone.

The one thing this book doesn't do is explain how any of this is actually useful or applies in any kind of programming. That is left for future books in the series as Steven thinks of this volume as simply a foundation to build upon.

That's about the only criticism I have, as the book lives up to its title well, but with today's modern languages much of what is explained in this book isn't a big issue. We rarely deal with bits and bytes any more, and environments like Real Studio handle most of the ugly number stuff automatically for us (for instance, my high school Monopoly-like game would have been fine in RB using a regular integer which would have given me numbers up to $2 billion to work with). Still, considering the low price and quick read, this is a worthy book for any of us to have on our bookshelves (virtual or physical).

End of article.