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

 


Joe Celko’s Trees and Hierarchies in SQL for Smarties

Author: Joe Celko
Publisher: Morgan Kaufmann
Pages: 270
ISBN: 978-0123877338
Aimed at: Advanced SQL developers or computer science students
Rating: 4.5
Pros: Lucid and understandable descriptions of abstract topics backed up by real code
Cons: Not a light read
Reviewed by: Kay Ewbank

Hierarchies and Trees  [ ... ]



The Python Standard Library by Example

Author: Doug Hellmann
Publisher: Addison-Wesley, 2011
Pages: 1344
ISBN: 978-0321767349
Aimed at: Intermediate Python programmers
Rating: 4
Pros: Lots of useful code
Cons: Not all of it will port to Python 3
Reviewed by: Alex Armstrong

This big book is intended as a reference. Is it a good addtion to your bo [ ... ]


More Reviews

 

Visit Book Watch Archive for latest titles for programmers

 

Last Updated ( Saturday, 28 June 2014 )
 
 

   
RSS feed of book reviews only
I Programmer Book Reviews
RSS feed of all content
I Programmer Book Reviews
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.