Software Development: When do you use publically available libraries?

I have seen many code repositories in my software development life (and I have not really been doing software development very long), and generally see two different types of code repositories:

  1. Extensively using public libraries even for the most simple of operations
  2. Everything is created from scratch and is managed internally

When I was programming this afternoon and I was looking at a number of code repositories I was wondering; when is it appropriate to use a public library, one that has been tested thoroughly and has potentially hundreds of contributors or do we just write up our own utility classes and methods, making it only available to projects that we work on? It is questions like these that have me stay up late at night, making it hard to go to sleep.

I primarily use Java at work and is one of the programming languages I use when working on my programming projects. Being so popular there are an insane number of super useful libraries out there with a range of purposes. So it is really easy if you are using Maven to manage these libraries and dependencies, and include them for use in your projects. For example, imagine you have the following scenario:

You want to check whether a String value is null or empty, and this is done in a number of places across the code repository before using this value at any time.

The code could look something like this, all over the repository:

String str = getSomeValue();
if (str != null && !("".equals(str))) {
	...
} else {
	...
}

Wouldn’t it be easier to import the Apache Commons package and use the StringUtils class and do this operation instead, having the StringUtils method referenced across the repository?:

String str = getSomeValue();
if (StringUtils.isNotBlank(str)) {
	...
} else {
	...
}

Sure they generally have the same structure and basically offer the same functionality, but I feel the second option is easier to understand and looks better (personal preference).

What I find the oddest though is when you see code repositories that have their own StringUtils class for example that has a method that does exactly this same check as the Apache Commons StringUtils class, just called differently. So we see this instead:

String str = getSomeValue();
if (StringUtils.isNotNullOrBlank(str)) {
	...
} else {
	...
}

Why not just use the Apache Commons class and methods? What benefits are there to writing your own utility classes unless there are specific operations that you need to perform that the public libraries do not offer? Why go out of your way to write your own caching class when you can use the easy to use, extensively tested and heavily documented Google Guava Cache? These are the types of questions I ask myself when I see utility classes that have one or two methods that do the same operation as publically available library class’s methods. Not only do you have to write the near identical code as the publically available class, but you also need to document the class and write up test harnesses for the class to ensure it works as intended. Most of the time the utility classes I see are not documented and/or there are no test harnesses so developers just assume “Yep, it looks like it should work, so we are good to go.“.

Let me know what you generally do when you work on projects. Do you use the publically available libraries whenever you can? Or do you write your own classes and methods even though you know there are the publically available libraries? If you fall into the latter camp, please let me know why. There may be a valid reason that I am just too ignorant or dumb to notice, because generally whenever I have the option I will always use the public library.

My E3 2017 Summary

It has been a very busy week (and weekend), and not just in the gaming world. With me being a massive gamer I was paying close attention to this year’s E3. I was surprised and fairly satisfied with the announcements, especially from coming from the Microsoft Press Event (to be up front, I am a massive Xbox and Windows gamer so there is some bias in what I am interested in). Below are my memorable moments from E3 and the games, products, features or services that I am looking forward to the most or am excited to get my hands on (in no particular order):

  • Microsoft Xbox One X (aka Project Scorpio):
    • What more can I say than, “The World’s Most Powerful Console”? True 4K gaming, HDR and Dolby Atmos support. Even though I do not have a 4K TV, having the games supersampled on my brilliant 65” 1080p Panasonic TV and reducing the loading times while increasing the framerate is always a bonus. Day one purchase for me, no questions asked 🙂
  • State of Decay 2:
    • I absolutely loved the first one. A little rough around the edges but it was super fun. It was a great zombie survival game. Happy that they are releasing a sequel. Looks like they have doubled down on what worked and removed elements that were a pain and fell short in some areas. Another day one purchase for me.
  • Crackdown 3:
    • Terry Crews. Can I get a hell yeah? Collecting orbs has never been so much fun. The chaos and mayhem I created when playing the original and sequel will always have a special place in my heart. This sequel has been a long time coming and I am looking forward to this one.
  • The Evil Within 2:
    • The first was a horror masterclass IMO. It knew how to create the most intense and gripping moments, while also pulling back and letting you do your thing. If the sequel is anything like the first (and from the videos I have seen, it is) then this will be a horror game that I cannot pass up on. Any true fan of horror games will most likely be keeping this on their radar.
  • Wolfenstein II: The New Colossus:
    • If there was one game that was worthy of a sequel it was the rebooted Wolfenstein: The New Order game. The reboot was a masterclass in showcasing how an FPS should and can be created. Pure chaos and fun with characters that felt unique and memorable. From the trailer this appears to be more of the same. New guns to blow your enemies into giblets, what more could a FPS fanatic want?
  • Star Wars: Battlefront 2:
    • Did someone say battledroids? A beautiful, rich and engrossing experience from what I have seen. Nothing more needs to be said. I grew up playing with Star Wars toys and a mate of mine summed up the new series perfectly.

