Patterns are everywhere

One. Two. Three. Can you guess what comes next? If you answered with four, then you have made the correct answer and you’ve discovered a pattern in those numbers. We call something a pattern when we discover a behavior of repetition. Design patterns are, patterns, but used to find common ways of solving software engineering problems.

Hi there. It’s been a while since I’ve been able to write cool stuff on here, so I’m very glad that partial exams are mostly done for and I can write again. I’m way behind on all of these blog posts, but I do promise I will do my best explaining some very cool topics. Anyhow, here we go again.

Design patterns are pre-established ways of getting to a solution when working on a software project. You can think of design patterns as sort of a blueprint to produce a certain result. However, sometimes they are confused with algorithms and they just are not the same thing. Within what I’ve experienced with design patterns in my young development career, they are more than anything a way to structure code in order to create a clean and balanced solution.

I only have experience with one of the many different design patterns that are out there: the MVC, also referred to as the Model-View-Controller design pattern.

Courtesy of the brilliant folks at the London App Brewery

The photo above is a very basic way of explaining this design pattern. When we go to a restaurant, we sit down, look at the menu, and we decide what we want to order. In order to get there however, we need to ask our waiter to get whatever we want from the kitchen. The waiter then goes ahead and tells the chef what we ordered, the chef prepares our meal, hands it out to the waiter, who then brings it out for us to eat. The food that we have received is what we consider to be the view of our program. A more literal way of thinking about this is the user interface that we usually have when we use a mobile app. Then there is the waiter, who in this case is acting as the controller. The controller’s job is to communicate within the model and the view. Finally, we have the chef, who we consider to be the model. The model is in charge of using whatever resources it has at hand, and handing out the controller whatever the view asked for.

So that’s a very barebones explanation of what the MVC design pattern is. You can easily see that it can be used mostly with applications, and it works rather well. However, the MVC pattern might fail in other areas of software development, but that’s perfectly fine, because we have a boatload of other patterns we can use. Also worth mentioning that design patterns aren’t quite perfect. They do have flaws, and the community can tell you all about them. I mostly used the following link to find a great deal about patterns, so you can check it out. Also, if you’re interested in mobile development, the picture above is taken from an Android development course on Udemy, which you can find here.

Here, have a meme on the subject, on the house

You can check out some of my latest work on my website: grupoargon.co

Peace!

 

Leave a comment