Solved

Connecting concreate class to abstract class

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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.
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

911 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now