Posts

Showing posts from June, 2016

Facade design pattern for beginners.

Image
Background –  Mask is one of the synonym of facade in the English language. Facade design pattern is actually doing the same things, that its English meaning tells. It wears a mask of simplicity to hide the complexity of a large and complex subsystems. It makes an easy to use interface. Many times we deal with legacy library along with some modern and complex libraries in our project. Dealing with all of them individually is not an easy job from the maintenance point of view. To reduce the complicity, we can use the facade design pattern. Create a lightweight interface which will talk to different libraries. You just have to call that interface without bothering how it will work internally. For a small application, having few classes, and 1 or 2 libraries is not the right candidate for facade. It is for large and complex system. About facade design pattern – Facade doesn’t add any new functionality to the existing sy...

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...