I don’t remember exactly what my first programming book was, as it was many years ago (when I was about 12) and I keep a number of programming books from that time, but it was probably this one:
It was a Portuguese translation of “Creating Adventure Programs on the ZX Spectrum“, originally by Peter Shaw and James Mortleman.
It explained how to design and code text adventures, one of the earliest genres of computer games that was about to disappear completely in the early 90s but fortunately is still alive thanks to the Internet (although it’s not a commercial genre anymore, obviously). There’s a number of free software programs for Unix-based systems to play classic and new games from that genre. Maybe one day I’ll post something about them 😉
With this book I learned some interesting things about algorithms, text parsing and data structures. All the programs included in the book were written in Sinclair BASIC, the first language that every Spectrum owner learned as the computer included an interpreter.
However, it wouldn’t be fair to say that I learned programming thanks to any book, because without any doubt almost all of my early programming experiences began with MicroHobby, a Spanish magazine dedicated to Sinclair computers. Thanks to the work of some enthusiastic fans who scanned all the issues, MicroHobby is available online in the MicroHobby Forever site.