Ehsan Ghanbari

Experience, DotNet, Solutions

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



Software development and butterfly effect

If you have developed a large scale system, you have seen that small mistaken changes at one place especially at the earlier steps have damaged the other parts in the future of the system. I'm not going to talk about a solution for it, Actually, there is no any way to stop doing this changes and their effects. But you can reduce the amount of these unwilling issues by some technique.

These little changes at the first steps or maybe at a specific part of software development is called butterfly effect which is discussed in chaos theory. Based on chaos theory small change anywhere in the system (requirement, analysis, design, code, testing) can cause a similar change nearby and that will another similar change. Maybe you have heard that: "Small variation in the initial condition of a dynamic system may produce large variation in the long-term behavior of the system", so it's worth to sit and analyze, design completely and then get start coding to reduce the butterfly effect in the future of your system.

These phenomena of sensitive dependence on initial conditions are known in physics as the butterfly effect. Errors in early collaboration, requirements, and design are tenfold as expensive to fix in the coding stage and it will be more expensive in the future. In general early analysis about requirements at first (agile manifesto!), exact estimation of the project's scope, managing the development team(conventions and collaborations) are all the necessary to reduce the risky changes of a project.

 



Convention over configuration

Developers only need to specify unconventional aspects of the application and worry only about the unconventional parts of the application and architecture. Convention over configuration is a software design principle, philosophy, and technique implied from the structure of the code instead of requiring explicit code. letting the code "just figure it out" from using naming conventions instead of explicit code or finding ways to avoid duplicating information in the system. Developers don't need to use a particular methodology or approach while that approach of a methodology is true. During the development process, lots of events could occur, so you should follow some conventions and know them. But be careful that Too much convention can make code confusing and make the system difficult to understand.



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
using Log4net in asp.net MVC4
How to use PagedList In asp.net MVC
Redis as a cache server
Domain driven design VS model driven architecture
What's the DDD-lite?
Multiple submit buttons in asp.net MVC