Ehsan Ghanbari

Experience, DotNet, Solutions

Polyglot Persistence 

In large scale applications, using multiple programming languages and multiple database types in order to tackle with different problems is not something strange and based on needs there could be more than two or three languages in such an application. Although in a simple web application, there is a server-side programming language and a client side.  The term Polyglot Persistence refers to the applications with multiple data storage technologies, used by an application which could be components of a single application as well.

 

A large scale application such as google, facebook, Instagram etc. which handles different types of data such as image, video, and text in different client applications through the world, has to use different data storage and different sort of management with different sort of programming languages. So the idea of the writing such an application by mixing different programming languages and different databases is Polyglot Persistence.

 

 

For more information about the subject you can refer to the following references & articles:



Multi-threading, parallelism and Asynchronous programming

  

Multithreading: Based on Microsoft definition, multithreading is the ability of a central processing unit to execute multiple processes or threads concurrently.  In multithreading, a single process has multiple threads of execution. If the system has multiple CPUs then it can run in parallel. In nutshell, it's all about solving simultaneously a problem to improve performances.

 

Parallel programming: is a programming technique wherein the execution flow of the application is broken up into pieces that will be done at the same time by multiple cores, processors, or computers.  It literally means using a set of resources to solve some problem in less time by dividing the work. The issue with the processor load has a connection with parallel programming in the sense that parallel programming aims to keep all computational elements as busy as possible. But simply keeping the CPU busy does not mean that you are doing parallel programming. It extends well beyond multithreading and can take place among processes running on the same machine or on different machines.

 

Asynchronous programming: usually it is used with slow tasks and when you don't want to lock other tasks of your application. For example, when some part of your application is busy for a task, other parts wouldn't wait for that task to be completed. In fact, it is a means of parallel programming in which a unit of work runs separately from the main application thread and notifies the calling thread of its completion, failure or progress.

 

 

 

 

  



The meaning of Page Routing in nutshell

One of the most capabilities of modern web-based applications is the ability to swap the content of the page without any page reload, Post-back and Request-Response. All of the operations are done by calling from UI and request from the server and then changing the existing content of the page with the newly retrieved contents.

That's what they call SPA (Single Page Applications),  working with these kinds of the User interface is so easier as waiting for a post back and refreshing and replacing the pages sometimes are tedious. Rather than that in single page application most of the business rules are handles in UI and server-side analyses are less in comparison to traditional web applications, so it tends to be faster.   



Difference between layer super type and template method patterns

About two days ago I asked a question about the differences between these two patterns. after reading about the template method patterns in detail I found that although there are lots of similarities between them layer supertype is not the same as method template and vice versa. I've blogged about Layer Supertype before in here, now I want to talk about method template pattern. Basically, the template method is to run common functionality of a base class from the child class and use the objects of the child type in the common method functionality of the base type. It means that the best way of implementing the pattern is to create a base abstract class with abstract methods to implement the implementer of the base abstract class members.  Take a look this sample in C#:

 

 public abstract class Order
    {
        protected abstract bool CheckAccountAmount();
        protected abstract bool CheckProductAvailibility();

        public bool MakeOrder()
        {
            if (CheckAccountAmount())
            {
                if (CheckProductAvailibility())
                {
                    //Do Order process
                }
                else
                {
                    return false;
                }
                return false;
            }
            return false;
        }
    }


    public class Customer : Order
    {
        protected override bool CheckAccountAmount()
        {
            // recieve the information from credit card servers
            return true;
        }

        protected override bool CheckProductAvailibility()
        {
            // go to the database to see if the product is available
            return true;
        }
    }


    public class Member : Order
    {
        protected override bool CheckAccountAmount()
        {
            // go to the database to check if the members has enough account in his/her account
            return true;
        }

        protected override bool CheckProductAvailibility()
        {
            //  // go to the database to see if the product is available
            return true;
        }
    }


    public class Presentation
    {
        public void Operatio()
        {
            //call customer methods for order
            Order customer = new Customer();
            customer.MakeOrder();

            //call member methods for order
            Order member = new Member();
            member.MakeOrder();
        }
    }

 

As you can see, there is some common operation in both Member and Customer, I've created the MakeOrder method in the base class to be available for member and Customer. Making Order is a common task for Member and Customer on creating order and each of them can use it for its own order process. Making order is just for making an order and works only for it! I mean that It's a common task for making an order in the system but what do you think about creating a basket for customers and members? Can you use the same method (MakeOrder)? you should create another base class for it yeah?

the main goal of this blog post is to define the differences between template method pattern and layer supertype. If you have a look at my post about the layer supertype you can see that there are more similarities between them. Both of them reduce the duplication and reimplementation of code. I agree with Adriano comment on my question, it's better to talk about the similarities than differences of these patterns. But I think that template method patterns works on the same implementation of subtypes and redefine certain steps of an algorithm without changing the Algorithm's Structure. And it's mostly about sequential and common processes but layer supertype works on similarities of some operation on types and it's A type that acts as the supertype for all types in its layer.



Application lifecycle management(ALM)

Application lifecycle management is a set of pre-defined process and tools that include definition, design, development, testing, deployment and management to integrate, coordinate and manage the different phases of the software delivery process. It's not just writing code or a methodology to write better code and similar. It's just a continuous process of managing the life of a software application from concept to delivery throughout the entire development process.

By applying to ALM it's easy to coordinate the people, process and information in an iterative cycle of activities throughout the software-delivery supply chain. it help agile teams on making them to make better decision, manage costs and help them about the technical concerns. Throughout the ALM process, each of the software development processes could be easily monitored and controlled.

This first step in ALM is business case development analysis, it happens before the development process begins. Once the business case is approved, application development starts, and governance is now implemented through project portfolio management. The principal role of Application Lifecycle Management is to manage the life of a software application from concept to delivery throughout the entire development process. It provides visibility into product release readiness, automates development processes.

You can read more about ALM here as I did to learn and write this post: http://www.davidchappell.com/whatisalm--chappell.pdf



About Me

Ehsan Ghanbari

Hi! my name is Ehsan. I'm a developer, passionate technologist, and fan of clean code. I'm interested in enterprise and large-scale applications architecture and design patterns and I'm spending a lot of my time on architecture subject. Since 2008, I've been as a developer for companies and organizations and I've been focusing on Microsoft ecosystem all the time. During the&nb Read More

Post Tags
Pending Blog Posts
Strategic design
Factory Pattern
time out pattern in ajax
Selectors in Jquery
Peridic pattern
How to use PagedList In asp.net MVC
How to query over Icollection<> of a type with linq
Domain driven design VS model driven architecture
What's the DDD-lite?
Redis as a cache server