Cousins, Tantrums, and... Cocomelon???

25 Apr 2024

Cousins, Tantrums, and…. Cocomelon???

Imagine you had a little cousin that was the most insufferable brat on the planet that would have constant tantrums. They did not get the toy they wanted, a tantrum occurs; they do not like the food they are eating, a tantrum starts to brew; or they do not want to go to bed on time, a tantrum is expected at that point. But, what if I told you that there was a magical trick that would get your little cousin to calm down almost immediately from a tantrum. Guess what, it is called Cocomelon! Dealing with a little cousin/brother/sister/sibling is almost like dealing with bad software that wants to misbehave and not do what you intend it to do; and design patterns are your magical trick like how Cocomelon is to little heavy metal enthusiasts. Design patterns are general, reusable solutions that can be used to solve common problems in software. It’s like how the Babyshark video can get your little cousin to eat food that they do not like or how bouncing fruit videos for babies can get your little cousin to fall asleep instantly. There are different kinds of design patterns that help solve different subsets of problems in software development exactly like how different children’s videos help solve certain tantrums.

Baby Shark Doo-Doo Doo-Design and Decorate

Now, how have I dealt with my own little cousin? My little cousin wants to watch Baby Shark on repeat for hours but can not hold an ipad for that long since he has noodle arms. A tantrum fills the house. Oh no! I decide to make him a hands-free ipad holder where they wear it like a hat while the ipad is just directly hanging in front of them with an extendable arm. Like my own cousin, our software development project used cards that were clickable to represent vendors. However, we had a problem that they could not add that specific vendor card to their favorite vendors. So, we dynamically added this new star button function to the card, without breaking any other functionalities of the card itself, like its clickability. More specifically, we use the decorator method design pattern throughout our software development project as we have many objects within the same class but are constantly changing the functionality of these objects. It is like my little cousin’s problem. I did not change the way the ipad worked or how it was shaped, I just “decorated” it with a new ipad case to solve his issue instead.

Sometimes, all you need is Baby Shark to solve all your problems!