2021-11-14

2021-11-14 Sunday - Book Review: Python for Geeks

 

(image source: Amazon.com)

Amazon: Python for Geeks: Build production-ready applications usingadvanced Python concepts and industry best practices

  • Pages: 546 
  • Published: 2021-10-20

Companion Github Repository: https://github.com/PacktPublishing/Python-for-Geeks

By: Muhammad Asif, (Automation CoC & delivery Lead (ME & Africa) | Principal Solution Architect, Nokia)

https://www.amazon.com/Muhammad-Asif/e/B097R72LW1/

"Muhammad Asif is a software engineer and principal solution architect with a wide range of multi-disciplinary experience in web development, network and cloud automation, virtualization, and machine learning. With a strong background in multiple domains, he has led many large-scale projects to successful deployment in customer production environments. Although moving to more leadership roles in recent years, Muhammad has always enjoyed solving real world problems by using appropriate technology and with skilled teams. Muhammad earned a Ph.D. degree in Computer Systems from Carleton University, Ottawa, Canada in 2012. He has worked for top companies like General Electrics, Eaton Corporation and Alcatel-Lucent. Currently, he is working for Nokia as a solution prime, building automation solutions for large scale network and cloud service providers"

 

(My review on Amazon)  

(My LinkedIn post mentioning this review)

Full Disclosure:

I was invited to review this book by Pooja Yadav (Senior Marketing Coordinator, Packt) - who graciously provided me with a free PDF copy of the book to read.

Short Summary

This book is a broad survey about getting things done with Python.

As noted in the Preface section of the book: “This book is for intermediate-level Python developers”.

While a beginning programmer will certainly get good value out of this book (and learn mature Python software development practices from the beginning) - it is likely to be of greater value to the programmer who has some prior experience with Python – and that may have some urgent need to quickly become effective getting some things done with Python.

The book is quite ambitious – and attempts to cover a significant breadth of Python programming topics – at the risk of sometimes too shallow a treatment.

I noted that the author states that the examples in the book were tested against Python 3.7 and 3.8 – and are expected to work with any future 3.x release. Note: Python 3.10 was the latest stable release at the time of my review.

 

What I particularly liked:

The companion github repository (with code examples) for the book.

The format for each chapter includes a Summary, Questions, Further reading, and Answers. 

The Further reading sections offer a multitude of good recommendations.

The length of each chapter is reasonable – and reasonably organized.

Chapter-1 does a good job of introducing some of the organizational considerations / mechanics of preparing for the coding activities that follow.

Chapter-2 is an important topic (modularization for complex projects) that establishes good practices at the beginning – as opposed to the typical introductory book that begins with simple examples – that introduce bad habits that only have to be rectified later.

Chapter-3’s coverage of testing.

Chapter-9’s coverage of Python Programming for the Cloud.

Chapter-12’s coverage of Serverless Functions

Chapter-14’s coverage of event-driven design considerations.


What could be improved in the next edition:

Overall, the book could be improved by using a consistent enterprise-class design problem as a unifying thread across the various chapters. This might also warrant considering a name change for the next edition, perhaps: Enterprise Python.

Chapter-1 does a great disservice to the reader, by not clearly, explicitly, and strongly advocating for the adoption of virtual environments (using virtualenv, or pipenv), as a standard development practice, from the beginning. Note: The book waits until page-324 to introduce them. Chapter-1 should also include a discussion of pros/cons of using the Anaconda Distribution – and conda (vs. pip, post 20.3 release). I would argue that use of virtual environments is at least of equal importance  - as guidance on documenting code.

Chapter-1’s statements about Docker containers, as a recommendation  - on page-12, should be reviewed, in light of the change to Docker’s licensing changes in 2021 (Docker ended the free Docker Desktop for enterprise users – forcing enterprise customers to sign-up for a paid plan to use its Desktop application)  – and the greater trend to adopt Kubernetes, over Docker, across the enterprise.

Chapter-1, page-22, should clarify that PEP 8 is a Style Guide.

