Mar
21

Delicious iOS and Android App development courses in South Africa

I am very excited to announce here our first series of iOS and Android app development courses, to be held in Stellenbosch in May 2013.

Both the iOS and Android courses will be introductory courses, presented by myself and Richard Barry respectively. We have tried to condense a lot of our experience and knowledge gained with doing numerous small to big app development projects on iOS and Android platforms over these last few years into these courses.

We also plan to have some intermediate to advanced level courses out soon, so watch this space.

Please note: there is an early-bird discount of 10% that applies to these courses, if you register before end of March 2013.

Bookmark and Share

Jun
08

One CODE to rule them all

“The rise & fragmentation of smartphones” was a topic at last week’s WIPJam session at the AppsWorld conference in Cape Town.

Unfortunately this is something we as developers or companies who develop mobile applications for smartphones will have to live with. However, we can make a plan to make life easier and our business more efficient.

In my talk at AppsWorld, entitled “One CODE to rule them all” [Link to slides] , we look at how easy it actually is to define a custom DSL (domain-specific language) and use that to reduce the amount of schematic code (we like to call it “monkey code”) that has to be written, amongst other benefits.

In this blog post I just want to highlight some of the points I touched upon while using the Applause Framework to demonstrate a real-life example of how it can be done.

Drawbacks of smartphone fragmentation
For me the two main drawbacks of having to develop the same application for different smartphone platforms (e.g. iOS, Android, Blackberry) are:

  1. Repetition: a lot of similar code has to be written in various languages, or sometimes the same language but using different SDKs. You must admit, as a developer: this is very boring and frustrating.
  2. Complexity: UI code is typically very complex, and keeps the developer away from focusing on business logic code. Heiko Behrens calls this “Accidental Complexity” in one of his talks on the Applause Framework.

Possible solutions
A number of frameworks and tools has been developed to help make it easier to deal with this fragmentation in smartphones when developing mobile applications. I mention some of them here:

These are some excellent frameworks with or without tooling to help you solve a number of fragmentation issues.
However, each has its limits (as opposed to the full feature-set being offered by normal native apps), so make sure the limits does not influence the apps you want to build.

Also, these are meant to make it easier to develop mobile apps, but does not bring the mobile app development and the way you code or communicate about these apps’ designs closer to your business domain.
(I will definitely need to blog some more on this topic, but for now the main idea: UI development (for Mobile, Desktop and Web) can be made much more efficient and richer by bringing the way UI applications are coded closer to the specific business domain where they are meant to provide solutions.)

What if?
So what if we could:

  1. Code each app just ONCE
  2. Have full control over the native code being created or generated
  3. Iteratively enhance the quality and functionality of the native apps

Sounds like a silver bullet? Perhaps, yes, if what you are looking for is a quick-fix click-a-button and all platforms are covered kind of solution (you can give me a few million dollars and we’ll develop the silver bullet for you anytime, for a given degree of silverish).

If, however, you look at using or defining your own DSL, and then internalize that as part of your development strategy and methodology, then progress can be made, and each iteration of apps build will get more and more efficient.

Closer to the domain: Introducing DSLs
Very briefly: a DSL is a programming or specification language dedicated to a specific problem domain, e.g. Logo (yes, the little turtle language), Mathematica, XSLT, UnrealScript, Lua, etc. (Read more on Wikipedia)
Languages like Java, Objective-C and C# are general purpose languages.
I really suggest that you go read about DSLs, it is going to change the way you develop software.

A Domain-specific Language gives us some nifty advantages:

  • allows solutions to be expressed more clearly and closer to the domain
  • enhances understanding and communication (between all stakeholders)
  • allows validation at domain level
  • self-documenting

Enters XText
You might think it is not worth the effort to define your own DSL, but luckily we have excellent language development frameworks like XText.

XText is part of the Eclipse eco-system, and allows you to create an Eclipse-based development environment for your own DSL pretty fast and easy.

