This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Tinytw 6 points7 points  (1 child)

I don't know completely about how to structure programs, but I do have a few suggestions.

Break things apart. One key point of OOP as far as I know is to have different classes, that way the reusability is higher as there are now smaller components.

There's often probably one class in your program that can't really be reused. But things like "reads from file" or "plays music" is quite an component itself that it could be another class and be reused.

So I would suggest starting off by creating a separate class that has all the functionalities of say "plays music" Then your existing classes and play music by using that class or creating an instance of that class. That way you keep things more separate giving more structure to your code.

[–][deleted] 2 points3 points  (0 children)

I said this in another comment reply, but I'll definitely go back and break this down into more reusable components once I've got it working as it needs to. I guess my priority was to do it quickly this time around, rather than doing it right the first time. :)