Practical Programming: An Introduction to Computer Science Using Python 3 (2e)

Authors: Paul Gries, Jennifer Campbell & Jason Montojo
Publisher: Pragmatic Bookshelf
Pages: 350
ISBN: 978-1937785451
Audience: Complete beginners to programming
Rating: 4
Reviewer: Mike James

 

Learn to program and learn computer science with Python 3.

This is the second edition and unlike many second editions the authors have actually taken the opportunity to improve the book.

The stated aim, in the subtitle at least, is to introduce computer science via Python 3. This is quite a good idea but the book seems to be more aimed at teaching Python using examples from computer science rather then getting into the details of computer science. This is OK. but if you alreadly know how to program in Python (or indeed in any language), you might find the book tells you lots of things you already know. This is not a "learn computer science" for existing Python programmers. It is in fact mostly a complete beginners' "how to program" book with a slant towards the academic.

One of the problems with using Python as the language to explain computer science ideas is that it isn't exactly the perfect language to illustrate some of the important theoretical concepts. For example you can almost feel the authors' struggle with the idea of data type using Python, which really is about as weakly typed as a language can be - so much easier an idea to get across in a strongly typed language.

Banner

The new edition has been partly reorganized to bring some of the key programming ideas earlier in the book.  It starts off with the absolute basics and describes what a program is and what programming is all about. Chapter 2 gets you started on writing some code - all very simple expressions values and variables. Chapter 3 introduces functions which might seem a bit early given we haven't yet met any control statements - but for Python it makes good sense. However it also explains how variables are created on the stack and this is something that the complete beginner could probably do without. It is an aspect of the "computer science" part of the book breaking though to explain exactly what is happening under the covers. 

Chapter 4 is a good practical explanation of string handling. Again this might be a little early but it does have the advantage of giving the learner a useful data type to work with. 

The good news is that now conditionals are introduced at chapter 5 - they really are the core of learning to program so moving them earlier is a great improvement. It starts off with the idea of a Boolean and then a conditional expression and only after dealing with these ideas does it get to if statements. It starts off simply enough but within a few pages we have nested ifs and elseifs all making it difficult to see exactly how things work. This is a rate of progress that perhaps underestimates the difficulty the beginner has getting to grips with the most simple if then else construct.

 

pracprog2

 

Next we have a short chapter on using modules. After having started to explain control statements and flow of control it might be better to carry on and deal with loops. Chapter 7 goes on to explain methods and of course some object-oriented ideas. Chapter 8 deals with working with Lists and it gets quite deep in the name of some computer science ides - lists of lists for example. 

At last we reach loops at Chapter 9 and when you consider the amount of material covered without introducing the idea of iteration it is a bit of a shock. The idea is motivated by processing Lists and Strings using a for loop. Before introducing the conditional loop we have nested for loops which could be left for later. Finally we do reach the While loop and very rapidly some frightening looking loops with multiple conditions break and continue options. There is a warning at the end about using break and continue but it might have been better not to expose the beginner to such dangerous code until they had settled down with loops in a good style. 

From Chapter 10 on the book concentrates on introducing ideas that are more motivated by computer science than learning Python. Chapter 10 deals with files and file handling. Chapter 11 is on collections including the Dictionary.

Chapter 12 introduces the idea of algorithm design and leads on to Chapter 13 on searching and sorting. These are fundamental algorithms but not really essential material for the beginner. Most practical programing doesn't reinvent the merge sort but simply uses a library function. We don't get as far as Quicksort which is something of a relief but without it I don't think that the reader gets the flavour of sorting algorithms. A lot of the chapter is devoted to comparing run times so as to introduce a little more computer science. 

Chapter 14 builds on the earlier introduction to methods with a full look at object oriented programming in Python. You get the full classical theory - inheritance, encapsulation and polymorphism. 

The final three chapters return to practical programming with an explanation of debugging methods in chapter 15, building GUI interfaces with Tkinter, and finally databases with SqlLite. These are interesting but really seem to belong in another book.

This book seems to be attempting to do too much in too little space. It's not a bad introduction to programming in Python but it could have been so much better if it had dropped the requirement to tackle computer science head on and simply used the principles in the background to motivate and guide the presentation.

If you are looking for a book that introduces the non-programmer to Python there are better choices that don't confuse the issue with an academic agenda. If you want a book that will lift your Python programming and give you an idea of what sorts of things lurk below the surface then this is a good choice, but it isn't an easy read for the beginner. 

 

 

Banner

 


Python Programming with Design Patterns

Author: James W. Cooper
Publisher: Addison-Wesley
Date: February 2022
Pages: 352
ISBN: 978-0137579938
Print: 0137579934
Kindle: B09D2RKQB5
Audience: Python developers
Rating: 1
Reviewer: Mike James
There was a time that design patterns were all the thing. Not so much now. But Python - does it have [ ... ]



SQL Server 2022 Administration Inside Out

Author: Randolph West et al
Publisher: Microsoft Press
Pages: 992
Print: 0137899882
ISBN: 978-0137899883
Kindle: B0C4VKVP27
Audience: DBAs and developers
Rating: 5.0
Reviewer: Ian Stirk

This book aims to update your DBA skills to cover SQL Server 2022, how does it fare?


More Reviews

 

Visit Book Watch Archive for latest titles for programmers

 

Last Updated ( Saturday, 28 June 2014 )