Droidcon 2011: Effective android programming with object forms

Post on 17-Dec-2014

1,152 views 0 download

description

Pavel Lahoda, Perpetum DesignMobile application development is one of most dynamically expanding areas, with hundreds of thousands of applications filling virtual shelves of various application stores. There are dozens of new devices every year with new capabilities, and often with different form factors, which makes the UI development across multiple devices quite challenging. Mobile platforms, such as Android, tends to aid there by introducing concepts brought over from the web applications development, where UI elements are declared in markup language and later glued to the (Java) code. This often results in software that is difficult to comprehend, expensive to maintain, next-to-impossible to reuse and most of all : inefficient.ObjectForms provide an alternative approach. It relies on Java language features, such as introspection to completely eliminate many layers that older approaches deemed necessary to boost both efficiency and reliability of the mobile application development. This talk will look at several myths that are tied to "traditional" approach and provide alternatives. Presentation will explain following :- how Java can be as declarative as XML- removing unnecessary hooks will help the productivity- variations are best handled by polymorphism and conditional statements- reusing code is possible with sticking to OO principlesThe talk is quite compact and has several demos and examples of real, working code.

transcript

Effective Android Programming with ObjectForms

Pavel Lahoda, droidcon Berlin 2011čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

2010 : year when demand for mobile application development exploded.

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

So many development projectsSo little time

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Solution ?Be Effective !

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

What effective means ?

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Make less steps

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

No detours

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Releasing application is great feeling, but...

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

...think about the entire lifecycle

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Create no holes

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Use right tools

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Java IDE is your best friend

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

“The most powerful tool for detecting and revealing errors is your compiler. No XML files should be used and code should be written in a way that gives the compiler the opportunity of performing this task as good as possible.”

Apache.orgThe principle of string-free coding

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Encapsulate your components

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Strings are nasty beasts

čtvrtek, 24. března 2011

XML Space invaders

čtvrtek, 24. března 2011

Avoid excessive typingchevron |ˈ sh evrən|nouna line or stripe in the shape of a V or an inverted V, esp. one on the sleeve of a uniform indicating rank or length of service.

ORIGIN late Middle English (in heraldic use): from Old French, based on Latin caper ‘goat’ ; compare with Latin capreoli (diminutive of caper) used to mean ‘pair of rafters.’

chevronitis |ˈ sh evrənitis|nouna a disease characterized by obsessive typing of strange characters on the computer keyboard, such as chevrons.

ORIGIN late 20th century fell in love of typing enormous amounts of chevrons and other strange characters while “programming”, causing a lot of weird injuries to fingers and hands.

-itissuffixforming names of inflammatory diseases : cystitis | hepatitis.• informal used with reference to a tendency or state of mind that is compared to a disease : creditcarditis.ORIGIN from Greek feminine form of adjectives ending in -itēs (combined with nosos ‘disease’ implied).

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Chevronitis hurts

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Alternative ? Meet custom ViewGroup

čtvrtek, 24. března 2011

Empty ViewGroup

čtvrtek, 24. března 2011

ViewGroup constructedčtvrtek, 24. března 2011

ViewGroup layout()

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Not quite working yet...

čtvrtek, 24. března 2011

ViewGroup onMeasure()čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

That’s a lot of Java code !

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Reflection to the rescue

čtvrtek, 24. března 2011

Simplified ViewGroup

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

How AVG works

čtvrtek, 24. března 2011

Inside ViewGroupHelper

čtvrtek, 24. března 2011

AVG Usage

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Need more declarative control ?Annotations !

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Already learned a lot of principles

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Time to take it to the next level

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Keep it simple

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Don’t repeat yourself

čtvrtek, 24. března 2011

Introducing ObjectForms

www.objectforms.comčtvrtek, 24. března 2011

Trivial Examplečtvrtek, 24. března 2011

Trivial Examplečtvrtek, 24. března 2011

Trivial Examplečtvrtek, 24. března 2011

Hello Worldčtvrtek, 24. března 2011

Hello Worldčtvrtek, 24. března 2011

Hello Worldčtvrtek, 24. března 2011

Hello Worldčtvrtek, 24. března 2011

čtvrtek, 24. března 2011

More declarative

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Sample application

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Inside the Sample application

čtvrtek, 24. března 2011

Both modes for free

čtvrtek, 24. března 2011

Both modes for free

Auto Portrait mode

čtvrtek, 24. března 2011

Both modes for free

Auto Portrait mode Auto Landscape mode

čtvrtek, 24. března 2011

Object Encapsulation Examplečtvrtek, 24. března 2011

Object Encapsulation Examplečtvrtek, 24. března 2011

Object Encapsulation Examplečtvrtek, 24. března 2011

Objects as members within Objectčtvrtek, 24. března 2011

Objects as members within Objectčtvrtek, 24. března 2011

Objects as members within Objectčtvrtek, 24. března 2011

Objects as members within Objectčtvrtek, 24. března 2011

Objects as members within Objectčtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Compare traditional approachvs.

ObjectForms developmentčtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Traditional development approach

čtvrtek, 24. března 2011

Development with ObjectForms

čtvrtek, 24. března 2011

Development with ObjectForms

čtvrtek, 24. března 2011

Development with ObjectForms

čtvrtek, 24. března 2011

Development with ObjectForms

čtvrtek, 24. března 2011

Development with ObjectForms

čtvrtek, 24. března 2011

Development with ObjectForms

čtvrtek, 24. března 2011

Development with ObjectForms

čtvrtek, 24. března 2011

Development with ObjectForms

čtvrtek, 24. března 2011

ObjectForms Demo App

market://details?id=objectforms.android

čtvrtek, 24. března 2011

Cross platform (GWT)

čtvrtek, 24. března 2011

čtvrtek, 24. března 2011

Don’t be afraid !

čtvrtek, 24. března 2011

Thank you.

čtvrtek, 24. března 2011

Questions & answers

@perpetumdesign

#objectforms

pavel@perpetumdesign.com

čtvrtek, 24. března 2011

CreditsSome of the images are from Flickr using Creative Commons License, all credit goes to their authors.

Entire presentation can be freely distributed under Creative Commons license as well.Chevron definition taken from Dictionary application by Apple, Inc.

ObjectForms is property of PerpetumDesign.Original idea of Java Bean introspection and UI generation came from BeanView by Will Iverson of CTG

Current GWT version uses wonderful reflection package Gwittir from Robert “kebernet” CooperAll other products and trademarks are property of their respective owners.

No chevrons were destroyed during preparing this presentation.

čtvrtek, 24. března 2011