Hello Android developers,

I'd like to announce the final release of RoboGuice 1.0!

http://code.google.com/p/roboguice

RoboGuice is a framework that brings the simplicity and ease of Dependency 
Injection to Android, using Google's own Guice library.  If you've ever used 
Spring (the #1 enterprise framework on Java, now more popular than J2EE itself) 
or Guice, you already know how convenient this style of programming can be.

To give you an idea, take a look at this simple example of a typical Android 
activity:

class AndroidWay extends Activity {
    TextView name;
    ImageView thumbnail;
    LocationManager loc;
    Drawable icon;
    String myName;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        name      = (TextView) findViewById(R.id.name);
        thumbnail = (ImageView) findViewById(R.id.thumbnail);
        loc       = (LocationManager) 
getSystemService(Activity.LOCATION_SERVICE);
        icon      = getResources().getDrawable(R.drawable.icon);
        myName    = getString(R.string.app_name);
        name.setText( "Hello, " + myName );
    }
}


This example is 18 lines of code.  If you're trying to read through onCreate(), 
you have to skip over 5 lines of boilerplate initialization to find the only 
one that really matters: name.setText().  And complex activities can end up 
with a lot more of this sort of initialization code.

Compare this to the same app, written using RoboGuice:

class RoboWay extends GuiceActivity {
    @InjectView(R.id.name)             TextView name;
    @InjectView(R.id.thumbnail)        ImageView thumbnail;
    @InjectResource(R.drawable.icon)   Drawable icon;
    @InjectResource(R.string.app_name) String myName;
    @Inject                            LocationManager loc;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        name.setText( "Hello, " + myName );
    }
}

In this example, onCreate() is much easier to take in at a glance.  All the 
platform boilerplate is stripped away and you're left with just your own app's 
business logic.  Do you need a SystemService?  Inject one.  Do you need a View 
or Resource?  Inject those, too, and RoboGuice will take care of the details.  

RoboGuice's goal is to make your code be about your app, rather than be about 
all the initialization and lifecycle code you typically have to maintain in 
Android.

RoboGuice has been in development since August 2009, and 0.9 entered release 
candidacy in December and has been stabilizing ever since. After three months 
and a few finishing touches, we now believe it's ready to expose to a larger 
audience.

We know that RoboGuice won't be for everybody.  Although RoboGuice never 
prevents you from doing things the Android way, some people will still prefer 
seeing everything spelled out explicitly in their code.  And other people who 
write extremely high performance applications such as games may not want to 
incur the small overhead imposed by yet another framework.  But for people who 
want to build simple and straightforward code that's easily testable and easy 
to read, I encourage you to give RoboGuice a try.

We hope you like it.  Stop by our discussion forums if you'd like to have any 
help getting started.

Cheers,
Mike


PS. We're beginning work on RoboGuice 1.1 now, which will include more 
injectible objects, better unit testing support, and hopefully some general 
usability improvements as well.  I'd love to hear your thoughts on other things 
you'd like to see in the next release. 





-- 
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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to