Posts

Interpreter design pattern for beginners.

Image
Interpreter design pattern– Most of the time, we don’t see this design pattern during our day to day coding practice. Or at office work. The reason why is because we have so many third party libraries to solve pain addressed by this pattern. For example – You want to validate semantic correctness of mathematical expression. It is for grammar checker or rule engine. SQL parsing, symbol parsing, converting high-level language to a low level. If you want to develop a new computer language to solve X, Y, Z problem, then also you can use it. As most of the time, we are creating software to address some high-level business requirements. We don’t get much opportunity to develop something like mentioned in the above list. And if you have a core project at your office work, where you do those things. Then stick to it and don’t switch your job. Many times, composite design pattern implement interpreter within them. UML structure - UML structure of interpreter ...

Software design vocabulary

My goal here is to do a logical grouping of tech jargon. Programming paradigm Structural programming [i.e. C language]. OOP: object-oriented design [i.e. C++/JAVA/C# etc] Concurrent programming paradigm Functional programming [i.e. Scala, Transactional-based model: Haskell] CSP - Communicating sequential process [i.e. Erlang, MPI] Solid First letter full form in SOLID context S Single responsibility principle  (SRP) O Open Close  principle (OCP) L Liskov's Substitution  Principle (LSP) I Interface Segregation   Principle (ISP...

Easy way to learn design patterns.

Reading any theorem ( in physics or mathematics) is a different game from solving thousands of tricky examples based on that theorem. The same way we can read the standard definition of any design pattern and think we have understood it, but solving many real-life problems through that knowledge is a different ball game altogether. In other words, “ learning theory is very different from solving many examples based on that theory.” The very first rule of learning any design pattern is to solve (or think) many examples around it, as much you can, that will make you feel more confident on that particular topic. There has to be some basic understanding of UML and OOPs before you go ahead. Just don’t jump into any design pattern which you have heard in some interview. Or through your seniors, or from any other source. Also, don’t go category by category, like I will finish all behavioral design patterns then I will read creational and then structural; it doesn’t work in that w...

Chain of responsibility design pattern for beginner.

Image
Problem statement – Let’s not go into too much technicality for now and discuss something more exciting “ traveling.” Yes, we all love traveling and like to visit new places. You must have noticed, your cell phone will be active always wherever you go. No one can figure out that you are out of station. By just calling at your cell phone number. If you don’t wish to tell him/her (especially to your manager) about your travel.  Your mobile will work seamlessly across the states. Yes, I am talking about the “ mobile - roaming model.” The concept of location transparency will come into the picture. Please click  this link if you don’t know about location transparency. It says that you have to make the system believe that moving objects are inside of local space. (Just an pictorial representation of moving different state of India) Now let’s understand how it works. You are pointing to an object which is moving. The only issue with this problem is how you w...

Template method design pattern for beginners.

Image
Problem statement – Please go through the  strategy design pattern before you continue reading this article. From the strategy design pattern, we understand that; how to build an application, where you want the user to select the approach of solving/executing problem/algorithm at run time. For a moment, imagine template methods design pattern doing the same thing but in a controlled way. Let us understand it through an example, there are 4 outstanding programmers. Like you! Writing code to solve a given problem. According to the  strategy design pattern ,  it just wants a result. Not interested in how different programmers have written their code. And what approach/strategy they have followed to solve the problem. As long as they can implement various strategies in different strategy, concrete implementation. Now those 4 programmers have joined the same software company and solves a given problem. This time as they have joined same company, all of them have ...