fbpx
BooksComputers

Coding Owners’ Workshop Manual by Mike Saunders (book review).

A problem often with only seeing a cover of the book on a small scale is that you don’t tend to see or even read all the text. It wasn’t until I got this book, ‘Coding Owners’ Workshop Manual’ that I realised it wasn’t a general programming book for computers but Python, specifically for the Raspberry Pi gadget. Haynes has a book on that subject, too, but as I don’t really have much need or time for one, I’ve never really investigated it that deeply so I’ve treated this book by Mike Saunders purely as a means to learn another computer language.

In my other career I did a lot of programming in various dialects of BASIC. Despite not programming in nearly 20 years now, Python does look like a simplified version of BASIC with some odd word changes. Arrays are now called tuples for instance but they have the same function. I found I was on the same page from the outset.

Saunders explains at the beginning to this book that he’s only going to teach the fundamentals of Python and nothing too elaborate. Even so, seeing that there are at least three versions for PC/Windows, Mac and Linux, of Python, it does make me wonder if there are any compatibility issues if you want to move any programs between these platforms. Further into the book, Saunders does explain how to get around them so maybe I was just thinking ahead. This is one book where you shouldn’t be a passive reader. That is, you shouldn’t just read but really read and apply. As the initial chapters cover details of installation for all three versions of Python as freebies off the Net then that shouldn’t be a problem or expensive. Neither do you need a Raspberry Pi to apply this software. If anything, learning the language first might actually be better than jumping in with both feet an hoping you can get along with the learning curve in one bound.

I have to confess to just applying what I know about BASIC and all my knowledge flooded back. When I was at work, I explained the four principles I kept to:-

  1. User friendly terms – remember to tell the user what the program needs.
  2. Input of data.
  3. What to do with it by choices – if/then options.
  4. The ‘bugger’ factor, that is putting a limiter in against erroneous data that some silly bugger puts in and crashes the program and loses the data. In those days, it took a lot longer to save data to hard drive

With the fourth, although Saunders points out the dangers of infinite loops, he doesn’t actually say how to interrupt them although I presume the ESC key would stop it. Much further in, one of the programs included has a QUIT control which stops such loops.

I was also surprised that only a blank line was inserted for gaps between sub-routines rather than a non-program text to describe function which is a lot easier to track when you have bigger programs.

A lot of the areas in programming is attaching modules that already exist than dreaming up your own code. This isn’t much different from the old days where books showed, say, different sorting routines and you typed them in yourself modifying as appropriate. Only here and, I suspect with other computer languages, you no longer have to invent the wheel each time, just as long as you know which variables to enter into them.

Although I haven’t really got that much free time to get back into programming at the moment, Saunders book will give you all the knowledge to get you started in programming in Python before you advance into other tomes. Hopefully, some of the things I didn’t find here are probably covered there. He also shows where to look for the modules on-line and the various chat groups if you get stuck on a particular problem. If one of your sprogs has an inclination towards programming then this book will give him the necessary starting knowledge which is always a good sign.

GF Willmetts

December 2017

(pub: Haynes. 128 page illustrated large hardback. Price: £18.99 (UK). ISBN: 978-1-78521-118-8)

check out website: www.haynes.co.uk

UncleGeoff

Geoff Willmetts has been editor at SFCrowsnest for some 21 plus years now, showing a versatility and knowledge in not only Science Fiction, but also the sciences and arts, all of which has been displayed here through editorials, reviews, articles and stories. With the latter, he has been running a short story series under the title of ‘Psi-Kicks’ If you want to contribute to SFCrowsnest, read the guidelines and show him what you can do. If it isn’t usable, he spends as much time telling you what the problems is as he would with material he accepts. This is largely how he got called an Uncle, as in Dutch Uncle. He’s not actually Dutch but hails from the west country in the UK.

2 thoughts on “Coding Owners’ Workshop Manual by Mike Saunders (book review).

  • It’s a mistake to think of Python as much like BASIC, even if the same sorts of things can be done in the language.

    Python is actually more like Java in conception. Java is “write once, run anywhere”. Java source compiles to a tokenized binary targeted at a virtual CPU implemented by the Java Runtime Environment. The Java Runtime abstracts away the platform differences, and actually executes the Java code on the host. The key is that the compiled Java code is always the the *same*, regardless of where it was compiled. You can compile Java under Windows, and run the output under Linux, or anything else supporting a current JRE. I have IBM’s open source Eclipse programmer’s IDE here. It’s written in Java. The *same* binary runs on Windows *and* Linux.

    (There are flavors of BASIC for just about everything, but it’s *not* cross-platform. BASIC implementations tend to be specific to the hardware and what that platform can do. You likely have to do a full rewrite to port BASIC code from one platform to another, assuming it can be done at all.)

    Python is similar to Java. It’s cross platform with ports for many platforms. Python code compiles to an intermediate binary format executed by the Python runtime. Python syntax resembles C more than BASIC, making it easier for programmers who work in C to work in it. And Python makes it relatively easy to call routines written in C when raw performance is a consideration.

    One curious feature of Python is that program code is structured by indentation, and the Python runtime enforces that. Properly indented code is a *requirement*, not an option.

    Python also makes extensive use of libraries, so you *don’t* have to reinvent the wheel, and the challenge is finding the right libraries for what you want to do. (But that’s true for any modern language that uses libraries.)

    The key factor is that hardware has gotten steadily smaller, faster, and cheaper. It is now feasible to do things in a script language like Python that you used to have to do in compiled machine code, because the hardware is fast enough to provide needed performance.

    Look at the target platform for Python code examined in the book. The Raspberry Pi is a tiny single-board computer based on an ARM Cortex quad-core CPU, and runs a flavor of Debian Linux called Raspbian as the default OS. The cheapest model, the Raspberry Pi Zero, is available for $5 USD.

    Python provides an interactive method of programming on the Pi, and is a good place to start.

    >Dennis

    Reply
    • Hello Dennis
      Whatever the compiler is, the top of end where you put commands in still looks like BASIC and anyone with some familiarity with that shouldn’t have any real problems.
      I should also point out that Saunders neither comments on JAVA or BASIC in the book so any conclusions I brought are purely from his book.
      I did discuss the Raspberry with someone I knew before reviewing the book foe some background. The book itself focuses on Python and nothing much on the Raspberry. As to the price of the Raspberry Pi Zero, the CPU unit costs about £22 in the UK which is nearly 5 times that of the US price, according to Amazon, but without all the extras, like VDU, cables and stuff to connect to other devices, which also costs money, it is as useless as the CPU that runs the Terminator chassis taken out of its body.

      In the end, it looks like you agree with me.
      Geoff

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.