The Blueprint of Code

02 Dec 2024

An Approach to Common Problems

At first, the concept of design pattern is strikingly similar to that of coding standards. They both practice an organized structure code, with ease of use, and efficientcy. However, while coding standards focuses on the smaller part of the structured code, design patterns impact the scalability and efficiency of the code. Unlike coding standards, design patterns are very flexible and can changed over the course of the project. It functions as a guideline and a frame to prevent different issues and code spaghettification.

Design pattern is a systematic way of dealing with reoccuring problems by using a “blueprint” or a skeletal structure of a code. It is most often used in object-oriented programming languages due to the use of classes and objects. OOP could also be seen as a design pattern itself, where instead of creating a function everytime you want to make a circle, you can create a circle object and reuse that everytime. The commnunity has even further improved on this approach by creating many different design patterns that complements the features of OOP. One such design pattern is the Singleton Pattern, where only one instance of a class exists and it can be accessed anywhere within the code.

My Spin on the General Blueprint

While, I am not new to coding, I have yet to have my own concrete design pattern that I follow everytime. Much like coding standards, I only follow them loosely during the first iteration of coding and only after reviewing do I alter the code to match the standards. In my current class project with my fellow classmates, our universal coding standard is AirBnB’s ESLint and my design pattern follows similarly to what was taught to me in ICS314. Database and server disconnected from client side and using API endpoints to bridge between the two.

Outside of web development, I like to have classes fit with as much methods and fields as possible because I dislike having many different classes with few functions. For example, it my tic tac toe project, I had 4 different classes and each are only instantiated once with as few outside functions as possible. In general, I would my classes to be very scalable and future-proof so that I would not have to create a new mini function whenever a new problem occurs.