ProgrammingPro🎄#86🥂: Python Debugging Best Practices, Go’s API Surge, Google's Jules Coding Agent, and Netflix's Scalable Counters
"It's the Most Wonderful Time of the Year🌟...It's the hap-happiest season of all" 🎵 - Andy Williams
Welcome to our very last issue, for the year 2024! We will be taking our usual year end break and return again on the 16th of January 2025. In the meanwhile, do keep any eye out. Packt x Santa🎅 are busy working on some unmissable deals for you to unwrap over the holidays! Now let's get down to business.
In today’s Expert Insight, we bring you an excerpt from the recently published book, Learn Python Programming - Fourth Edition, which demonstrates best practices for creating custom debugging functions in Python.
News Highlights: Python is set to win Tiobe's "Language of the Year" for its growth in AI and data mining; Go overtakes Node.js in API requests with a 40% rise; Google introduces Gemini 2.0 and AI coding agent Jules; and SQLite is re-implemented in Rust for async I/O and memory safety.
My top 5 picks from today’s learning resources:
How AMD Is Taking Standard C/C++ Code To Run Directly On GPUs🚀
Inside Netflix’s Distributed Counter: Scalable, Accurate, and Real-Time Counting at Global Scale🌍
But there’s more, so dive right in.
Before signing off, I would like to say thank you to all readers who have been on this journey with me this year. A very Merry Christmas and Wonderful New Year 2025 to you all!
Don't forget to Stay Awesome!
Divya Anne Selvaraj
Editor-in-Chief
🗞️News and Analysis🔎
Python a shoo-in for Tiobe language of the year: Python is expected to win Tiobe’s "Programming Language of the Year" for 2024 due to a significant 10% increase in popularity ratings, driven by its dominance in AI, data mining, and ease of learning.
Go eclipses Node.js in web API requests, Cloudflare reports: Go has overtaken Node.js as the leading language for automated API requests, accounting for 11.8% of traffic, with Go's share rising 40% and Node.js declining 30%.
Ruby on Rails 8.0 Released, Introduces Kamal 2 for Improved Deployments: Key updates also include SQLite-based adapters, a new asset pipeline, enhanced authentication tools, and deprecated feature removals.
Java News Roundup: JDK 24 in Rampdown, JDK 25 Expert Group, Jakarta EE 11 Core Profile, Spring Cloud: Other highlights include updates to frameworks like GlassFish, Open Liberty, Quarkus, Apache Camel, and others.
Google announces Gemini 2.0 Flash and new coding agent: Jules, an AI-powered coding agent, is designed to assist with Python and JavaScript tasks, including debugging, modifying multiple files, and creating pull requests.
SQLite re-implemented in Rust to achieve asynchronous I/O and other changes: Turso is re-implementing SQLite in Rust as "Limbo" to enable asynchronous I/O, memory safety, and modern architecture while ensuring compatibility with SQLite.
OpenSilver 3.1 adds new drag-and-drop XAML designer for VS Code: The designer comes with over 100 controls, cross-platform compatibility, a modern UI theme, expanded WPF feature support, and full .NET 9 compatibility.
React 19 is stable, team directs devs towards frameworks – especially Next.js: React 19 is now stable, introducing server components to the main channel, improved pre-rendering APIs, and enhanced suspense features.
🎓Tutorials and Learning Resources💡
Python
🎓Tutorial | Linear Regression in Python: Demonstrates implementing simple, multiple, and polynomial regression in Python using libraries like scikit-learn and statsmodels, covering key concepts such as underfitting and overfitting.
For more Python resources, go to PythonPro
C# and .NET
🎓Tutorial | Using vectorization in C# to boost performance: Explains how vectorization in C# was used to optimize the
Summethod in .NET 8, leveraging SIMD principles and advanced techniques like loop unrolling.🎓Tutorial | Building a Multi-Tenant Configuration Management System with .NET Core, Redis, and Dependency Injection: Combines local disk caching for quick access, Redis for distributed caching, and a Pub/Sub model.
🎓Tutorial | Central Package Management (CPM) in .NET — Simplify NuGet Dependencies: Explains how CPM achieves simplification by centralizing package version control in a single
Directory.Packages.propsfile.
C and C++
💼Case Study | How AMD Is Taking Standard C/C++ Code To Run Directly On GPUs: AMD is working on porting LLVM's C/C++ run-times to GPUs, bypassing the need for GPU-specific languages like OpenMP or OpenACC.
🎓Tutorial | Learning to read C++ compiler errors: Nonsensical errors from a function declaration: Explains how conflicting macros in C++ projects can lead to compiler errors, using the case of a macro named
ErrorMessage.🎓Tutorial | Refactoring in C++: Top Techniques and Best Practices: Covers methods such as renaming variables, extracting functions, simplifying conditionals, and reducing duplication, along with best practices.
Java
💼Case Study | QCon SF 2024: Refactoring Large, Stubborn Codebases: Stripe engineers share strategies for refactoring large, stubborn codebases leveraging centralized teams, tools like Sorbet for Ruby, and more.
🗞️Malicious Maven Package Impersonating 'XZ for Java' Library Introduces Backdoor Allowing Remote Code Execution: Socket researchers have uncovered a malicious Maven package,
io.github.xz-java:xz-java, impersonating the legitimateXZ for Javalibrary (org.tukaani:xz).🎓Tutorial | Peering through the peephole: build a peephole optimiser using the new Java Class-File API: Demonstrates building an optimizer that removes redundant instructions (e.g., unnecessary zero addition) and more.
JavaScript and TypeScript
💡What is TypeScript? Strongly typed JavaScript: Introduces TypeScript as a strongly typed superset of JavaScript, highlighting its enterprise-level features, compatibility, and advantages for large-scale application development.
💡Everything About Barrel Exports In JavaScript: Examines the benefits, challenges, and best practices of using barrel exports to simplify imports, improve code organization, and balance performance and maintainability.
🗞️Malicious npm Package Typosquats Popular TypeScript ESLint Plugin, Exfiltrates Data and Enables Remote Exploitation: A secondary malicious package,
@typescript_eslinter/prettier, remains live, escalating the risk.
Go
🎓Tutorial | Data structures as jigs for programmers: Discusses implementations including basic and dynamic arrays, multidimensional arrays, bitsets, binary heaps, and hash tables, with practical use cases and code examples.
🗞️Coming in Go 1.24: testing/synctest experiment for time and concurrency testing: Introduces the experimental
testing/synctestpackage in Go 1.24, designed to improve testing involving time and concurrency.
Rust
💼Case Study | I spent 2 years rebuilding my algorithmic trading platform in Rust. I have no regrets: Discusses the author's experience transitioning their algorithmic trading platform from Typescript to Rust.
💡Thoughts on Rust hashing: Critiques Rust's hashing model, which separates
HashandHashertraits for flexibility, highlighting inefficiencies in handling block-wise hashing, variable-length inputs, and more.
Swift
🎓Tutorial | Migrating XCTest to Swift Testing: Provides a migration guide using modern features of Swift Testing, such as concurrency and macros, its improved test setup, teardown processes, and flexible assertion macros.
🎓Tutorial | SF Symbol: How to for Swift & SwiftUI: Explains how to use, customize, and animate Apple's SF Symbols in Swift and SwiftUI, leveraging the SF Symbols app for integration and design consistency in apps.
PHP
🎓Tutorial | Parsing HTML with PHP 8.4: Discusses the new HTML5 parser, CSS selector support, and updated DOM classes in PHP 8.4, which improve HTML parsing, DOM manipulation, and web development efficiency.
🎓Tutorial | Implementing Dependency Inversion Principle (DIP) using Laravel: Demonstrates implementing DIP by decoupling
UserServicefrom specific repository dependencies through aRepositoryManagerInterface.
SQL
💡Some useful SQL(ite) tips I've learned: Includes tips such as splitting data into buckets, advanced ordering without additional columns, JSON querying with shorthand operators, string concatenation, and default values for NULLs.
🎓Tutorial | A Beginner’s Guide to Procedural Programming Beyond SQL with Toad for Oracle: Covers the fundamentals of PL/SQL, its advantages for database programming, and practical tips for efficient PL/SQL development.
Ruby
🎓Tutorial | Mastering Ruby Debugging: From puts to Professional Tools: Provides a comprehensive guide to debugging in Ruby, covering basic techniques like
putsstatements, interactive consoles, and advanced tools.💡Advent of Criminally Bad Ruby Code: Humorously chronicles the author's exploration of unconventional and experimental Ruby coding practices, showcasing creative abuses of Ruby features.
Kotlin
💡When to Use Retrofit and When to Use Ktor: A Guide for Android Developers: Compares two popular HTTP clients for Android, detailing their strengths and scenarios for use.
🎓Tutorial | 5 steps to implement MVI architecture with Jetpack Compose: Covers setting up dependencies, defining the Model, ViewState, and Intent layers, managing the state and events in a ViewModel, and creating a reactive UI layer following MVI principles.
🌟Best Practices and Advice🚀
Inside Netflix’s Distributed Counter: Scalable, Accurate, and Real-Time Counting at Global Scale: Explains the system which balances performance, accuracy, and cost through configurable modes and event-driven architecture.
Beat the Plan: Probabilistic Strategies for Successful Software Delivery at Scale: Advocates for adaptive systems over rigid plans, leveraging continuous processes, prioritization, constraints, and a culture of learning.
How to Become a Principal Engineer: Discusses the required technical and leadership skills, strategies for career growth, and how companies can define and support the role for maximum impact.
On over-engineering; Architecture Edition: Discusses balancing over-engineering and under-engineering in architectural decisions, using the author’s project, Collecto, as an example.
🧠Expert Insight📚
Here’s an excerpt from “Chapter 11: Debugging and Profiling" in the book, Learn Python Programming - Fourth Edition by Fabrizio Romano and Heinrich Kruger, published in November 2024.
Debugging with a custom function
Having a custom debugging function saved in a file somewhere that you can quickly grab and paste into the code can be particularly useful. If you are fast, you can also code one on the fly. The important thing is to write it in such a
way that it will not leave anything behind when you eventually remove the calls and their definitions. Therefore, it is important to code it in a way that is completely self-contained. Another good reason for this requirement is that it will avoid potential name clashes with the rest of the code.
Let us see an example of such a function:
# custom.py
def debug(*msg, print_separator=True):
print(*msg)
if print_separator:
print("-" * 40)
debug("Data is ...")
debug("Different", "Strings", "Are not a problem")
debug("After while loop", print_separator=False)
$ python custom.py
Data is ...
----------------------------------------
Different Strings Are not a problem
----------------------------------------
After while loop
As you can see, there is no separator after the last line.
This is just one easy way to augment a simple call to the print() function. Let us see how we can calculate a time difference between calls, using one of Python’s tricky features to our advantage:
# custom_timestamp.py
from time import sleep
def debug(*msg, timestamp=[None]):
from time import time # local import
print(*msg)
if timestamp[0] is None:
timestamp[0] = time() # 1
else:
now = time()
print(f" Time elapsed: {now - timestamp[0]:.3f}s")
timestamp[0] = now # 2
debug("Entering buggy piece of code...")
sleep(0.3)
debug("First step done.")
sleep(0.5)
debug("Second step done.")
This is a bit more complicated. First, notice that we used an import statement inside the debug() function to import the time() function from the time module. This allows us to avoid having to add that import outside the function and risk forgetting to remove it.
Look at how we defined timestamp . It is a function parameter with a list as its default value. In Chapter 4, Functions, the Building Blocks of Code, we warned against using mutable defaults for parameters because the default value is initialized when Python parses the function, and the same object persists across different calls to the function. Most of the time, this is not the behavior you want. In this case, however, we are taking advantage of this feature to store a timestamp from the previous call to the function, without having to use an external global variable. We borrowed this trick from our studies on closures, a technique that we encourage you to read about.
After printing the message, we inspect the content of the only item in timestamp . If it is None , we have no previous timestamp, so we set the value to the current time (#1 ). On the other hand, if we have a previous timestamp, we can calculate a difference (which we neatly format to three decimal digits), and finally, we put the current time in timestamp ( #2 ).
Running this code outputs the following:
$ python custom_timestamp.py
Entering buggy piece of code...
First step done.
Time elapsed: 0.300s
Second step done.
Time elapsed: 0.500s
Using a custom debug function solves some of the problems associated with just using print() . It reduces duplication of debugging code and makes it easier to remove all your debugging code when you no longer need it. However, it still requires modifying the code and running it in a console where you can inspect the output. Later in this chapter, we will see how we can overcome those difficulties by adding logging to our code.
Learn Python Programming - Fourth Edition was published in Novemver 2024. Packt library subscribers can continue reading the entire book for free or you can buy the book here!
Get the eBook for $35.99 $24.99
🛠️Useful Tools⚒️
Holos: A Go CLI tool using CUE to replace YAML templating in Kubernetes, streamlining Helm and Kustomize configurations with type-safe, unified management.
cal.com: An open-source, self-hosted alternative to Calendly, offering complete control over scheduling, data, and workflows, with extensive customizability.
sqlfluff: A highly configurable, dialect-flexible SQL linter and auto-formatter that supports templating systems like Jinja and dbt, ensuring error-free SQL code.
That’s all for today.
We have an entire range of newsletters with focused content for tech pros. Subscribe to the ones you find the most useful here.
If your company is interested in reaching an audience of developers, software engineers, and tech decision makers, you may want to advertise with us.
If you have any suggestions or feedback, or would like us to find you a learning resource on a particular subject, just leave a comment below!





