Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3310096
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:43:07+00:00 2026-05-17T21:43:07+00:00

Suppose you have an application that consists of two layers: A: A data layer

  • 0

Suppose you have an application that consists of two layers:

  • A: A data layer that stores all the data loaded from a database or from a file
  • B: A layer that shows the data in a nice user interface, e.g. a graphical report

Now, data is changed in layer A. We have 2 approaches to make sure that the reports from layer B are correctly updated.

The first approach is the PUSH approach. Layer A notifies layer B via observers so layer B can update its reports.

There are several disadvantages in the PUSH approach:

  • If data is changed multiple times (e.g. during load or in algorithms that change much data) the observers are executed many times. This can be solved by introducing a kind of buffering (prevent calling observers while you are still changing), but this can be very tricky and making the right buffering calls is often forgotten.
  • If much data is changed, the observer calls may cause an overhead that is not acceptible in the application.

The other approach is the PULL approach. Layer A just remembers which data was changed and sends out no notifications (layer A is flagged dirty). After the action that was executed by the user (could be running an algorithm or loading a file or something else), we check all of our user interface components, and ask them to update themselves.
In this case layer B is asked to update itself. First it will check if any of its underlying layers (layer A) is dirty. If it is, it will get the changes and update itself. If layer A was not dirty, the report knew it had nothing to do.

The best solution depends on the situation. In my situation, the PUSH approach seems much better.

The situation becomes much more difficult if we have more than 2 layers. Suppose we have the following 4 layers:

  • A: A data layer that stores all the data loaded from a database or from a file
  • B: A layer that uses the data layer (layer A), e.g. to filter the data from A using a complex filter function
  • C: A layer that uses layer B, e.g. to aggregate data from layer B into smaller pieces of information
  • D: A report that interprets the results of layer C and presents it in a nice graphical way to the user

In this case, PUSHING the changes will almost certainly introduce a much higher overhead.

On the other hand, PULLING the changes requires that:

  • layer D has to call layer C to ask if it is dirty
  • layer C has to call layer B to ask if it is dirty
  • layer B has to call layer A to ask if it is dirty

If nothing has been changed the amount of calls to execute before you know that actually nothing has been changed and you don’t have to do anything is rather big. It seems like the performance overhead that we try to avoid by not using the PUSH, is now coming back to use in the PULL approach because of the many calls to ask if anything is dirty.

Are there patterns that solve this kind of problem in a nice and high-performance (low overhead) way?

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:43:08+00:00Added an answer on May 17, 2026 at 9:43 pm

    No. No free lunch, no silver bullet. It’s all down to careful design. You’ve pretty much covered common techniques it’s applying them cleverly which needs care and avoidance of assumptions.

    I query two of your statements:

    You imply that the controlling of PUSH notifications is unduly difficult. I would have expected that in many cases you tend to have a master computation engine, which grabs data and does calculations. The engine must surely stop at some point, and at that point it can send the “New Data Ready” event, which can contain finer-grained information about what’s changed.

    You say that make 4 inter-layer calls is too expensive. What’s the basis for that? compared with what? If youa re concerned by the mutiplier factor (10 D instances) call ( 5 C instances ) call (2 B instances) call (1 A instance) so A gets hit with 100 calls, then surely we optimise? Each level can say “If I’m currently calling or I heard the answer recently, no need to call again”.

    When we consider the scaling benefits of the layers a few cheap queries may not be excessive.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose you have two seperate ASP.NET Web Application projects that both need to use
Suppose I have some application A with a database. Now I want to add
Suppose I have a class 'Application'. In order to be initialised it takes certain
Say suppose 10 developers have taken 6 months to develop some application. As a
Suppose I have two applications written in C#. The first is a third party
Suppose I have a stringbuilder in C# that does this: StringBuilder sb = new
Suppose you have 2 different ASP.NET applications in IIS. Also, you have some ASCX
Suppose you have an ActiveRecord::Observer in one of your Ruby on Rails applications -
Suppose we have a table A: itemid mark 1 5 2 3 and table
Suppose I have the following CSS rule in my page: body { font-family: Calibri,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.