The Sign to Good Design

29 Nov 2018

Weaving the Pattern

The phrase “design pattern” applies to various things in the world. You could be stepping on a design pattern right now! Carpets are an example of design pattern, since they are usually woven with some sort of repeating pattern. When it comes to weaving carpets, quilts, or blankets, it is important to follow a certain technique to achieve the desired results. Does a carpet necessarily need a pretty pattern to function as it is intended to? The short answer is no. Assuming both carpets are made with the same material, an ugly carpet will function just as well as a pretty carpet. The ugly pattern may be haphazardly put together but in the end, both carpets are practically identical in functionality. However, if a consumer had to choose between a beautiful floral carpet and a carpet that looks like a dog took a leak on it, he or she will most definitely choose the floral carpet. Yes, both carpets function just fine, but the difference is that one will be chosen over the other.

Just like carpets, there are design patterns in code. It could be things like formatting and coding technique. A pattern of proper formatting in code is appreciated by other software engineers. By design, it is more appealing to read and understand. As a result, this gives the code a higher chance of being used. However, if the code is slapped together without much care of any format, it will discourage people from using it since it is not pleasing to the eye and difficult to decipher. Both codes could work just fine; the difference is that one is more likely to be used.

The same can be applied to coding techniques. “Coding technique” is very vague, but it undoubtedly applies to how a person generally codes. It is usually best to think out the code beforehand and follow a certain pattern. A software engineer can show his or her amazing skills by coding four methods in different obscure ways. It may work, but it would not be code a client or other programmers want. Code that doesn’t follow a pattern and uses other techniques unnecessarily results with unappealing code. Due to the (unnecessary) complexity, it may also take longer to compile or require more memory. Compatibility is an especially important thing when it comes to working with other software engineers. If the design pattern or coding technique of various programmers do not match up, their code may not be compatible with each other’s code. Even if not assigned a certain design pattern, a software engineer must discuss and agree upon a design pattern with his or her coworkers. Thus, it is critical to follow a good design pattern.

My Appliance of Design Patterns

I always follow the design patterns I am taught. When it comes to coding, I always use the format we are given. I see the importance of using a design pattern in formatting because everyone’s code will be legible to each other. If I require assistance from a TA or classmate, they can read and understand my code without a problem. If the code does not follow any sort of format and seems to be a mess, people will be reluctant to assist me. As for coding assignments, there are many ways to write a certain piece of code but I find it best to follow the design pattern I learned to do. I can use some sort of obscure method to increment for a loop, such as creating a whole new method to call just to add one. This will work, but whoever looks at the way I designed the code will definitely frown at it. It is functional code, but the design is terrible. Thus, it is important to follow a good design pattern while coding.