Clean Code

27 Apr 2019

When working on various projects throughout my computer engineering career here at the University of Hawaii at Manoa, I had the opportunity to meet some extremely smart people that have left a positive message for me to carry on to the rest of my career. One of them had interned at Amazon and was quite the software engineer. He was just a junior at the time and he told me all about his experiences there and what he had learned from it. As he was explaining himself, the world “Design Patterns” popped up and he explained the importance of it.

He told me that the language or the scale of the project does not matter, but rather what matters is the proper design patterns instilled within the code. At the time I had no idea what that meant as he brought up terms such as observer, factory or singleton, but upon further research of it I finally understand how important it is in the industry. Design pattern is what can make or break a software project or company. Bad code can definitely function, but messy or code that isn’t clean can devastate a company as countless hours will be spent trying to deciphering the poorly written code.

One example of a design pattern that is heavily used is the Singleton. It is one of the simplest design patterns yet one of the most important ones. When accessing something such as a API client from the backend, we would only need one continuous connection with the API server. The work of the Singleton model would limit the connection where the client declaration only happens once instead of creating instatiations of a new connection that would be the same as the one that was already instantiated. This is unnecessary, so with the use of the Singleton model, this would reduce the amount of connections and improve the structure and cleanliness of the code.

As I have not worked on large sccaled projects with large codebases before, I have yet to see the use of design patterns in action. Despite this, just from hearing it from others and researching the various design patterns, I have come to realize the importance of it. Design patterns are crucial to understanding how a new codebase works when tasked to writing or maintaining code that you have never seen before.