Type something to search...

Blog

Building an Event-Driven Audit Log with MongoDB Change Streams

Building an Event-Driven Audit Log with MongoDB Change Streams

Every team eventually gets the question: "Who changed this order, and what did it look like before?" The usual first answer is to add audit logging i

Continue Reading
Enums in Python: Replacing Magic Strings and Numbers

Enums in Python: Replacing Magic Strings and Numbers

Every codebase has them: if status == "shiped":, if role == 3:, set_mode("fast"). Magic strings and numbers work right up until someone makes a

Continue Reading
Abstract Base Classes in Python with the abc Module

Abstract Base Classes in Python with the abc Module

Python leans on duck typing: if an object has the method you need, you call it and move on. That works well until you have a family of classes that a

Continue Reading
Dataclasses in Python: Less Boilerplate, More Clarity

Dataclasses in Python: Less Boilerplate, More Clarity

A lot of classes exist mainly to hold data: a product with a SKU and a price, a config object with a host and a port, a point with x and y. Writing t

Continue Reading
Class Methods vs Static Methods vs Instance Methods in Python

Class Methods vs Static Methods vs Instance Methods in Python

Python classes can have three kinds of methods. Regular instance methods are the ones you write all the time. Then there are methods decorated with `

Continue Reading
@property in Python: Getters, Setters, and Computed Attributes

@property in Python: Getters, Setters, and Computed Attributes

If you've come to Python from Java or C#, your instinct when writing a class might be to make every field private and add get_price() and `set_pric

Continue Reading