Posted on

Should You Use a Library or Implement Yourself?

library over implementing yourself

There’s many libraries out there on GitHub for Android and other platforms, in particular I want to talk about Android because that’s what I do mostly. Should you use a library or implement stuff yourself?

Why Libraries

Reusing someones code is a great way to save your time. Literally every new element that I need to add in my projects I ether use solution provided by Android framework or search stuff on GitHub

First Party

Of course, first party libraries are out of the question, most of them are great and already part of the development process. Most of them have none or just one possible substitute which makes decision of choosing them super easy.

Third Party

Here it’s more tricky. I’d separate those into two categories: hard to implement yourself and not so hard

Hard to implement

Into this category goes libraries like OkHttp, Retrofit, Glide etc. Those are great libraries, using them is obvious winning because when you just try to implement networking without Retrofit – you’ll see why it’s better to use it.

Or something that you don’t even imagine how to implement. With a library you can show off your app with all the cool stuff which you don’t even understand how it works and make it look like you made it all yourself. Cool, right?

Easy to implement

Those kind of libraries are most likely just a better abstraction over existing libraries. Well, every library uses some other ones, but those mostly are build on top of libraries which could be considered as final.

Into this category could go bunch of stuff out there. One good example is Firebase UI.It’s kind of not that hard to implement it yourself, parts that you need

Which One?

In most cases I’d use a library. The only case where I wouldn’t – is when it’s so easy to implement it yourself and library ties you up so much to its framework so you need to learn a lot of how it works.

Btw modifying libraries to your needs is lot’s of fun. Check how I changed SmartTabLayout to add custom behavior here

And you can learn how to build and publish your own library to jCenter here