Solved

Connecting concreate class to abstract class

Posted on 2010-11-10
5
569 Views
Last Modified: 2012-05-10
Hello

In below diagram where is the correct place for Parameter class. Should I connect it to an abstract class?

 uml diagram
Kind regards.
0
Comment
Question by:vileda
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 16

Expert Comment

by:kris_per
ID: 34101030
I guess you want to use the Parameter class in getParameter method. Then it is related to AbstractContainer.

If AbstractContainer class has a list of Parameter objects, then it is aggregation.

If Parameter class is used only in getParameter method, then I think it is not necessary to show Parameter class in the diagram; if you want, you can relate it to AbstractContainer with a dotted line, just for a note as the design is already clear with other classes.

0
 

Author Comment

by:vileda
ID: 34101920

Should I create a AbstractParameter class that connected to AbstractContainer class.

I don't want to connect it to AbstractContainer class. Because the package which includes my Abstract Container class is highly stable. When I add a concrete class to this package it becomes more instable so that the other packages depends on this package will become relatively more stable.

This means breaking the Stable Abstraction Principle:
http://c2.com/cgi/wiki?StableAbstractionsPrinciple

What should I do now?
0
 
LVL 4

Accepted Solution

by:
greyfairer earned 250 total points
ID: 34102579
The AbstractContainer.getParameter(...) returns an int, so the Parameter object is not coupled directly to  the Abstraction.

The Parameter object is  probably only used inside methods in ConcreteContainer, so I would only link it there. Creating an AbstractParameter is also totally useless. The Concrete container and the Parameter Object should be in a concrete package.
0
 
LVL 16

Assisted Solution

by:kris_per
kris_per earned 250 total points
ID: 34103034
My understanding of what is meant by 'stable' in your comment and in the link is 'frequency of change'. I think what it means is that less changing, contract-finalized (stable) packages should be 'abstract'.

It looks like the getParameter method in AbstractContainer doesn't use Parameter class currently. I think you are trying to change it to use Parameter class. i.e. You are trying to make the 'abstract' to be 'unstable'. If you dont want this to happen, then leave the getParamter method as it is now and hence you dont need to link to the AbstractContainer.  Then Parameter class is more an internal detail (could be used inside ConcreteContainer). Then you dont need to specify the Parameter class in the diagram at all.  

You wouldn't need AbstractParameter class either. I think you should view this as a helper class rather than like a main class in the design.
0
 
LVL 4

Expert Comment

by:greyfairer
ID: 34126840
FYI: Definition of 'stability' in OOP: http://en.wikipedia.org/wiki/Software_package_metrics

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Fluent Interface Design Pattern You can use the Fluent Interface (http://en.wikipedia.org/wiki/Fluent_interface) design pattern to make your PHP code easier to read and maintain.  "Fluent Interface" is an object-oriented design pattern that r…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question