On Sun, Aug 22, 2010 at 7:05 AM, Doug Gordon <[email protected]> wrote:
> I also miss the ability to simplify life (at least as far as writing the > initial code is concerned) by being able to fall back on "global" variables > that are visible everywhere. > Well, you can, technically still use "global" variables in Java, but I would certainly argue that they usually complicate life, not simplify it. On Sun, Aug 22, 2010 at 8:05 AM, Zsolt Vasvari <[email protected]> wrote: > IMHO, any object that doesn't need a Context or one of its super or > subclasses, is not really targeting the Android platform. > I completely disagree. Sure, you need Context pretty much everywhere the UI and other Android specifics are concerned, but your core objects that represent the general layout of your application should not know anything about what a Context is or have any reason to use it. Just because Context is usually readily available (in your Activity or Service) does not mean you should force arbitrary dependencies on it. The Android specific code can obviously factored out of any class using the > Strategy patttern, but I think that just complicates the design and mostly > a useful exercise only for cross-platform libraries. I think (a variation of) MVC is more appropo in this case and definitely simplifies things, IMO. Example: in my app I have a "Bus" object. This has absolutely no reason to know about Context or the Android platform in general. However, when I, say, plot a bus on a map, it's *view* knows about the bus and how it should be displayed, using the current Context. I agree with everything else, though. ------------------------------------------------------------------------------------------------- TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