Chapter-1’s discussion on documentation would also benefit from a mention of leveraging Pylint’s additional command (Pyreverse) to generate UML diagrams.

Chapter-3’s coverage of Advanced Object-Oriented Programming feels somewhat incomplete, or premature – before basic OOP has been covered. Or the title conveys a more ambitious teaching goal…than is actually achieved within the limited scope of the chapter’s pages.

Chapter-3 would also benefit from inclusion of a discussion of Functional Programming style of Python vs. the OOP style.  

A chapter to cover examples of some standard software design patterns – implemented in Python.

Chapter-4 should also include messaging and streaming. Suggested: Apache Kafka, or MQTT for examples. I note that Apache Kafka is touched on in Chapter-14 (Network Automation) – but believe it would be better to have Kafka included in Chapter-4.

Chapter-5 should also include a section on performance testing – and guidance (or library suggestions) for capturing, reporting, and visualizing performance benchmark results

Chapter-7 would benefit from inclusion of a discussion on different standard enterprise patterns for distributed computation.

Chapter-8 would benefit from inclusion of a performance benchmark graph – to help substantiate the understanding in the reader’s mind of the performance claims on page-277.

Chapter-8 should include a discussion of designing and deploying Python solution within Kubernetes clusters. Or this could be added to Chapter-11.

Chapter-10 should cover encrypting API traffic via TLS, as well as API Authentication and Authorization. Page-358 should explicitly call out that SSL should no longer be used – and TLS 1.2 should be minimally enforced.

Chapter-10, page-358, should include a recommendation to consider using OpenAPI Specification (OAS) 3.x for defining and documenting APIs.

Chapter-10 should also cover gRPC and GraphQL type APIs – which are more relevant today than the mention of SOAP or CORBA (see page-376) – and an overview of the relative performance trade-off considerations between REST vs. gRPC vs. GraphQL – and in particular when considering Backend-as-Frontend patterns – with mixed device type requirements (e.g., Web UI, mobile, IoT, etc.). Regrettably, gRPC is buried in Chapter-14.

Chapter-11, page-396, in the logging /monitoring - should include a mention of Prometheus.

Chapter-11 should include some basic examples to illustrate the use of Python code/libraries to perform basic API authentication (e.g., OAuth 2.0 Client Credentials Flow, OpenID Connect, etc.)

Chapter-13 – as an introduction to Machine Learning is fine, but I have a feeling that the author has two or three books, struggling to emerge in this single book. Perhaps he should consider a series of books:  Python for the Enterprise, Python for Data Science Geeks, Python for Machine Learning Geeks, etc.  I would be inclined to remove Chapter-13 in a future edition – as it is impossible to do the topic justice in the less than 25 pages allocated.

I noted an absence of any mention of some of the many excellent Github “awesome” type lists – which are great resources for finding useful libraries to solve myriad problems. In many of the “Further reading” sections, at the end of chapters – it would be great to see some of these github repositories cited as well.


Table of Contents:

Section 1: Python, beyond the Basics

1 – Optimal Python Development Lifecycle

2 - Using Modularization to Handle Complex Projects

3 - Advanced Object-Oriented Python Programming

 

Section 2: Advanced Programming Concepts

4 - Python Libraries for Advanced Programming

5 - Testing and Automation with Python

6 - Advanced Tips and Tricks in Python



Section 3: Scaling beyond a Single Thread

7 - Multiprocessing, Multithreading, and AsynchronousProgramming

8 - Scaling out Python using Clusters

9 - Python Programming for the Cloud

 

Section 4: Using Python for Web, Cloud, and Network Use Cases

10 - Using Python for Web Development and REST API

11 - Using Python for Microservices Development

12 - Building Serverless Functions using Python

13 - Python and Machine Learning

14 - Using Python for Network Automation

 

My additional notes

Chapter-14 references certain Nokia developer resources. These are my research notes…

 

Additional suggestions for other Python books to read:

 

 

No comments:

Copyright

© 2001-2021 International Technology Ventures, Inc., All Rights Reserved.