Introduction to Design Patterns
By Sai Viswanathan, who doesn’t just breath air, he breathes programming.
We software engineers write million lines of code that suits our application needs and take pride in that. And, you might have often seen the code that exceeds thousands of lines in a single file. Well, there are cases where your business logic is more complicated than what you anticipate which lets you keep writing an essay, sorry programming. There could also be cases where you knowingly/unknowingly repeat the lines of code.
Refactoring often solves this problem where it helps to reduce the number of lines in your code . But, the process of Refactoring cannot be done just like scissoring your lines of code equally and making it small in size. In fact, Refactoring is not just about trimming your lines of code. It should follow design principles, adhere to commonly used design paradigms etc., Design Pattern is a way of achieving this. Let’s see how it is.
Like human being, software engineering, its principles and techniques are also evolving day-by-day. Our engineering forefathers had faced a similar set of problems which I mentioned above and even complicated than that. So, they used various OOPS concepts, mix it in the right proportion and formulated a solution that suits certain problem patterns. As the name implies, its a design solution that solves a particular problem pattern. Hence the name arrived, Design Patterns.
Let’s see how we can phrase the definition that looks like an answer to a 2-mark question in your school/college exams:
Design Patterns are typical solutions to common problems in software design. Each pattern is like a blueprint that you can customize to solve a particular design problem in your code. It represents the best practices evolved over a long period through trial and error by experienced software developers.
Design Patterns are widely used in OO environment which means it deals with objects at different levels. It could either be involved in creating your objects, establishing relationship or building communication between them. So, these are the three different types of design patterns.
Now that we know the types of Design Patterns, let’s dive into each pattern separately in the upcoming series of blogs. In this journey, I will also take you through some of the examples that we’ve incorporated in our applications. Before getting into it, I would suggest you to brush up the S.O.L.I.D principles.
So, aarambikalangala? Shall we start?
We at CaratLane are solving some of the most intriguing challenges to make our mark in the relatively uncharted omnichannel jewellery industry. If you are interested in tackling such obstacles, feel free to drop your updated resume/CV to email@example.com!