It gives us all the modern IDE features we expect for our very own language that we define in XText: parser, type-safety, formatting, compiler checks, validation, code generator (via Xpand or XTend).

Okay, so now we can define our own language. How will that help solve the fragmentation issue?
Aah, let’s look at a Applause framework example to see…

A Mobile App DSL: Applause
Applause framework defines a Mobile Application DSL with code generation to help develop data-driven applications for iPhone and Android. It was created by Heiko Behrens and Peter Friese of Itemis. These guys are gurus in the Model-driven development scene, especially in applying it to mobile development, and it well worth the time to read their blogs. [Heiko's Blog and Peter's blog]

To get a good feel of Applause go through this tutorial by Ralf Ebert, very similar to the example I used. [If I get enough requests, I will work out my example as a tutorial as well.]

In the slides you can get a feel for how our example mobile app relates to terminology that is defined in the Applause DSL, and how ultimately that gets generated as code.

I built a SASSI Pocket Guide app using a slightly adapted Applause framework. [I will add the code to Github and update this blog post with the link, real soon now.]

For now I would like to point out:

  1. We defined our application once, in easy to understand terminology (i.e. in a way we think about a mobile app structure, not in complex XML, Java or Objective-C, thus closer to our domain)
  2. We have full control over the native code that was generated, as we have access to and can modify the XPand templates and extensions
  3. We could during the project enhance the DSL (I added a “localImage” as a valid option to cell) and we could enhance the native code being generated (to support mentioned “localImage”)

Inspect and Adapt
The third point above is of extreme importance: this is where agile and development and gain in efficiency and productivity all comes together: we must be able to inspect what we did in an iteration or project, and then learn from that and adapt. I already mentioned, but would like to highlight that using an approach like this will allow us to:

  1. Iteratively enhance our DSL. We won’t (and don’t have to) get a fully loaded DSL in the beginning. We start by letting the DSL be able to define basic structures that will help us get rid of some repetitive schematic code, and then we add unto this as we inspect and adapt. We also do not need to be able to define our whole app using just the DSL. Some highly custom parts might be better left outside the DSL, as long as the DSL allows for tying such custom manual code into the generated code. (Applause allows this via CustomView)
  2. Iteratively enhance the native code being generated. As our DSL grows, we can grow the code generation templates and extensions. We can tune it, allow for more configurable options and styles, even add support for extra mobile platforms and SDKs.

Next Steps: Closer to the BUSINESS domain
I see two possible “next steps” to consider:

  1. DSL for business domain as opposed to mobile app domain. I’m a big fan of the renewed focus on Domain-driven design, and the future of simplifying UI development lies in being able to specify the UI application (be it desktop, mobile or web) in terms of the business domain. E.g. a vehicle telematics app you want to specify in terms of a Vehicle list, searchable on registration number. The closer our DSL is to our business domain, the better the solution we offer is going to be in solving the business problems.
  2. Use the DSL to drive specification and testing. Who says we only have to generate code. We can also generate specification documentation and tests, including automated unit tests, or at least some part of it, from the DSL. I can’t even begin to describe how powerful that can be. Another use would be to generate all the necessary specification documentation from this DSL, and even giving that to an outsource vendor for implementation.

So let me leave you with these thoughts, and please feel free to share your experiments and ideas around using DSLs and Model-driven development.

Bookmark and Share

Jun
02

10 Reasons to rather do Android development

or should that be “10 reasons to rather do iOS development”
or Windows Phone 7?

hmmm

I think we’re asking the wrong questions here, or trying to extract the wrong reasons.

If you are serious about rolling out mobile apps, there is no choice: you will have to get a strategy in place for rolling out to all of the above smartphone platforms (and to BlackBerry once they are deemed to provide a smartphone SDK… when is Blackberry OS 7 due? Before or after Java 7?)

That means living with the different platforms, the SDKs and the (possible) frustrations of the various tooling. (I know, not all tools can be as smooth as XCode and Interface Builder… ;-) )

There has been a lot of talk about this topic at the AppsWorld Africa conference in Cape Town, and also a lot of discussion on the different solutions out there to help resolve this (sorry, no silver bullet yet).

I posted about the talk I did here: “One CODE to rule them all“.

In the mean time, I leave you with this: those worried that Java is dead or the next Cobol, don’t worry: it’s hip and happening in the mobile world, and Java is very much near the centre, sharing it with Objective-C.

And those that like good looking tools: Windows Phone 7′s tooling impressed me, so they’ll start making an impression as well (I just wished I could run it on my Mac.)

PS: Don’t you just hate those irritating “X reasons to…” kind of blogs?

Bookmark and Share

Nov
24

iOS Resources: one-stop page for great iOS links4

We thought it might be a good idea to share a number of very handy links we have come across as we work on various iOS projects.

A lot of people (and even some companies) out there are contributing a lot of information for free to the iOS developer community. However, it is not always easy finding these resources. Our hope is that with the iOS Resources page we now published on this site, we actually help developers to find these resources more easily. Our way of contributing back, albeit in a very small way.

We invite developers our there to leave comments with links to other iOS resources they found very useful, whether tutorials, handy apps, frameworks, code snippets, graphics, philosophy. If it helped you, tell us about it.

The iOS Resources page (and all its subpages) will be improved in an ongoing manner, so keep an active agile eye on it. The plan is also to add a nice “Getting Started” section with link aimed at developers new to iOS.

Go, read, surf & enjoy.

Bookmark and Share

Nov
19

Great iPhone app finally out: Wining and Dining

Splashscreen image of app

WiningDining iPhone app splashscreen

A while ago we started crafting a restaurant finder iPhone app for ResAfrica’s WiningAndDining service.

With a lot excitement we are now able to announce the release on the iTunes AppStore. (You can download it here.)

We had a lot of fun building this, and I believe we build something that is extremely useful, both to South Africans as well as tourists visiting or planning to visit South Africa.

There are some extra features planned already, and perhaps BlackBerry and Android versions will be published soon, if all goes well.

Bookmark and Share

Aug
12

Some excellent Java Courses scheduled in South Africa

Polymorph Systems has scheduled their two flagship Java courses for October and November this year.

The Java Intermediate course will be presented in their new training facilities in Worcester, South Africa, from 18 to 21 October.

There is an early-bird special on this course: if you register before 15 September 2010, you will get a huge 20% discount on the course fees.

The very exclusive Java Master course will run from 22 to 25 November 2010, also in Worcester.

And for those interested in the overview of the courses, read this:

Java Intermediate Course
Our Java Intermediate course is aimed at developers who feel they got a basic understanding of Java and OO, and would like to learn more about topics like multi-threading, generics, annotations, a design pattern or two, network and database programming, and a bit of reflection to round it off.
This course is extremely practical oriented, and also discuss the use of unit-testing (JUnit) and basics of logging.

This course is based on The JavaSpecialist Java SE course material. We added a lot more programming exercises and some more advanced topics.

Java Master Coursejavaspecialists-training_small
This is easily the best Java course in existence. It is meant for intermediate to advanced Java programmers, and tackle very interesting topics on multi-threading and concurrent programming, performance tuning and optimization, data structures, the NIO library and lots more.
The trainer (Herman Lintvelt) has been hand-trained by Dr Heinz Kabutz (the author of the course) in Crete, Greece, and is one of only a select few in the world that is qualified to present this course, and the only one in Africa.
This is a very intense and challenging course, and the amount you will learn is extremely valuable – to your company and your own career.
Read here why you should consider this course, and what the prerequisites are.
Students who successfully complete the course will get a certificate from The JavaSpecialists, issued by Heinz Kabutz.

Please contact us if you have enquiries about the course.

Bookmark and Share

Jun
14

Add Logging without changing code

I recently got a request from my one client: “Please add logging of the time it takes to do remote service calls, with minimal impact on the existing code.”

Now I immediately thought of the Proxy design pattern.

