Developer’s Life 09-10.03.2018

Yesterday and today I have been/am multitasking again. It is a state that makes me not so productive – but this gets moving a lot of stuff forward by little.

I’ve been working on iOS version of Breathe in. It is basically moving the logic from Android and getting to know the technical specifics on the Apple platform. I have done some thin client (Java Desktop) programming before, but when I switched to Mobile Application Development I saw how much more important is to do the logic where it is supposed to. On every platform there is some kind of API for deferring the heavy and/or blocking operations to a thread (directly visible or hidden) that is not The User Interface Main thread. This makes the applications responsible to user’s clicks and touches and makes the filling of using the tools much more pleasant.

On the Java Front End Platform there is Swing Worker class that is a thread with some additional options to push temporary progress to the User Interface. Option two when you have just some logic is to execute it on another thread and when done post it to the UI with Swing Utilities

On the Android Platform there is AsyncTask that is equivalent to Swing Worker and Handler API that is equivalent to Swing Utilities.

On the iOS Platform I haven’t found an API similar to the Async Task. Similar to the Handler API are some global functions that do the same job:
let q = dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0)

dispatch_async(q) {
…// heavy or blocking work
dispatch_async(dispatch_get_main_queue()) { … // logic on the UI
}
}
With the Internet stuff there is also another API ( URLSession.shared.dataTask ) that is asynchronous in nature and receives a callback that is executed on the UI. If you have done some web programming this will be familiar. In the browser, in JavaScript typically there is only one thread and the web requests, sqlite database queries and some other APIs are done asynchronously with callbacks to handle the result. Sense the entrance of HTML5 there have been also Web Worker API that is similar to AsyncTask. For background execution there are also Service Workers . The web browsers today are becoming more and more advanced and complicated and you can do a lot of stuff. The major drawbacks of using JavaScript is that it is interpreted language and this makes the applications slower a little bit (especially on mobile devices and especially with not so great hardware) (if you care). Also the code is open for review although it can be obfuscated.

Today I also changed all the fields of the visual components of Vaadin protected so I could extend hide stuff that I don’t want and add custom stuff that I want. The Idea here is to not change the generated code so when you need another field or something changed – I (you) could add it through my Generator App Tool – that can add the new stuff to all the layers ( model, database access, user interface ).

I am also doing some improvements on the Generator Tools itself. I started to think how I could implement database app platform and I started to design the database for it. I’ll go through several thought iterations until I am satisfied with the design and the best way to do it because as I have found in the past, the bad thing of wrong database design is that it costs rework of all the other layers. Maybe this is true for most things and not just programming – you have to do something, find what is good, what is bad and correct, change and continue to improve your whole life.

Share
Add comment