Posts

Architectural style -> Adoptable system -> Reflection.

Image
Background - We have discussed very less about reflection, especially if you are C, C++, mainframe, LSI developer and working on server side implementation or in low level hardware-interaction development team.  But it is very popular among high level languages like JAVA, Scala, C#, Python etc, many languages have implemented reflection in it.  It gives you flexibility to do things dynamically (at run-time). After working closely with different clients, you will get a clear understanding that no one is as confusing as a software client, not even your girlfriend! So we should have a flexible architecture in place who can absorb shocks of client’s last moment changes. Not only that, sometimes we have N number of different behaviors and structure in place, and we want our application to behave differently depending upon run-time situations. Let’s build understanding step by step through an example. Think you have got an assignment where you have to build an app...

Architectural pattern - Naked object.

Image
Background – This model is very close to MVC (model-view-controller) architectural pattern. I would recommend you to read MVC first if you have no idea about it. MVC is very nice for any complex application, but when you are dealing with a real time system where user is interested to monitor some specific objects, then implementing it through necked object will be easy. Please look at below mentioned diagram. (This diagram of MVC is taken from free internet sources) (This diagram of naked object is taken from free internet source)                    I am sure that above mentioned diagrams would have given you a good insight of what naked object is and how it is different from MVC , but let us talk some example so that it gets clear. Example 1 , think about an ATC ( air traffic controller ) who manage air traffic of airport, through switching on and off the lights on runway, so that flight shall land and reach...

Architectural pattern - data transfer object.

Image
Background – There are many angles you can look into performance issue. Many times we get complains that, your app is slow. One of the major area to look into performance improvement is inter process communication, sending data between two processes in client-server architecture is a costly operation, because many calls are synchronous (where client wait server to give processed data back) and even if it is asynchronous,   time taken to transfer data matters. One way to solve this problem is to reduce the number of calls between two processes, and pass more data whenever we are calling inter process methods, but for that we shall have well-defined interface with long list of method parameters. This approach is not very good because first , we have to very careful with the sequence of parameter while calling it (If we have 7 ints in function parameter list, as all take same type of parameter if you miss the sequence, it could lead to wrong result) second , doesn’t matter ho...

Active record.

Image
Problem statement – It is rare to imagine any software application without records. Records are the most important part of any large software application, we apply business logic on those records and keep them safe and clean. There are many robust and nice tools to save records - oracle DB, MySql, MS SQL Server, etc. For example I am mentioning a student table below. Databases are the key layer of any application, but user deal with an interface (or GUI - graphical user interface) developed in some programming language (i.e HTML5, C++, JAVA, C# .NET , etc.) not with database directly, we save our records in database.  It means you need something which connect to database from your business layer, we have to figure out what? Answer is ORM. What is ORM? Some legacy application (which don’t follow all OOPs principles) use DB as just a storage and perform DB operations according to business requirement (from so...

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