Android Frameworks: Highlighting the Need for a Solid Development Framework 

Post on 03-Sep-2014

1.269 views 2 download

Tags:

description

 

Transcript of Android Frameworks: Highlighting the Need for a Solid Development Framework 

Android FrameworksHighlighting the need for a solid

development framework

A little about me...

● In the industry since 2002.● Started at Mutual Mobile in 2011. ● Last hair cut 2011. ● During which I’ve released 7 apps.

● Starting from scratch is unsustainable.● A framework is a common code base that is

reusable in multiple contexts● Basically its just an Android project ready to

be copied ● This is possible because most app share

common basic tasks

What is a framework

Technical benefits

● All libraries are bootstrapped and ready to play

● Prevents reinventing the wheel● Common build system interface

● Allows all team members a common ground for communication

● Allows for cross team problem solving ● Allows for easy onboarding● Unifies non collocated teams● Measure team member success

Organizational benefits

Components of a Framework

Component: REST Consumption

Most app currently leverage REST. As such this is one of your most important decisions.

● Existing Libraries○ HttpUrlConnection○ ApacheHTTPClient○ Volley○ Retrofit○ okhttp

Component: Object Serialization

While ReST services are great at returning strings, POJO’s are better.

● Existing Libraries○ Gson○ Jackson○ Simple○ Protobuf

Component: Caching

As mobile matures so do the users. Redundant REST requests won’t cut it any more.

● Existing Libraries○ Volley○ okhttp○ DiskLruCache

Component: Local Database

Invariably the app will need to keep state. Your devs will need a place to keep it.

● Existing Libraries○ Shared Preferences○ Sqlite○ Ormlite○ GreenDAO○ DB4O

Component: In App Communication

Communicating is hard, even more so if you have Asynctasks, Services and, Fragments in the mix.

● Existing Libraries○ Android intent system○ Otto○ Eventbus

Component: Automated Testing

Well done. Here are the test results: You are a horrible person. I'm serious, that's what it says: "A horrible person." We weren't even testing for that.

-- GLaDOS / Portal 2

● Testing Options and Support Libraries○ Android Test Projects○ JUnit○ Robolectric○ Mockito○ Robotium○ uiautomator

Component: Build system & CI

Autonomous build creation is a wonderful thing and gives you moment to moment status of your projects.

● Existing Options○ ANT build process○ Maven (kinda...)○ Gradle build process

Additional Considerations

This is not an exhaustive list keep your eyes open for other things as well.

● Logging● Crash reporting● Code Metrics● Image loading

Component: Glue

Even with the best libraries selected a successful framework needs to be pulled together.

Mutual Mobile’s Framework

Praxis: the process by which a theory, lesson, or skill is realized.

● Libraries Used○ ApacheHTTPClient○ Gson / Simple○ DB4O○ Otto○ JUnit / Robotium○ ANT○ Dagger

Care and feeding of your framework

● Frameworks only last so long.● Some of the libraries listed haven’t had their

first birthday yet.● Keep looking for new ways to improve and

adapt.

Keeping up with the times

● Some examples from Mutual Mobile’s framework○ On 2.2 we used a segmented controller but, after

ICS we changed to Android’s Actionbar.○ We used singletons and static members to keep

system state, now we use our DI framework to moderate standard POJOs, holding state

○ We used Handlers to communicate AsyncTask results, now we ride the bus.

Questions?