Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Game.java #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update Game.java #26

wants to merge 1 commit into from

Conversation

fhntv24
Copy link
Contributor

@fhntv24 fhntv24 commented Sep 22, 2014

Abstract class ... but it was missing abstract funcs. And if we updated GameObject , we need to update Game too, right?

Abstract class ... but it was missing abstract funcs. And if we updated GameObject , we need to update Game too, right?
@agausmann
Copy link

Not all abstract classes need to have abstract functions. Sometimes you may want to declare a class abstract so it may not be instantiated. He implements the "abstract" functions with an empty value to give the user an option to override them, which is not an uncommon practice.

@BennyQBD
Copy link
Owner

@agausmann is correct about my intentions. I've made GameObject abstract mostly to prevent people from instantiating it directly. I haven't specifically declared the methods abstract so you don't need to add a ton of empty methods to a class that really only needs to override one or two of said methods.

Unless you have a good reason why I should be doing otherwise, I think I'll keep the code as it is in this case. However, thank you very much for the pull request anyways; I do appreciate people making improvements to the codebase.

@fhntv24
Copy link
Contributor Author

fhntv24 commented Dec 2, 2014

@BennyQBD at least you should add return change - its really very usefful to do stuff like Game.AddObject(...).AddObject(...).AddObject(..) etc, or stuff like return Game.AddObject(...);

Oh, btw, show me at least one real example that doesnt use init. I cant think of anything that wont initialize at least variables to default ... Dont say put it in constructor - that wont work with ISeriaziable

@agausmann
Copy link

@fhntv24 That's true; you will nearly always need an init() method for initializing variables and such. However, most of the time, library writers give them a default definition. Another example is the WPILib used by my FRC team. It doesnot have abstract init() functions; instead, they have some default behavior like System.out.println("Default autonomousInit() method... Override me!"); Although I admit it is good practice to make user-defined functions abstract, it's probably just as common to define them as well.

@agausmann
Copy link

Can this be closed?

@IsaacWoods
Copy link

But is there any reason to do that instead of making it abstract? Every game that people will reasonably be making with the engine will need to initialise something or other; so why not have it abstract? If you are in the very small minority who don't need it, it won't kill you to have a empty definition at the bottom of your game class, and would be useful for the majority of other users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants