Last time, I talked about ways to use dynamic typing to manage objects and business logic in your code. Doing so involves leaning into the object system, going beyond just “one class for each noun” and creating objects to model different states within the business logic directly.
In a basic Object-Oriented design, you might have an object called User
. This object, by itself, represents the entire concept of a user within the system. In this design, specific states of a user — admin, unauthorized, deleted, subscriber, what have you — are all represented by the single class User
.
That’s one way to model users. But you could also have the User
class be a home for the underlying data and manage…