The easiest way to structure my code is to follow two simple rules:
• I make a function when a piece of code does one specific job, or when I notice I’m repeating the same steps in different places.
Functions help keep the code clean, reusable, and easier to understand.
• I make a class when I’m representing a real “thing” in my program like a user, a product, or an order or when some data and the functions that work on that data naturally belong together.
Classes help organize related logic so it’s not scattered everywhere.