It is a Star Wars kids dream. EA and DICE have crafted a sequel where you can go in and play with your favourite Star Wars characters and worlds you love; just as you did when you were a kid playing with your Star Wars toys.” – DEFJESTA 17.

  • Anthem:
    • This was a surprise, coming out of left field. Most of the games BioWare create are magical. From the characters to the story. Anthem looks to be EA’s answer to Activision’s Destiny. A little disappointed with the game that is Mass Effect Andromeda, so I am cautious about this one. Will be paying very close attention to this and will make a decision to pick this up at a closer date, probably after the reviews. Will also talk to my mates to see what they think, it appears to be heavily co-op focused.
  • A Way Out:
    • It is great to see a developer come out onto the stage and be so confident and pumped for the title that they are developing. This one was a favourite of mine when it was shown at this year’s E3. It looks unique and ambitious with plenty of potential. If they can pull this off then this will be a really enjoyable experience with replay value galore.
  • Sea of Thieves:
    • Nearly all of my Xbox mates are looking forward to this title. A romp across the open seas, having a blast looking for treasure and fighting other pirates. Something about this game reminds me of the Fable franchise, which is a good thing. Everything that I have seen of this game is leading me to make this a day one purchase.
  • Middle Earth: Shadow of War:
    • The Nemesis System was nearly perfect. Having refined it and having what appears to be objectives that can be failed and never replayed, makes everything worthwhile and meaningful. It just builds from a solid first game outing.
  • OG Xbox Backwards Compatibility:
    • This was a complete and utter surprise. I know Phil Spencer said the titles in this backwards compatibility list will be smaller due to licensing, but I am still looking forward to playing some OG Xbox games [1]. Please let KOTOR 1 and 2 be playable *fingers crossed*. So to the entire Xbox team, thank you for this, from the bottom of my heart. I know we didn’t need to have this feature, but it shows you really care for what gamers find important; and this is playing games no matter the generation.
  • Ori and the Will of the Wisps:
    • When this came up and the music played, a tear shed from my eyes. The first game was beautifully crafted. The tight controls, perfect art style and masterclass score made Ori and the Blind Forrest deserving of a sequel. Day one purchase, no questions asked.
  • Metro: Exodus:
    • When the 4a Games logo came up on screen, my brother and I both widened our eyes at the same time. Could it be a new Metro? Boy were we jumping for joy when it was. The first two games were not only gorgeous but were difficult. Day one buy again.
  • Forza Motorsport 7:
    • The only racing franchise now that I play is Forza, sorry Need for Speed. Be it the brutally realistic Motorsport series, or the more arcade Horizon. This game is really going to showcase what the Xbox One X can really do in 4K at 60 fps. I bought Forza Motorsport 5 when the Xbox One launched and I will be buying this racing game when it comes out for the Xbox One X as well.
  • Vampyr:
    • Coming out of nowhere, this game intrigued me. I need to see more of it, but from what I saw it looks like it is going to be fun. There is something about the setting and vampires that gel well. As the release date comes closer and more information is released I’ll be making a decision whether to purchase it, or wait for it to go on sale. Either way it will be going in my digital game collection.
  • Age of Empires Definitive Edition:
    • Growing up as a kid, this franchise was my got to RTS, next to Warcraft (sorry I didn’t play StarCraft). I played the HD remaster of the second game and enjoyed playing that one, even though the multiplayer matchmaking was slightly broken (but that is for another time). This will likely be a game I pick up purely based on nostalgia.

Being such a solid week for gamers, no matter what platform that you play on or the genre of games you prefer, there is something out there. I probably missed some other games, but these are the ones that I remembered off the top of my head. If there are others that you think were worthy of mentioning then feel free to add them in the comments below.

%d bloggers like this: