Wednesday, December 11, 2013

My first real world Android app, coded in pascal.

I want to share my experience building a very simple android app.

My app have  3 screens, main screen, data screen and configuration screen. That just connect to a RO Server build with delphi and working ver well from some like 5 years i think.

I have to make a design decision. What to use? I have an familiar tool with so many minor changes i can do a app in hours, and on the other hand i have Oxygene , a good tool, but requiring a *lot* of knowledge of java and android secrets.

You can easy understand my smart decision was Delphi.

So, i start.

Design the UI was easy, very easy. In a few hours i have all the UI and basic behavior. get some bugs here and there, but my app was working. That was impressive and was very happy to have a android app working without know ANYTHING from Android!

Then i need it to connect to my delphi server. The main problem was the lack of support from RO to delphi mobile.

I must use SOAP for this. After a few problems, solved for RO stuff, i get running.

Ok, time to test! The app start to have some bugs, exit without message, crashed here and there... I can´t get it working more than 2 hours on my tests.

I try everything to simplify even more the app, use threads to be sure is not overload, lets figure, whatever you can imagine. No luck. Always goes out with errors related to canvas, graphics, etc, the most part of the time.

What to do? My app must run in kiosk mode 24x7, i can't release some unstable. Cant find a solution there, always close with signal 11, invalid pointer operation, or canvas error.

Ok, lets try to do some, not at the same quality, i think, but running to test Oxygene stability.

My app was ready on 2 days, and do all the stuff i need. I have running it from years, stress test, and the result was a super stable app, connecting using standard RO channels, reboot if it don't find the server at a stipulated time, and have 150 Kb (vs 15 mb on Delphi)

My  conclusion:

The process of working on Oxygene was amazing. I have a lot of prejudices before start. The need to know java an android by example, but the reality is code completion, gendarme and oxidizer do the most part of the work and all the android related questions where there to be solved with a simple google search.
Same for the UI, i find my working quick and easy to adjust my UI using external editors and adjusting XML by hand when needed. Even at the last time, i don't use editors and add some controls by hand.

Im a delphi lover, i love delphi and i was a delphi lover for years. Everybody here knows it, i even be very contrary to the idea coming from RO to not support delphi mobile, and feel that as a betray.

Now i must say FM is not ready yet , and even when it will be ready if some day happens, is a very different option ( i don't want to say inferior) than that Oxygene offer. Now i understand why mh complains a lot about what FM have to offer and why the better way to go is Oxygene.

I hope not lost my friends of the delphi Community but i always be honest and i don't plan to stop being honest now.

Is great to have bot options and maybe in a next release Delphi will be ready to a cooler experience.

Enjoy!

Disclaimer: I can't test XE5 update 2, because it ruins my XE5 install. Im downloading the iso and will try with a fresh install.

5 comments:

Alexandru Ciobanu said...

Oxygen is language. Just that. Once you did Android development using Java, just go Java all the way. Do not spend money on the intermediate tool.

The real important part of a "language" is actually the tool set and the libraries and frameworks. Without that, Oxygen is just ... a skin.

I don't like FM at this moment as it is indeed unstable, but at least EMBT is trying to offer a fully integrated solution. You can't compare that to Oxygen. Do not give Oxygen credit where there's none to be given.

deksden said...

@Alexadru: Oxygene is also a familiar to C#/.NET users IDE - Visual Studio. And Oxygene is nice language, not just Java with begin/end.

You are right to speak that Oxygene did not have RTL/common UI, but this is a feature! They did not deliver "common minimal denominator", they deliver painless access to native platform - no wrapping, no bridging, native class extentions/subclassing etc.

Anf i m looking for Sugar as smart cross-platform library to deliver some form of common API, but with ability of quick using of native platform features just from Sugar's objects!

IMHO, RO is much more technically progressive and interesting, than Delphi's FM Platform.

donaldshimoda said...

@alexandru This post is not a comparison at all. It's just to share my experience. I recommend you do not get nervous, we live in times of technological explosion like never before happened, you're probably too young to understand this, you need to keep an open mind to other experiences.

Enjoy!

Gareth Connor said...

@Alexadru - I completely agree. Oxygene (and, more interestingly for me, their upcoming Hydrogene) is a real achievement and an approach which is technologically very forward-looking.

To claim it's just a "skin" is like saying Delphi was just a skin on the WinAPI or that C# is just a skin on the .NET framework. However it can be said that FireMonkey (which in technology terms is a dog) is not a skin but a 3 inch thick plastic over everything it touches. No serious developer (except those trying bring their legacy VCL apps to mobile and breathe a couple more years of life out of it and even then it's a poor choice) should touch it with a bargepole. FireMonkey has brought Delphi down with it IMHO.

As people flee in their droves from Delphi looking for a viable technology for mobile, RO's offerings are going to be a very exciting alternative. However Sugar is going to be a critical element in their success IMO to enable people to reuse as much non-UI code as they can across platforms. If they move Sugar to be an integrated part of their technology so people can pick and choose between using an abstraction layer and native access to the platform then this will be a winner for them.

peterson said...

Thanks for sharing this article.
Android Training in Chennai