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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:02:10+00:00 2026-06-13T19:02:10+00:00

This question pertains to MVC (Model-View-Controller). My Model currently updates my View when it

  • 0

This question pertains to MVC (Model-View-Controller). My Model currently updates my View when it has changed using the Observer / Observable pattern in Java:

public class Model extends Observable {
}

public class View implements Observer {

    @Override
    public void update(observable o, Object obj) {
        // ... update the view using the model.
    }

}

This works fine. However, my model is growing more complex – it’s starting to hold Lists of other classes:

public class Model extends Observable {
    List<Person> people = new ArrayList<Person>();
}

public class Person {
    private String name = "";
    // ... getter / setter for name
}

My problem is: when a Person’s name changes I want to update the view listening to the model which contains that person. The only way I can think of is to have Model implement an Observer class and have Person extend an Observable class. Then, when Person changes, he notifies his observers (which would include the parent Model).

However, this seems like a lot of work if my models get complex. Are there any better ways to “bubble-up” changes to the parent model?

  • 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-06-13T19:02:12+00:00Added an answer on June 13, 2026 at 7:02 pm

    First of all usually it is a bad idea to use Observable since you need to extend this class to use it.
    In any case what you are describing is an aggregation of observed entities.
    Don’t complicate simple things. Make each entity an observable and let it take care of registrations and notifications. You don’t have to include specifically a class named Model to aggregate everything. Break your design.

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

Sidebar

Related Questions

This question pertains primarily to good design. Suppose I have a controller action like
This question pertains to query optimization using Linq with the Entity Framework. Is there
This question is related to another question I wrote: Trouble using DOTNET from PHP.
thank you for your time, (As a side note, this question pertains mostly to
To all: This question pertains to some MS research I am doing. What I
I have two tables pertaining to this question: conversations has many messages . The
NOTE: This question is tricky (to decide whether it pertains to SO or not),
This question pertains specifically to shell scripts, but could be about any programming language.
This question pertains to xperf and xperfview, utilities that are part of the Windows
My question pertains to a Rails naming convention conundrum. My application has sign up,

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.