Practical Programming Using Python 3 Book Review

Practical Programming Using Python 3 Book Review

My daughter and I pair programmed in Python 3 over the Thanksgiving Holiday while reading the book, Practical Programming - An Introduction to Computer Science Using Python 3. The book is intended for people new to programming and I've heard that Python is a great first language to learn. Although we are both experienced at programming and I could have easily taught her C# or Ruby, I thought Python would be more fun since it is new to both of us.

Overview

The book is used to teach computer science to college students that have no experience with programming. If you are unfamiliar with basic programming concepts of variables, types, classes, statements, loops, functions, OOP, etc., this book definitely starts with the basics and will give you a nice introduction to various programming concepts. In fact, these same concepts will assist you at learning other programming languages as well. Although you will be applying these concepts with Python and its syntax, you can easily apply this broader knowledge to C#, Ruby, or other programming language of your choice.

There is also nice coverage of Lists, Sets, Dictionaries, Tuples, and when you would use one versus the other. I, personally, really enjoyed the chapter on Searching and Sorting, which reminded me that this book is used to teach computer science. There is good coverage of introductory theory and examples on searching and sorting algorithms, complete with pictures to help you visualize the information. I had a lot of fun using the whiteboard to explain the concepts to my daughter.

I was also pretty impressed with the testing options in Python. You have the very basic doctest, which is perfect for simple projects and testing the documentation within the code. On the other side you have the unittest module, which is for more advanced projects and professional development. The doctest is a great way to first introduce testing to new and younger developers. The fact that it is so easy to unit test with Python was a real eye-opener.

There are a few chapters introducing reading and writing files, working with databases ( sqlite ), and GUI development. The database portion is strictly connection, cursors, and SQL, and the GUI development is very basic. Again, I thought the coverage was perfect for beginners, but indeed you will want to branch out and find books and examples that hit these subjects deeper.

No Web Technology

Other than a small example of urllib that grabbed a web page from the Internet, we were very surprised there weren't more meaningful web-related examples. I'm not exactly sure what I was expecting. I didn't expect Django, but maybe something that introduced Python for building dynamic websites and pointed to further information on web2py, Flask, Django, and other python-related web technologies.

Where We Strayed

The book has you do all your development in IDLE, which is a development environment that comes with Python. It's a rather ugly environment and not something I would recommend unless you really aren't that comfortable installing and using development applications. For those with a bit more experience in development, I recommend using something like Sublime Text, PyCharm, etc. We switched back and forth between Sublime Text and PyCharm. PyCharm has a free community edition. Sublime Text 3 has a free trial, but you must purchase it for prolonged use.

The book doesn't go into installing Python 3, but there is some information on the Pragmatic Programmers Website. Here again we strayed a bit from the instructions. We install everything using HomeBrew, a package manager for OS X. Again, if you are a bit more comfortable using your Mac, you may want to look into installing Python 3 using homebrew. You can actually install Python 2.7 and 3 at the same time, switching between various environments using virtualenv and virtualenvwrapper. Virtualenv and virtualenvwrapper are new to us as well, but we've been using them diligently. PyCharm supports virtualenv. Again, this isn't necessary if you don't feel comfortable getting this low-level.

Conclusion

We successfully completed the book in 3 evenings. It is a pretty easy read and will definitely teach you the basics of Python. We are going to circle back and read some older books as well as some books for kids. We also ordered a Raspberry PI to do a bit of Python programming on it. Ideally we would like to get into more of the web technology like Django, Flask, web2py, etc.

I bought the book from Pragmatic Programmers during their Thanksgiving Sale. You can find it here.