Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialEdward Citalan
Python Development Techdegree Graduate 11,397 PointsWhy create more classes and not methods?
For the questions.py file why did he create two additional classes—e.g., class Add & class Multiply—and not methods inside the class question?
1 Answer
Jeff Muday
Treehouse Moderator 28,722 PointsYou have good insight! Yes, you definitely could create a single class to represent the questions and make it more "method" driven. Kenneth is trying to keep it simple while giving you a good idea of how to think through an object-oriented design project.
One thing he does that is a "winner" of an idea is to write out his ideas as comments as an outline for the project.
Certainly, you could reimagine the project yourself and think of the most logical way to design it-- especially using the Python DRY (don't repeat yourself) paradigm. I am sure there are probably several great ways to do it that would make as much or even more sense.