The existing code had quite a large number of business interfaces defined, with an implementation for each one that made use of RMI to call the remote objects. I’ll spare you the unnecessary details (JAAS, etc). It boiled down to basically every public method in each business interface implementation making use of an anonymous inner class with a simple public Object run() method to make the actual call to the remote object. A lot of code to change by hand, if logging and measurement of the time it took for remote calls were to be added.

A drastically reduced business interface might look like:

package com.richclientgui.blog.delegate;

public interface SoccerScoreService {
    public int getTeamScore(String teamName);
}

In order to re-enact the work of the JAAS Subject.doAs(…) code that is involved with the actual code, I created a MockSubject class for this example, which just calls the run() method of whatever Runnable gets passed to it:

import java.util.concurrent.Callable;

public class MockSubject {
    public static <T> T doAs(Callable<T> action) throws Exception {
        return action.call();
    }
}

We add a very basic mock implementation (no real remote calls happening here…):

import java.util.concurrent.Callable;

public class MockSoccerScoreServiceImpl implements SoccerScoreService {

    @Override
    public int getTeamScore(String teamName) {
        try {
                
            Integer result = MockSubject.doAs(
                                    new Callable<Integer>() {
                public Integer call() throws Exception {
                    System.out.print("Doing some work...");
                    try {
                         Thread.sleep(1000);
                    } catch (InterruptedException e) {
                         e.printStackTrace();
                    }
                    System.out.println("completed.");
                    return new Integer(50);
                }
             });
             return result.intValue();
                        
        } catch (Exception e) {
             //for this blog, I don't care about the 
             //exception handling...
             e.printStackTrace();
             return -1;
        }
    }
}

Now we can just create a simple class with a main method that calls getTeamScore(…) on an instance of MockSoccerScoreServiceImpl.

Now to add the logging…

Approach A: Use a Proxy
We can create a Proxy for the Callable, since all our calls to the server are done using Callable instances. This proxy class measures the time it takes to perform the call() method of the real Callable, and logs it to sysout.

import java.util.concurrent.Callable;

public class LoggingCallableProxy <T> implements Callable<T> {
        private final Callable<T> realCallable;
        
        public LoggingCallableProxy(Callable<T> realCallable){
                this.realCallable = realCallable;
        }
        
        @Override
        public T call() throws Exception {
                long time = System.currentTimeMillis();
                T result = realCallable.call();
                time = System.currentTimeMillis()-time;
                //find calling method, using call level of 3 
                //for this example
                final StackTraceElement stackTrace 
                        = Thread.currentThread().getStackTrace()[3];
                //using sysout for example, but of course 
                //use proper logging in real life
                System.out.println(
                                stackTrace.getClassName()+"."
                                +stackTrace.getMethodName()
                                +" took "+time+"ms to execute.");
                return result;
        }
}

Now comes the disadvantage of using a Proxy: we now have to change all the existing code to now create the instance of LoggingCallableProxy where the Callable was used up to now. This is not so bad if you have the source code, it is just a simple find&replace, so we can be pragmatic and live with it (I’ve always wanted to use the word “pragmatic” in a blog). Our MockSoccerScoreServiceImpl class changes to look like:

import java.util.concurrent.Callable;
import com.richclientgui.blog.proxy.LoggingCallableProxy;

public class MockSoccerScoreServiceImpl implements SoccerScoreService {

        @Override
        public int getTeamScore(String teamName) {
                try {
                
                    Integer result = MockSubject.doAs(
                           new LoggingCallableProxy<Integer>(
                               new Callable<Integer>() {
                         public Integer call() throws Exception {
                             System.out.print("Doing some work...");
                             try {
                                     Thread.sleep(1000);
                             } catch (InterruptedException e) {
                                     e.printStackTrace();
                             }
                             System.out.println("completed.");
                                     return new Integer(50);
                         }
                     }));
                     return result.intValue();
                        
                } catch (Exception e) {
                     //for this blog, I don't care about the 
                     //exception handling...
                     e.printStackTrace();
                     return -1;
                }
        }
}

