Libraries/Gems

Posted by r0tiart on February 15, 2018

Depending on what technology you work on or utilize, odds are there are plentiful of libraries available to you. What are libraries, you ask? Well a library is a code base that someone else has already pre written that has a reusuable functionality.

For example, back when I was developing my Rails Portfolio app for flatiorn - I was struggling with building a Friendship relationship where a User can add friends; thus a user is related to another User via a friends table. However a User can add a friend - but they are not necessairly friends until the other User accepts said friend request. While working on this I discovered a gem that does the exact funtionality I was trying to develop. The idea behind libraries or gems (in the case of ruby) is to be efficient as a web developer and to not have to reinvent the wheel.

There are pros and cons of using libraries or gems. In my case I opted not to utilize the gem - and in tern spent much more time that I would’ve if I were to implement that feature with the gem. If not for that particular feature, I would’ve had more time adding and developing additional features. However, because I didn’t utilize that gem I was able to learn and garner more knowledge and experience. Not only that the problem with gems is version control. If a gem is not regularly maintained, there comes the issue of what if the code base Ruby gets a new version and your gem is no longer supported - that would break your entire application.

It’s a give take, sometimes you have to choose your battles. As someone who is just starting up it makes more sense to reinvent the wheel versus using libraries/gems. I would garner more knoweldge; however one can argue that with more time saved by utilizing the library - one would be able to implement more features that may or may not have a library. And by implementing more features you are learning as well - the more you code the more you know.

So libraries/gems are there to help - but don’t necessarily rely on it all the time. Sometiems it’s worth it to break it down and try to reinvent the wheel again.