When to split up code in OOP
Posted: Sun Nov 24, 2013 11:52 pm
So. I'm learning Java and I'm working on some practice stuff. I just have one issue. I get the concepts, I know the basic stuff, all of that good stuff. I just don't know when to split stuff up into different classes, methods, objects, etc. When exactly should you split something into a new object, or a new method, or a new class? I get it's something like this:
Class - Cabinet
Object - Big Cup, Little Cup
Method - Cabinet Open, Cabinet Close, Remove Big Cup, Remove Little Cup, Place Big Cup, Place Little Cup
So should all of those things be separated? Or should Add a Cup be one method with the options to do little or big with removing the same way? Are the methods similar to functions in PHP?
OR is all of this dumb and I should just code and find out?
Class - Cabinet
Object - Big Cup, Little Cup
Method - Cabinet Open, Cabinet Close, Remove Big Cup, Remove Little Cup, Place Big Cup, Place Little Cup
So should all of those things be separated? Or should Add a Cup be one method with the options to do little or big with removing the same way? Are the methods similar to functions in PHP?
OR is all of this dumb and I should just code and find out?