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 5998933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:28:33+00:00 2026-05-23T00:28:33+00:00

A naive implementation of MVC leeds to infinite loops. Example: Model is a Workbook

  • 0

Model-View-Controler

A naive implementation of MVC leeds to infinite loops.

Example: Model is a Workbook with Worksheets, View is a Tabbar with Tabs

  1. User interakts with Tabbar to create new Tab
  2. Tabbar sends event onTabAdded to Controler
  3. Controler calls Workbook.addWorksheet()
  4. Workbook sends event onWorksheetAdded to Tabbar
  5. Tabbar adds Tab and sends onTabAdded to Controler -> 2) Infinite Loop!

Alternatively, the loop could be initiated by programmatically
adding a Worksheet through a macro.
Or a tab could be added programmatically by automated UI testing.

It seems that the more components you have and the looser the coupling is
(considered good design), the more likely it is to have infinite loops.

Do you know about implementation patterns how to avoid such infinite loops?
An evaluation of pros/cons of such patterns?

My special interest is a solution for a rich JavaScript client.

The answers to the following questions are not really on the implementation
level:

  • should the Observer Pattern include some infinite loop detection?
  • Event driven architecture…infinite loop
  • how to avoid infinite loop in observer pattern?
  • 1 1 Answer
  • 0 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-23T00:28:34+00:00Added an answer on May 23, 2026 at 12:28 am

    You would typically code something like this (pseudo code):

    boolean inEventProcessing = false;
    
    processEvent(event){
        if inEventProcessing return
        inEventProcessing = true
        doProcessEvent(event)
        inEventProcessing = false
    }
    

    The alternative is to make sure that by construction no loops happen. This is the conceptual cleaner way, but hard to do if you don’t come up with it in the very beginning. One way would be to allow Observers only arguments to the constructors of Observables. This way it would be impossible to construct loops. But it is a extremely rigid structure which probably causes all kinds of different problems.

    I do suspect the solution of those problems would lead to a really nice and clean architecture or to a complete and extreme mess, depending on the team working with it.

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

Sidebar

Related Questions

I suppose the naive implementation of a + operator for matrices (2D for instance)
Perhaps this is a naive question. In my understanding, ASP.NET MVC cannot work with
I have an algorithm to test for primality, which uses the naive implementation as
In my ASP.NET MVC 3 web application I am overriding the View name in
take a look at this naive (and just for training purpose) implementation of stack
I need to develop a naive implementation of database indexes for use in a
Does VbScript have a native implementation for Regex? I need to validate e-mail addresses
Are calls to Canvas.drawPath()/drawArc()/etc hardware accelerated, passed to a device native implementation or implemented
The examples for JNI i've seen map Java native methods to implementation by C++
Naive question about Java syntax. What does <T> T accept(ObjectVisitorEx<T> visitor); mean? What would

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.