The evolution of software architecture model based on message

Source: Internet
Author: User
Tags eventbus

An excellent architect always has a good balance between the merits of various solutions and the corresponding cost, which is the architect's rich experience and broad knowledge system. The message-based software construction model is the architect's necessary knowledge point, this article will describe the model's evolution process in detail.

Remember the first time I was dealing with the company's software architect, he asked me, "Hi ABC, how is your functional design?" "I kind of disagree, is not a very small function, why use the word" design ", why not" How is your code written? " ”。 I later understood that the word "design" represented his attitude to the software, that any function in his eyes should be designed, and that no design code, like a running account, could cope with the present, and that the code became non-extensible and maintainable over time. With the evolution of the architecture model, the same requirement is designed and evolved, and finally formed.

This article series contains the following content:

    • C # Implementations of three observer patterns-implementing observer patterns at the code level
    • Memory leak analysis caused by events in. Net--understanding why weak references are used to implement Eventbus
    • Reactive programming (reactive programming)--functional implementation of event model
    • Eventaggregator, implementation of Eventbus--Analysis of Eventbus code in MVVM light
    • Further abstraction of Enterprise service Bus (ESB)-eventbus-build highly scalable, low-coupling distributed applications using Nservicebus
    • Servicebus with the CQRS architecture using the Outlook--CQRS architecture using Servicebus

Looking at this directory, some people may wonder why the first three articles are all about observer patterns and events, and what does this have to do with message-based architectures?

            var watcher = new FileSystemWatcher ();            Watcher. Created + = (object sender, FileSystemEventArgs e) =            {                MessageBox.Show (string. Format ("I am interesting in filename={0} and Path={1} which was created", E.name,e.fullpath));            

This is the code that uses the event. The event model in NET is an observer pattern, which can be described as: Observer (Observer)-Anonymous lambda function observes a subject (subject) Created. Whenever a file is created, created iterates through all the observers and notifies them to execute.

The message is a further abstraction of the observer pattern. The FileSystemEventArgs in the subject (subject) contains information that we are interested in, and we can interpret FileSystemEventArgs as a message, When FileSystemWatcher discovers that a new file is created and sends a message of type FileSystemEventArgs, different components can subscribe to this message to obtain information such as the name and path of the file being created. When FileSystemEventArgs can be serialized and transmitted over a network, different subsystems can subscribe to this message and eventually evolve into a distributed system.

The final architecture diagram is as follows:

Each subsystem sends its own messages to the ESB while subscribing to messages of interest to other systems. The subsystems are no longer directly dependent on each other, and a new system is directly connected to the ESB later. The entire architecture eventually evolved into loosely coupled, highly scalable distributed systems.

Code address for the entire series: [Email Protected]:richieyangs/eventarchitecture.git

The evolution of software architecture model based on message

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.