Now we have logging of the time measurements, with minimal code impact.

However, that simple yet far-reaching find&replace operation one potentially hundreds of methods in a huge number of classes still worries me…

Approach B: use Aspects

Aspect-oriented programming (AOP) has been around for a while, and it allows us to weave in functionality without changing existing java classes. That is an extremely brief and potentially inaccurate summary, but it will suffice for this blog. Go read more about aspects and AspectJ.

First, we need to enable aspects on our project. Do this, you must:

  1. Download the AspectJ Development Tools (AJDT) if you are using the Eclipse IDE (AspectJ also integrates with other IDEs).
  2. Convert the project to an AspectJ project: Right-click on project, choose Configure -> Convert to AspectJ project
  3. Now you are ready to start implementing aspects.

Second: change back the MockSoccerScoreServiceImpl class to now make use of the LoggingCallableProxy anymore.

Then we can implement our aspect:

import com.richclientgui.blog.delegate.MockSubject;

/**
 * This aspect will find all occurrences of the MockSubject.doAs(...)
 * method being called, and wrap that in code to log the time
 * measurements.
 */
public aspect TimeLoggerAspect  {

        // the pointcut defines what method calls to intercept
        // All calls to the MockSubject.doAs(...) method
        // (wildcards for return and param types)
        pointcut doingRemoteCalls() :
                call(* MockSubject.doAs(..));

        /* around() defines an advise that will be executed whenever
         * the doingRemoteCalls() pointcut is matched.
         * It measures the time that it takes to execute the actual
         * doAs(...)method at that point, and prints out the time,  
         * class and method calling the MockSubject.doAs(..) method
         */
        Object around() : doingRemoteCalls() {
                long time = System.currentTimeMillis();
                Object result = proceed();
                time = System.currentTimeMillis()-time;
                //find calling method
                final StackTraceElement stackTrace 
                        = Thread.currentThread().getStackTrace()[2]; 
                System.out.println(
                                stackTrace.getClassName()+"."
                                +stackTrace.getMethodName()+" took "
                                +time+"ms to execute.");
                return result;
        }
}

Now you can run your main/test class as an AspectJ application, by using the Run As -> AspectJ/Java Application menu option in Eclipse.
(Visit the AspectJ website to see how to run it from commandline or other IDEs.)

We added logging to the remote calls, without changing any existing code, by just adding one simple aspect. This is only the tip of the iceberg of what you can do with AOP.

Eclipse RCP tip:
For Eclipse RCP applications, you will need to add a dependency to the org.aspectj.runtime plug-in to your plug-in project in order to use AspectJ.

Bookmark and Share

Jun
10

Workshop on Fast-tracking Java GUI Development

I recently blogged (on my blogger site) about my quest to find a more effective way of coding Java GUI applications. This resulted in the creation of a one-day workshop that I am very excited about.

The details from the JTraining website are:

Fast-tracking Java GUI Development
This is a great one-day workshop that discusses a number of concerns with developing Graphical User Interfaces applications with Java, and explore various ways to improve the speed and efficiency of development.

  • Do you sometimes think that coding in Java is perhaps not the best way of constructing GUIs?
  • Do you feel that your team should be able to develop GUI applications much faster?
  • Are you frustrated with the amount of “donkey code” you are writing to implement some basic GUI features?
  • Are the new team members struggling with the high learning curve of the Java GUI framework you are using?
  • Are you spending more time on coding GUI behaviour than you spend on coding domain behaviour?
  • Do your team find it difficult to add or modify existing features of a GUI application?

The above questions highlight some of the issues typically found when doing GUI application development. We have been specialising in Java GUI development for more than a decade, and in this time we have investigated and used a wide range of frameworks, tools and techniques to help us build GUI applications more effectively. This workshop explores a number of these options, in a highly interactive and hands-on way.

Visual GUI builder tools, code generators, UI DSLs: these are some of the topics we will investigate.

