Tuesday, 14 July 2015

I will be speaking at JavaOne'15

In case you are planning to attend JavaOne, let me pitch my recently accepted sessions.

My first talk will be about Design Patterns in JavaEE which I recently published a book on and the better I am honored to give this talk with Reza Rahman. Below you may find the official abstract.

Java EE revisits GoF Design Patterns
Design Patterns are not only cool but also bring years of collective wisdom to every level of developers. Since GoF, many books have been written and words shed, as well as many new concepts like Enterprise and Domain Design Patterns extended the coverage the Design Patterns, originally shared by the famous Gang of Four. Unlike the J2EE 1.4 era, Java EE provides easy and out of box implementations of many well known design patterns such as Singleton, Facade, Observer, Factory, Dependency Injection, Decorator, Data Access Patterns, MVC and even more. Many classical design patterns are actually just one annotation away from your project. Attend this talk to watch and learn by live coding demos of Design Patterns in Java EE.

The next talk is about mobile apps. Well I might hear people mourning about JavaME but worry not. The talk will about GWT which would enable developers to write Java which would be compiled and packed as an HTML5 app. And guess what, yes it does run on iOS.

Mobile Java with GWT, Still "Write Once Run Everywhere"
Times have changed and although JavaME still has a market share, it is not available on all devices anymore. Java/JavaME developers had no problem moving to Blackberry or Android but had faced challenges on iOS. HTML5+phonegap apps promised a magic silverbullet for write once run on all devices approach via several frameworks which in the end offered painful javascript and css development. While GWT offers a great Java to JS compiler and debugger, MGWT introduces native looking widgets both on ios, android and even blackberry. Also with the addition of gwt-phonegap projects, now you can code native looking html apps which can use native apis only with regular, type-safe, well known beatiful Java without coding a single line of html+JS.

I am excited to give my 8th talk in my 7th JavaOne. Don't hesitate to stop by and say hi if you will be around!

Permissions in Android M Preview

Milkyway? Well I guess so but macaroon, muffin, marsmallow are still good candidates to become the name of the new Android version. We have more to make guesses until the final version is relased in quarter 3. Following last years tradition of releasing a preview version at the time IO, Google has already released M Preview. Unlike last year this preview release pretty much functional and two more previews will be release (end june and end july) before the final version.

Let's forget about the naming and deep dive into technical parts of 'M'. If you are planning to have hands on experience on M, the system images for your devices are located here. If your android studio is subscribed the preview channel for sdk updates, you should have already been informed about an available sdk update which is called "android-MNC".

The most significant change with M is the permissions. Android applications ask for permissions before the installiation of an app. Once the app is given the permissions it is asking for, disabling a permission is not an option for the user. This was a simple design decision (both for users and developers) but introduced undesired app behavior for a user. However, on M, permissions are granted or denied at runtime.

If the permission is denied the app may receive an empty object, a null object or may even got a security exception. Since apps relied on permissions to be granted automatically until M, this would introduce an important change to legacy apps.

If you do not update you app compiled with target sdk pointing M, the application will ask for list of needed permissions at the time of install. However, the user can always turn of a granted permission which leaves the app to deal with denied permission. A dialog saying the app may crash will be shown while if user disables a permission. If you compiled your app with M as the the target sdk, the app will install silently and ask for each needed permission at the time execution.

This a big change which may effect previous code. Simply you need to revisit your old apps make sure you handle the cases where permission is not granted. In most cases the app should recover and continue working.

I think this a very good change. Users tend to not read permissions while installing (do any of you read agreements?) but asking permissions in runtime always gets the attention of the user. Plus the user would realize what current context and judge if the permissions makes sense.

Welldone Android team, let's see how old apps will survive the change..