Ramblings of a techie

Archive for the ‘Programming’ Category

My first mobile programming experience was, unfortunately, using Jquery Mobile. I won’t go into too much detail, but it definitely wasn’t great. HTML on mobile devices definitely wasn’t ready at the time; it is not now either, but it’s at least bearable and jqm did not make that experience better.

After that I did some native work; it was my first brush with Objective C / iOS. I promised someone I would make that code open source but I would need to stamp it with a lot of warnings as the code (to me anyway) is absolutely ghastly when I read it now. It was kind of a side project which I did in the summer because I wanted to make something nice; the app turned out well but there was no marketing so you can’t even find it in Google anymore. I did learn a lot though; cramming a lot of learning into a very short time worked well for me. iOS turned out to be nice to code for and it thought me a lot about the API, transitions, animations etc.

I continued working native on both Android & iOS, far preferring iOS at that moment (at the time of writing that is still the case); the projects were usually little apps and games which with lower budgets. Clients were really trying to figure out mobile still.

Fast forward a year, I got in touch with more long term mobile development; I was asked to develop the mobile applications on Android + iOS for a fintech startup. This would be a project of at least months to a year. The previous developers were gone (… no reasons given) and I was allowed to start from scratch, not using the code of the previous coders.

As we suddenly now had a bunch of clients lined up next to this one and I was the only coder, I had to find some way of doing this while we gathered stability to hire more developers and in some way that I would not burn out.

I was very fast at doing projects for iOS by that time, but my Android skills were lacking. It took me far too much time to do both of them natively at the same time, so I, early on, picked Xamarin to do the development. It would at least save me from doing double work on the core of the system; most of the logic could be reused and the code still compiles to the respective native platforms while the frontends are really platform specific.

As I was working on the fintech startup, I had to delegate work for other clients to a freelancer for the time being. I would lay the groundwork in the evenings while he would build the actual app and while I worked fulltime on the fintech apps.

That turned out to be hard; even the apps I was doing focused 100% on were quite hard to do on both platforms at the same time.

So I took a week off to think how to fix this without driving myself and the freelancer mental. The latter basically already happened and we were to blame for that.

One of the options was to just drop Android; for most clients, Android was an afterthought anyway. They designed everything for iOS and then said something like ‘yeah, and that then also for Android!’.

But I went for another solution, at least I decided to see how far I could get; on the laptop I brought were my projects for Xamarin iOS and the projects by my colleague as well. I decided, lead by these projects solely, to see if I could get them to compile and run on Android ‘well enough’ to give to clients.

Locking myself up for a few weeks to get that done was a lot of fun and in the end I hoped it would help clients.

And it did; the LoB (Line of Business) projects we had could be recompiled without issues. The more consumer focused ones could also but were not sell-able that way. Great for prototypes however to show how it will look if you would run it on Android functionally, and, as a practical side effect; clients without an iPhone or no interest in getting their UDID or jumping through Apple hoops could now immediately test the app at the same time as their colleagues.

We tried to get investment for the project for a short while as we noticed that especially Microsoft shops were very interested in it; the fact that they could dev LoB applications in C# on client and server for all platforms (we were going to create a Windows mobile version) by writing one frontend was attractive to them. Unfortunately we didn’t have the time to pursue it and just left it.

After Xamarin Forms emerged, our developers started using that and my proof-of-concept remains what it was; a proof-of-concept. After some legal fixes, I can now finally release the source code. Don’t mind the code too much; it was rapidly written as people were desperately waiting for me. Here you go; hope it helps someone.

People tend to whine a lot about the documentation of Webpack; while I agree that it could be better, the thing is open source so if you want to help out just do it! One question however seems to be very poorly answered on the internet and my colleagues (and others) keep asking it; how do you simply ignore files?

You might have seen tons of warnings like “You may need an appropriate loader to handle this file type.” popping up when you run Webpack and you might want to get rid of them without doing what Webpack suggests; add a specific loader for all of them.

While this might mean you need more studying of how to use Webpack, often people get blocked for hours or even days(!) by searching for a quickfix(-and-we’ll-change-it-when-needed); that quick fix is;

This goes for all non-managed DLLs which are 32-bit but have the .NET application loading them compiled with AnyCPU (and not x86).

If this message appears in the Event Viewer : System.BadImageFormatException related to a dll (in this case the CR95HF.dll for NFC) , download the Windows SDK for your Windows version. It will contain CorFlags.exe in \Program Files\Windows SDKs\Windows\v7.1\Bin\.

TL;DR Internet does still suck in most places, please make standalone apps for your products and services that work offline too.

A web page view through a bad connection

A lot of software engineers seem to agree with the popular notion that all applications will be web based one day; I am one of them, but I am someone who thinks that won’t happen soon (not before 2020 anyway) for various reasons.

Going for full web based software vs native software (on phones, tablets but also on desktop OS’s) is less performant and, when you need to do a lot of productive work, just annoying. Even if the native software is not very well designed in all aspects; going from one task to another in a productivity optimised native app will just be faster to work with. From the app (mobile/desktop) design, development and user experience side, it is possible to really push the envelop when going native which is why almost all popular desktop and mobile phone applications are native. That is not why i’m writing this post however and (slightly) worse interaction is something I can live with. Although if I have to use something a lot, it starts to really get on my nerves (try the Elance app for instance…).

Most web sites/applications are written with using mostly server side code with a frontend in HTML, CSS & Javascript. Besides a bit of AJAX, sites and applications are generally not very resilient against bad internet connections. And why would they be; everyone has a great internet connection everywhere these days right?

I travel a lot these days; UK, NL, BE, PT, ES, US, DE and others and I always have a bunch of devices with me, including laptops, tablets and phones. People who adore and keep pushing web-only applications are usually living in dense regions like cities and many of the loudest proponents are in Silicon Valley or other tech areas. Obviously the internet connection is good there. In the cities. A bit out of a lot of cities (Seattle, LA, London, NYC, Orlando, Madrid, Munchen, Faro…) the connection is (much) worse or does not work at all. Stepping a bit out of London, sometimes even the entire GSM signal is not enough to conduct phone calls on, let alone do any meaningful 3-4g work on. Around and even in Munchen I have a hard time finding a stable connection at all. A top class business hotel in the center had paid internet wifi so bad that it wouldn’t even load Gmail properly. And this is not a one-off experience; it is common, very common in 2015 still. A normal web application would not really load, an AJAX web application would throw up all kinds of errors (Jira, Hipchat) while a modern web application, once loaded (or preloaded), will work fine. It amazes me that either people don’t travel at all or maybe do not use internet a lot when travelling and just shout ‘all can be web; it is fast enough!’ from their fiber glass internet connection equipped apartments… Not having access to internet is not even the biggest problem; a very unstable internet connection is as the latter is far more common.

When referring to a modern web application I mean applications which let you use all the functionality that could possibly be used offline, actually can be used offline. For instance, writing blog posts, commenting on something, rating something, registering worked hours, creating issues etc. Content that must be updated will have a warning that it is not up to date and you click / drag to try to refresh, or it refreshes when ‘enough’ internet connectivity has been detected.

When ‘the internet is back’, the data is synced with the backend and everyone can see what happened. This is a solution to resolve the bad or no internet issue and there are enough technologies to get this to work, like Meteor or PouchDB. They are quite new and that is something to be weary off, but client-server programming is not new (and has a lot of the same issues) so it’s definitely possible to get it working well offline.

It’s not only small companies who don’t have finances to create web applications like that either; the aforementioned Jira & Hipchat web applications have it and especially Jira should work offline. But they don’t even have an official native or otherwise mobile app.

Which brings me to the next point; you have to preload the web application to work when you are offline. That’s not very convenient; you probably thought ‘there will be connectivity everywhere! It’s JFK right?’ until the plane landed and you notice you couldn’t even download your cat’s homepage properly.

A solution which is web based is for instance the Chrome Web store which allows you to download a base packet of HTML5 code which runs when you click on it, even when offline. What happens after that depends on the creator of the application (as is always the case; unless you are using Meteor or something like that, it won’t automatically work offline).

Which brings me to the conclusion; if you want me (and many people I know with me) as long term client, you need to have a mobile app, preferably native, next to your web application(s) which can work both online and offline. I happen to pick airlines based on this, I don’t work with Elance anymore because of this, I pick products for internal company use but also personal use based on the quality of the web applications and availability, at least for key productivity tasks, of a solid mobile or desktop app, preferably natively written. I wish companies would look around more and notice that the largest landmasses of this earth do not have (stable) internet and that it is quite lame to not account for the large group of (travelling) people in those parts.

