Posts

Showing posts from 2016

Architectural patterns => Mud to structure => layers.

Image
Background - We apply mud to structure when a large system requires decomposition. If you notice, your application/requirement has verity of logical units which can be decomposed into a group of sub-tasks, first,  group them into different levels of abstraction. One abstract unit perform a totally different task(s) from other units, but any unit alone is not enough to give meaningful service to customer. Actually, different issues/solutions are splinted into different abstract units. Second,  after you divide them into different units, if you see a mix of low and high-level dependencies, where high-level operations depend on low-level operations, then assume those logical units as layers, third draw a dependency diagram between layers.  If control flows from high to low layer (or dependency diagram forms a stack, one layer on top of other), you can think of implementing it through layer pattern. Layer architecture - We can have many components in one layer. Layer

Architectural style -> Adoptable system -> Microkernel.

Image
Background – As we are talking about adaptable system, we have to think about heterogeneous system, we have huge number of different platforms and software stack. If you are thinking to build a system which is portable, you must agree that, you have to design it differently for different platforms. If you do so, you will notice that main (or say core) functionality are same, but you are rebuilding them again and again for different platforms, which is not at all a right way. What I am trying to say is, core functionality will be same, doesn’t matter for which platform and how you build it. So is there any way I can take that core logic as a separate unit? Yes of cures there is, that is what you are reading about, its called “Microkernel”. Please look at below mentioned image for a high level understanding. Microkernal – Core logic/logics of your system, which will be common for all platforms. Internal server - There are some functionalities which are no

Lazy loading ...........

I have learnt lazy loading, and implemented it, in my office project, but non-technically speaking, I have learnt it long ago, in my first semester of engineering. One of my best friend Shrikant taught me that. In college days we use to make many unrealistic plans, and after making them we use to vote, who is in and who is out? If someone says no, then we used to curse him, that because of you we are canceling our plan. But Shrikant never use to say no, doesn’t matter how unrealistic you make it. Because somewhere in deep, he was knowing, that plan is not going to work.  At the end when we cancel the plan, he use to pretend that, he was ready but as plan got canceled, so no use of talking about it. You know what, lazy loading works exactly in same way. Out of many functionality (which your application offers), client use only 20% of them all the time. Yes I am talking about 20-80 rule. As past experience tells us that, not all functionalities are in use very activel

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 application

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 to its destination safely. Without giving proper

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 how mu

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 some part of their code base, without applying

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 system. It just remove complexities. The only probl