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
x/mobile/event: lifecycle APIs are overly complicated #11619
Comments
The lifecycle model is complicated, but I'm not convinced it's too complicated. Apps have a lot of fundamental states. My old model hid a lot of stages that a typical game-like app doesn't need, but it's not clear that was the right approach. My thinking on this is that simpler app models belong at a higher level. For example if exp/sprite got a 2D game engine (even as an optional extra package), it could end up managing lifecycle for a user and presenting a much higher-level interface. Similarly an all-Go UI could provide an optional management system that took care of the primary event loop for some common class of apps. As to the notion that it's of Go invention, that's true, but I given the general confusion I've seen over the Android/iOS models I don't expect users to come in with a good understanding of any of those systems. I'm not sure what "pushed to the user" means. Could you elaborate? |
I'd have to agree here. I mean, after some browsing through the code it becomes a bit clearer what it does and how it works, however, it still looks a bit complicated to comprehend. What was the reason to have stages and have positive and negative passes through them? Why wasn't the Android model of having two callbacks per stage (e.g. From the documentation, it does not become apparent also that all the events occur on the OpenGL thread. My initial assumption was that only events in the Additionally, it seems that the Finally, the basic example uses the |
As a user, I admit that the lifecycle event model wasn't obvious by just looking at client code and had to check out the docs and source code. It is however pretty easy to grasp. The good: with the way crosses work, there is no need to send fake events for intermediary stages/states that are not handled on a given platform. For example, right now on X11 the first and last lifecycle event is from StageDead to StageFocussed, yet Crosses allow the user to check that the app has reached StageAlive and StageVisible and act upon it as if they had actually been sent. Of course, the user has to understand that both stages could be crossed in a single event and should be handled in the proper order upon app startup and shutdown. Then again, it's not overly complicated. The bad: my only gripe with it could be the wording of the API and some needed improvements to the documentation:
IMHO, this API provides a neat wrapper around platform specific event models (that I do not want to bother with), and it can easily be extended by adding intermediary stages should a given platform require it. |
The new lifecycle events and having to deal with crosses to determine basic states are both overly complicated for an average user. Majority of the time, users don't want to have a good understanding of the lifecycle's itself but want to perform actions such as freeing resources or stopping the playback at certain states. Currently, Go mobile has a novel (invented here™) event model that requires user to have good understanding of its novel terminology and application lifecycle details. The new event model is a big barrier for new and existing users.
I'd, at least, prefer
LifecycleStageInvisible
andLifecycleStageDestroyed
to be pushed to the user, it's very unlikely the users will be comfortable with determining these fundamental states themselves.The text was updated successfully, but these errors were encountered: