Today I wrote my first useful Android app, which shows the bus connections from the bus stop next to our flat to the subway line (I didn’t say it was going to be useful for you).

Since I didn’t want to start right away making things more complicated by adding Scala to the mix, I decided to write the application in plain old Java. I haven’t been writing much more than a line of Java in two years, I think - so here are my impressions after this evening’s experiment:

  • I really have trouble with having to put return statements everywhere
  • the inverted parameter type notation is getting in the way. Working both with Java and Scala on a daily basis probably would get some time to get used to because of little things like these
  • it took me a bit of time to realize that constructors aren’t declared together with the class
  • parsing XML appears to be overly complicated and bloated… I decided to use the XPath API rather than a pull parser, because I knew exactly what I wanted to pick from the API response. Still, it feels very convoluted and there’s a lot of boilerplate involved in plucking out things from the XML tree. I suppose I should be using Jackson yet I’m sort of used to having a good means to working with XML out of the box
  • type safety, ugh! I mistakenly passed a TextView to SimpleDataFormatter.format() method without compiler warning (the format method does accept Object as a type). Maybe that’s just an unfortunate encounter with an ill-designed API (who’d want to format an Object?), but it is one of those gotchas that I have entirely forgotten about
  • I really do miss the collection library and closures. I think I haven’t written a for loop with indices in a very long time and it does feel rather unusual. It really shows where closures help to save time.

So what’s the morale of the story? I’m not sure there is one, other than it feeling rather strange to coming back to a language that I’d been using for 10 years and that now feels strangely distant and somewhat clumsy after just 2 years someplace else. I’m really curious about JDK 8 and how things will evolve there for Java.