Solved

Connecting concreate class to abstract class

Posted on 2010-11-10
5
566 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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

749 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