You want your clients to use your products as much as possible; you can make that happen by making sure there is a top notch experience on every device, under every circumstance. Take a lesson out of the Whatsapp book.

Ever since I found this MS/Bing page about internet search engine aided code completion and read about this NSF grant given to Penn for computer aided programming, I wanted to write a post about my friend, John. He is not really called John, but his name is unique enough that he could be identified if I would use it. He is one of the people I would call StackOverflow programmers (they existed before SO but nowadays almost all results are from SO).

John is a professional coder, that is, he makes a living, a very good living, by writing code. Even more interesting, his annual income is a 6 figure number. Very impressive for a self employed coder who doesn’t do any sales himself and depends on his code to work 24/7. His productivity is on a very high level; he manages to write websites, mobile apps & games at a speed which is frightening, especially for a programmer like myself and especially considering this guy does not know what he is doing when he is writing software.

He does not understand what arrays are, does not, in fact, really understand the concept of variables. Loops are some sort of magic. Classes are convenient, but how they work exactly… Recursion? Well. Who needs that anyway right? He understands some parts of coding, because he can ask questions in enough detail to know what he has to implement and he usually understand about where to add/change code. I have not found yet where the knowledge begins / ends.

I have seen ‘his code’ and I have seen him ‘code’. The basic process is like this:

Think up what you want to create

Find some tutorial or open source (free or paid) project which does something close to what you need (pro tip: don’t care what language / framework / tech it is in; that’s easier to find)

Find a HOWTO/tutorial on how to install the software you found

Find a video how to install the development environment for the tech behind the software you found

Find the missing features in the existing software; make a list

Take a feature and search on internet, ask the software creator or ask on IRC ‘how to add the feature’

Collect enough concrete snippets to implement the feature

Change the code to match the naming of the code surrounding where you copy/pasted the snippets in (the Bing code completion does that for you)

Create a new StackOverflow feature with the snippets ‘you tried’ and ask on IRC

Go to 6 until done

I have seen him do this with Objective-C, PHP, Perl, HTML, Javascript and CSS.

Unlike most programmers who are well versed in computer science, language theory, functional programming etc, John has been making a small fortune for the past 9 years selling licences and traffic with products he wrote himself while not really understanding most of anything of what he was doing, but rather by using his business brain and a lot of copy/pasting, tinkering and working at a very hasty pace.

Is this a good or a bad thing? As someone who is very interested in formal verification of software and who is afraid of code like this I can only say, yes it mostly is, especially when someone has to maintain the code after the initial coding spree is over. There is a reason for me saying that though.

Before there was Google and most of the internet and definitely far before StackOverflow, I worked with someone who was the predecessor of a StackOverflow programmer, however it was more the ultimate copy/paste programmer. The procedure worked quite differently than searching the internet; in a Turbo Pascal book, he found the basics of what he needed and he manually copied that to the Borland TP editor under DOS. When it worked a bit like what he wanted on one screen, he proceeded to copy/paste that code literally all over the place to make 100s of programs which sold very well and the follow ups still sell well. Containing things like:

up to over a500, showing, again a lack of what an array is. The programs had to be split up in units and use Overlay because the way of programming took too much memory to compile and run.

When Windows 3.1 and later on 95 appeared on the market, the applications and the then younger me was the one who was going to port them and support them. Instead of rewriting them I thought, in my infinite wisdom, that it would be better to write a Windows wrapper around the TP sources instead of rewriting everything to something much smaller and more efficient. Big mistake. Supporting so much manual copy/paste labor which was basically puzzled together by only searching in what there already was (a very small StackOverflow the original programmer made himself).

The code bases from John and the other programmer look at lot a like, as do the gaping holes in their programming knowledge. Funnily enough, both do very well commercially; the latter has been doing very well since the 80’s like that. I know at least two other guys who are doing very well in their jobs employing the StackOverflow search procedure outlined above.

Every since I met John, I have been thinking that it should be possible to use Google to do this automatically. But even further than what MS did with Bing. Maybe Watson and Google (to search StackOverflow) as standalone AI + Watson and IRC to get people to make the details work could get somewhere in the future. The question is of course; what would be the input spec to something like that if there is no human to figure that out in the process. Maybe something to that will win me an award in an obfuscated coding contest!