Am I Lazy?

29 Apr 2021

A Guide

When it comes to building or creating something, may it be building your house or creating new lines of code, there is going to usually be some sort of design pattern being used. When building a house, you may be using certain design patterns. What I mean by this is when figuring out how you are designing your house, there might be some patterns you might know of that you have seen before that works. It can be so you do not have to think from scratch of what could be a good design for the house when you have a design pattern in mind. This can also translate to creating new lines of code. When you are working on a coding project, you may be one of those people like me where I tend to refer to previous code that have a certain design pattern you like that would fit in your code. It could be something like how you design the collections you make in your database to interact with other files. In a way, I see design patterns as a guide that you can follow to aid you in completing what you need to do like building your house or creating new lines of code.

My Philosophy

Now you may have heard of something along the lines of “do your own work” and think that everything you do has to be your own work. Now I would say that is mostly true, but I am sure that whatever work we do is almost always going to be based off of some type of design pattern we have seen before. One example I can think of is the structure of buildings in Japan that are designed to handle earthquakes as it is frequent there. From one building to another, the design pattern of how to make a building more capable of handling earthquakes is shared, there may be a more updated design, but the design was derived from the original nonetheless and has that basic skeleton or structure to it. Now bringing that idea over to writing lines of code, I for one tend to refer to previous code that I have seen or worked on where their design patterns would help with the code I am currently working on. An example of me using a design pattern in my code is the publish-subscribe design pattern. This design pattern is helpful in that only when you need certain things to load like data from a database on a certain page, it will then load only what you need. So, I have a project that I am working on where I want to display a user’s info and a product they are selling or trading in a page. The publish-subscribe design pattern helps me where I only want to load only one user and one product, and it works by me writing the code so that it only subscribes from the collection of users and products and nothing else that may be unnecessary.

Is it being lazy?

Looking back on how there are design patterns and that I use them a lot in my own code, am I considered lazy for using them and not make my own? I would say that I am being efficient with my time as otherwise what is the purpose of having these design patterns if they are not going to be used over and over again? I feel that when it comes to writing code, you are always going to be referring back to what you have seen and worked on before as it would help keep your work consistent and saves time. If I see someone not using a design pattern that would help accelerate their work, I would say that they are being inefficient and wasting time. Sure, I could be making some revolutionary design pattern that could help improve writing code for others, but I personally cannot think of what this design pattern could be if I am given a problem that cannot be solved and is in high demand of being solved.