Crossplatform mobile app development example with PhoneGap, JQuery Mobile and HTML5
Goal of this example
There are two ways to create mobile app for multiple platforms :
- Create a native application for every target platform
- Create a single cross platform application (usually in HTML5)
Both options has it’s pros and cons, the requirements and the nature of the project should define which option fits better. Here are a few facts :
| Native | Cross platform | |
|---|---|---|
| Native UI components | Yes | No, but can be mimiced |
| Native features | Yes | Crossplatform API provided for GPS, WIFI, Camera, Accelerometer, Orientation, File, etc. Other features can be accessed through plugins |
| Performance | Hardware is the only limit | Acceptable for basic features, 3D of visual effects can be slow |
| Ease of development | Code change needs to be deployed into device or emulator that takes some time | Code can be tested in a browser instantly without deployment |
| Device compatibility | Needs to explicitly handle multiple screen sizes, newer components cannot be used on older devides | Compatibility with multiple devices, easy to test multiple screen sizes, no dependency on specific platform versions |
| Technology | Java, Objective-C, etc.. | HTML5, Javascript |
| Tools | Native WYSWYG GUI Builders, profilers | HTML WYSWYG GUI Builders, HTML Editors, no profiler |
Technology Used
- PhoneGap 2.7.0
- JQuery Mobile 1.3.1
- Ripple Emulator
JBehave example
Goal of this example
JBehave is a Java implementation of behavior driven development, the main concept is that user stories not only describe the requirements, but should also define the tests. This is achieved by assigning the user stories to test methods for example in a JUnit test.
Technology Used
- JBehave 3.6.8
- Spring 3.1.1
- JUnit 4.8.2
- JBehave Eclipse plugin
- JBehave Annotations
- @AsParameterConverter
- @When
- @Given
- @Then
- Parametrised Scenarios
- Parameter Injection
- Outcomes Table
- Tabular parameters
NoSQL – MongoDB
Goal of this example
Nowdays the NoSQL databases are very popular. If you have worked with Relational Databases before, I think you know why this is. With Relational Databases the structure must be defined in advance, so you have to use ALTER for any changes, that can’t always be handled in code, and it may very slow if tables contains a lot of datas, so it results unnecessary overhead. On the other hand, it is more difficult to reconcile the concept of the new data formats, such as JSON, with the concept of the Relational Databases.
Technology Used
- NoSQL
- JSON
- MongoDB
- Spring Data
- Spring MVC 3.1.2
- Maven
Techniques shown in this example
- Basics of MongoDB/NoSQL
- Spring 3.1 MVC: XML-Free configuration (Servlet 3.0)
- Spring Data
Vaadin Example : Java and HTML based RAD tool (with Hibernate and Spring)
Goal of this example
In the “good old days” there was a concept of RAD (Rapid Application Development) that allowed developers to quickly create graphical user interface. The visual page editor allowed drag-and-dropping UI components into the form, customizing the size, layout, etc, then write the business logic in the same language as the UI was built, for example Pascal in case of Delphi. This concept exists in java too for desktop applications, Swing, AWT, SWT, but what about the WEB? It uses HTML + Javascipt on the view and Java on the backend, the developer needs to work with the HTTP / HTML technology and it’s limitations. Vaadin provides a solution to have a visual form editor and be able to access all UI elements with pure Java without the need to worry about HTML and Javascript or client side at all (because that will be auto generated)
Technology Used
- Vaadin 6.7.6
- Vaadin Eclipse plugin
- Spring
- Hibernate
- Maven
Techniques shown in this example
- Vaadin Navigator Addon
- Custom components
- Page refresh
JAXB Example : XML reading, writing in Java
Goal of this example
Java SE includes many XML parsing technologies like SAX, DOM and StaX providing API to directly manipulate XML. In contrast JAXB does not allow direct XML manipulation, instead it provides a way to transform Java objects to XML (called unmarshaling) and transform XML to Java objects (called marshaling). Additionally it supports generating Java Objects from XSD files.
Technology Used
- JAXB2
- JAXB Maven integration
Techniques shown in this example
- XML Marshalling
- XML Unmarshalling
- Java code generation from XSD using XJC
- Schematic reuse using xs:import
CXF example : SOAP(JAX-WS), REST(JAX-RS), Spring
Goal of this example
SOAP or REST? This is a valid question when implementing a new web service. Rest is the newest and trendies therefore many consider SOAP as deprecated. This example shows how to implement both using Java Standard JAX-WS (SOAP) and JAX-RS (REST) annotations and Apache CXF as the web service engine.
Technology Used
- CXF 2.5.2 SOAP(JAX-WS), REST(JAX-RS) client and enpoint
- Spring, Spring MVC 3.1.1
- Spring Security 3.10
- JSR 303 Bean validation

