Write Once, Run Everywhere

Posted: January 2nd, 2012 | Author: | Filed under: Android, iOS, Java, Tech | 1 Comment »

How Facebook Mobile Was Designed to Write Once, Run Everywhere.

I recently read the above article on ReadWriteWeb.com. The article describes the technical architecture of the Facebook mobile applications and the direction they are heading. The article is based on a presentation that a Facebook engineering manager gave. He seems proud of the architecture and the so-called progress of the application. In reality, the Facebook application gets worse every day and has gone from being one of the best apps to one of the worst. It isn’t coincidental that as Facebook has moved from a native app to a more web-based app wrapped as a native app that the user experience has diminished. The app use to feel native, was virtually bug free, responsive, and accurate. Now, the app barely works. Bugs are littered throughout the application from pictures being un-viewable to some friends having profile pictures that are of a different Facebook friend. It’s classic that this article has “Write Once, Run Everywhere” in the title. Java, which is also slow and unresponsive, has used this slogan for years. Writing something once, and running it everywhere often comes with a price and when that price is user experience, it often isn’t worth it. Is it worth having millions of users pissed off at your unusable product just so you can cut a few developers or so your developers can feel better about having non-redundant code? Facebook can easily afford to have a small team of iOS developers, a small team of Android developers, and a web team for dumb phones. This would have allowed them to keep the best user experience for each operating system until HTML5 was ready enough to support an equal or better user experience.


Eclipse’s Setter/Getter Shortcut

Posted: November 7th, 2011 | Author: | Filed under: Android, Java, Tech | No Comments »

The following tip probably won’t change your world, but I thought I would share it to save people time that weren’t aware of it. Unfortunately, Java does not have Auto-Implemented Properties like C# does. If you are going to obey object-oriented principles, you will need to create a private field for each property and then create a getter method and a setter method if both are needed. This can be very tedious as the majority of time there is no additional logic needed before setting the field or getting the field. Luckily, if you are using Eclipse for Java development, you can use the built in shortcut to automatically generate your getter and setter methods. First, you will create the private fields that are needed for your class (Figure 1). After you have created your private fields, you can generate the methods by clicking on Source in the menu bar and then “Generate Getters and Setters.” A dialog (Figure 2) will appear. Here you can check what fields you want getters and setters for. If you only want one or the other, you can expand the field and choose the appropriate option for what method want. After you have done this and then clicked OK, your code will be inserted into your class (Figure 3).