cioccarellia/kite

Why Context is private?

Closed this issue · 3 comments

Why keep context variable private?
It would be helpful if we can also access the current context from Kite just like resources.

Like :

Kite.context and Kite.applicationContext

Well, there are a couple of reasons to keep it private. Namely:

  • The application context should be globally accessible anyways, so it makes no sense to make it visible
  • Whichever local specific context you set to be kite's, it's not a good idea to reach for it outside of its original scope.

Yes, you are right about the local specific context but if Kite can provide applicationContext than it will save us from taking our own static variable for applicationContext.

So I think Kite.applicationContext this might be a good feature request.
And we also won't need to manage both static variable applicationContext + Kite.cahangeContext in case of Locale or theme update.

I believe that making context public does not bring clarity/usefulness overall, but instead gives developers one more thing to think about. Kite is simple, and made to be simple, so as long as the project mission does not change context is going to stay private.

Plus, it makes more sense for someone who does not use/know about kite but reads code who uses kite where the context is actually from.