CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 1999
    Location
    Mississippi Gulf Coast
    Posts
    16

    OOP Design using MVC

    I'm currently designing a program in which I use the Model, View, Controller paradigm in one section of it. What I have is a class with my data (my model) called FourPt. Now, I have many different JPanels that are going to "observe" the data in FourPt (approximately 8 JPanels). I have two JPanels which are superclasses to the previously mentioned 8 JPanels. My question is:

    Can I make the two JPanels which are super classes of these 8 JPanels mentioned above as observers instead of making each of the individual 8 JPanels observe the FourPt?
    If so, will the observer pattern be "inherited" because the 8 JPanels are inherited from the two super JPanels?
    I'm just not sure my design approach is correct. Thanks in advance!

    Shannon Harvey
    [email protected]

  2. #2
    Join Date
    Jul 1999
    Posts
    21

    Re: OOP Design using MVC

    would you give more details about it?

    This is from david dong.

  3. #3
    Join Date
    Jun 1999
    Location
    Mississippi Gulf Coast
    Posts
    16

    Re: OOP Design using MVC

    Well, here it goes
    Ok, well if I have a class called solutionPanel that is the 'super' class of another class called subPanel. I also have a class called outputPanel that is the super class of subPanel2. Think of it as solutionPanel and outputPanel are even with each other in the hierarchy, while subPanel and subPanel2 are even with each other.
    If I make the solutionPanel and outputPanel observers (implementing the observer interface), will the subPanel and subPanel2 classes inherit this "functionality"? That is, will they themselves be Observers because they are derived from solutionPanel and outputPanel. If so, will I be able to define a 'default' update method in the solutionPanel/outputPanel?
    Basically I've got a design that uses an abstract class called AbstractDataModel that all my "data types" (like the FourPt I mentioned in my previous post) will derive from. This is so I can establish some generic functionality and definitions of ANY data type I may wish to add in the future. That's my model, but as to my view, I'm trying to set up may different observers of the data types I'm using, and I'm afraid I may be going about the wrong approach here...tks!

    Shannon Harvey
    [email protected]

  4. #4
    Join Date
    Jul 1999
    Posts
    21

    Re: OOP Design using MVC

    you can

    This is from david dong.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured