Code More Efficiently

Anyone who has developed an application from an early stage will agree that the development process contains a ridiculous amount of boilerplate. If you’re unfamiliar with the term boilerplate, this Wikipedia article could help shed a light. Boilerplate is “is the sections of code that have to be included in many places with little or no alteration”. The problem isn’t that boilerplate is unnecessary, on the contrary, boilerplate code is actually quite necessary (If you’re planning on arguing against this, try writing a program without using methods). The main issue is that the time you spend on the boilerplate code would be so much better spent on the actual functionality of your app.

It’s a dirty job, but someone has to do it

It’s a dirty job, but someone has to do it

Wouldn’t it be nice if someone wrote all your boilerplate for you so that you could get to what’s important? Well, I’m here to tell you that many already have and no, smart ass, I’m not talking about the SDK that you’re using to develop your app. I am talking about the numerous open source libraries out there that you can use. No matter how new and unique your app is, you’re going to run into the same problems as many before you have and some of those nice and friendly developers have shared their work, free of charge, on beautiful places on the internet like Stackoverflow, Github, Bitbucket, and more. All you have to do is reach out and get it. Make sure the licensing terms work for you (Most are licensed under the Apache v2 Open Source License). Don’t re-invent the wheel.

Sharing the wealth

Over the next while, I’ll be writing about the libraries that my colleagues and I have been using over the years developing for Android. As I publish the articles, I’ll update the entries below to contain a link. Bookmark this page and you have bookmarked them all. The libraries mentioned below are mostly meant for Android/Java, but the overall message is platform agnostic: The less time you spend writing boilerplate, the more time you have to develop what’s yours.


Lombok is a lightweight Java library that promises to “spice up your java”, but what it really does is generate your boilerplate code for you through annotations. To find out more about Lombok, you can check out my first installment in this series, read about it at or watch this video.


Butterknife is a view “injection” library for Android. If you don’t know what that means, here’s a hint: You have no idea how sick and tired of typing findViewById you are until you don’t have to type it anymore. Find out more about Butterknife in the second installment of this series read about it here.


Picasso is a powerful image downloading and caching library for Android. Picasso can load, download, cache, resize, and transform your images. It handles placeholders, error images, and even custom transformations (e.g. blurring, colour filters, etc). Check out the third installment on this series or learn all about Picasso on Square’s Github portal.

Google GSON

Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Gson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of. Don’t take my word for it, though, read about it here.


Retrofit is a “A type-safe REST client for Android and Java”. That may not sound a like a lot, but if you’ve written a REST API client, you’re gonna love it: Retrofit lets you write your REST API methods as a Java interface. It takes that interface and generates code that actually interacts with your REST API server. It works very nicely with GSON. Read more about retrofit here. Jake Wharton (the author of Retrofit) did a presentation on Retrofit at the Netflix Open Source Meetup in July 2014.

Update: With apologies, it’s been 2 years and I still haven’t published the last 2 installments. I got real busy.

Mahram Z. Foadi

Mahram Z. Foadi

My name is Mahram Z. Foadi. I am a Software developer and architect based in Vancouver, BC, Canada. I specialize mostly in Android development, but I've had my fair share of run-ins with a variety of platforms and programming languages.