However, none of these have any meaning if a good foundation of UI development principles and practices is not embraced in a project. The workshop also aims to instil a number of important principles and practices that is a must for any good GUI development team.

I’m also giving away more detail here (I still have to finalize the content and outline, will add that to our website later):
A) discussion of frustrations & issues with “traditional” approach to GUI development using something like RCP/Swing
[interactive discussion]
B) exploration of alternatives:
* Tools (e.g. SWT Designer, Eclipse e4, etc)
* UI DSLs (e.g. Glimmer, Gryphon, XScalaWT)
* Code Generation (e.g. XText, ANTler)
[I want to demo some of the options, and allow for practical hands-on use of at least one. My current idea is that we divide in groups, and each develop a UI DSL, using something like XText, or a more dynamic language like Scala]
C) Discussion of Practices and Principles when doing GUI development, including:
- UI Design
- UI Testing
- Tool (in)dependency
- Domain Driven UIs
[This discussion will also involve a whiteboard/interactive design session (also done in groups).]

And all this will be taking place on 1 July 2010 at my new training and agile office venue in Worcester (or if the group gets to big, we’ll move to an extremely nice country lodge nearby).

Please see our training website for more details.

Bookmark and Share

May
27

Exciting new Java Courses in South Africa

I have been doing a lot of work around renewing my Java courses, talking to Heinz Kabutz in Crete, creating a new website.
Why?
Because I realized I have a passion for teaching others how to become great programmers. So am starting to concentrate more on training (while still doing enough real development work to keep the balance).

I am very excited to announce three new open Java courses that are going to be presented in June/July in South Africa by me.

First we have the Java and OO Foundation course, from 14-15 and 17-18 June 2010 (16th is Youth Day), happening in Worcester, South Africa, at our new training facility there. I can recommend this course to anyone starting out with OO and Java. Most of the content comes from my friend Heinz Kabutz’s JavaSpecialist Java Foundation course.

Then we have our first presentation of the Java Intermediate Course happening from 5 to 8 July, also in Worcester. I can recommend this course to developers who are comfortable with the basics of the Java language and OO, and who wants to learn more about real life Java topics like using JUnit, concurrency, generics and annotations.

Finally we have another big first for Africa: the first presentation of the now famous Java Specialist Master Course, from 13 to 16 July 2010. All those Soccer World Cup fans out there: stay a week longer in South Africa and come attend this brilliant course, authored by Heinz Kabutz.

I am extremely excited about our new training facilities in Worcester, which we call “The Loft @ PolymorphHQ”. Worcester is only about 100km away from Cape Town, a very scenic drive over the mountains. I am planning to combine all courses presented in Worcester with a bit of wine-tasting or even game-drive experiences. We are also investigating providing special packages that include accommodation. And we will definitely work in a nice steak and some good red wine with great Java discussions one of the evenings of the course.

I also want to announce our The Loft opening special: if you register for both the Java and OO Foundation (14 June 2010) and the Java Intermediate (5 July 2010) courses, you save R7,000.

I hope to have a lot of great Java developers coming out of Worcester these next few years :-)

Bookmark and Share

Jan
14

Flexible Java Developers for Agile Opportunity in Worcester, South Africa

If you:

  • are a fast and willing learner
  • are passionate about developing quality software
  • are self-disciplined and self-motivating
  • tired of the typical city and office life
  • need more flexibility in your working day
  • have experience in Object-oriented development
  • have experience in Java (acronyms optional)
  • are willing to either move to Worcester or work remotely with regular visits to Worcester

Then we:

  • want to talk to you about contracting or permanent employee options
  • want to provide training and mentoring
  • want to make you part of a newly founded team that has the goal of becoming the leading Southern Africa Eclipse RCP/RAP and OSGi development team
  • want to expose you not only to exciting new software projects, prototyping, and technology research, but also to interesting consultation opportunities, and unfortunately a bit of less interesting maintenance work

Email us at: jobs@richclientgui.com

Bookmark and Share

Older posts «