Solved

In UML/OOAD is Rectangle class subclass of Polygon or Quadrilateral

Posted on 2004-09-15
3
576 Views
Last Modified: 2008-01-16
Hi
I want to know if Rectangle class is subclass of Quadrilateral or subclass of polygon.
I am sure Quadrilateral is subclass of polygon..but whats the difference between having Rectangle as subclass of polygon and having it as subclass of Quadrilateral.
Which one is the right one /better one. and why.

Thanks
arun
0
Comment
Question by:myarun
3 Comments
 
LVL 9

Accepted Solution

by:
tinchos earned 125 total points
ID: 12075309
Hi arun

I would say that the better you model the better your software will be.

First of all, i would suggest that you try to see which are the classes you need to model for the software you're making.

Once you have all that then you may start to group them and find super classes and so on.

What I mean is the following......

I guess that all quadrilaterals (which I believe to be poligons of 4 sides) ARE poligons.
so I would say that quadrilateral should be a subclass of polygon.

Apart from that, a rectangle is a particular quadrilateral, so as rectangle ARE quadrilaterals then the rectangle class should  be a subclass of quadrilateral.

So you would have that rectangle is a subclass of quadrilateral and quadrilateral is a subclass of polygon.
(Indirectly rectangle is a subclass of polyline).
This would be a correct model.

Now.... the model I previously described, although correct, may be modelling some things that are not necessary.
Suppose that figures you will work on have 4 sides, so that there all polygons you'll use have 4 sides, so they are quadrilaterals. Then it is not necessary that you have a polyline class. Then your base class will be quadrilateral and you'll make your class hierarchy from there.

Hope this helps

Tincho
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

Title # Comments Views Activity
countHi challenge 25 100
Counting documents in a Domino View 3 66
Getting the Error "User-defined type not defined" in MS Access 2013 16 47
T-SQL:  Sigh---Boy, this is fun.... 12 34
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

862 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

24 Experts available now in Live!

Get 1:1 Help Now