Developer’s Life 05-06.03.2018

Today was not so productive day. This whole thing of coding at night and merging it with some Real World events and duties has some consequences. After I stayed to 4 (or 5) in the morning I waked up at around 12. Again Lunch, some more home tasks and so on.

What I completed today was the initial phase of testing the generated from my Generator App – Swift code. The generated code was working perfectly. You can see it from the screenshots I’ve made:

P.S.1) The data is loaded from my server on the afternoon, saved  / updated / to a local SQL Database and then – loaded from the database. The logic is simple – if the internet is not active when the application is started – load the last available information. Else it loads the last available information from a local database.

P.S. 2) It looks like my home town area is very polluted...

The problem was that the find(id Non-Optional Integer) method was receiving null value. The worst part is that value was wrapped with (variable?.memberVariable)!. The ! sign makes the compiler ignore that the variable may become null at run-time. And when in the run-time it actually gets null – some ugly not so well described exceptions are thrown.

Actually this is not a problem with Swift programming language only. The app that I am coding (Breathe In for iOS) is a copy of an Android Application written mostly in Kotlin Programming Language. Yes, my Generator App also supports it. The stupid thing is I have encountered cases where the Android API itself provides an API where some (Location) object and variables that are marked as Non-Null-able, so the Kotlin Language marks them as so, and when the incoming parameter comes as null, ugly Exceptions are being thrown. It’s look like for custom user (developer) created libraries it will be best to change them little by little to accept null-able variables and check them, sometimes with just the little syntax sugar (the ? mark), that the incoming variables are not null.

I have done little testing on Xamarin and NativeScript today with close-to-zero actual progress, because of the limited time spent and I’ll try to go to bed a little bit earlier than the past several days so.

Good Night everybody.

 

Share
Add comment