Solved

OO Design for a phrase

Posted on 2011-03-06
3
473 Views
Last Modified: 2013-11-12
An interviewer asked me to design a "Class Diagram" for following phrase. I could not asnwer what he expected.

Can some expert can design it in a object oriented way...

"A Person went to a Forest and wounded by a Tiger".

Thanks
Praveen
0
Comment
Question by:Mamtha1982
3 Comments
 
LVL 29

Accepted Solution

by:
pepr earned 250 total points
ID: 35054907
Start here http://en.wikipedia.org/wiki/Class_diagram

Basically, each object can be thought of being of some class.  The class defines (describes statically) the behaviour of the object. When thinking about the situation, you may sometimes think in terms "the object is closely related to its class" -- like in the situation.  This way, you have: a person, a forest, and a tiger.

There is some interrelation between them. And there are some actions of one entity towards the other entity.  Think about modeling the real situation by the objects. What must be the objects capable of (i.e. what must be described by their classes) to describe the situation? How can it be decribed graphically?  The key idea is to capture the abstract idea kept in our mind.
0
 
LVL 12

Assisted Solution

by:marklorenz
marklorenz earned 250 total points
ID: 35056039
They wanted you to pick up on the nouns and verbs and essentially put yourself into the problem domain (even though not realistic for real software design).

So, you would have a Forest that has-a Animals (with specialization being a Tiger) and a Person.  These classes of objects exist in the domain they gave you.

Besides the "is-a" and "has-a", there is also behavior (methods).  In the very small case here, there is "attack" or some such behavior of a Tiger, with a Person being able to be in the state "wounded".

This is a good read for UML class diagrams, but I'd recommend you read on UML more generally too so that you understand the methodology.

http://www.agilemodeling.com/artifacts/classDiagram.htm

Here is more UML:

http://www.agilemodeling.com/essays/umlDiagrams.htm

Besides online, I'd recommend Fowler's book UML Distilled as well as Larman's Applying UML and Patterns book.
0
 
LVL 12

Author Comment

by:Mamtha1982
ID: 35104998
Thanks you
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Introduction This article discusses the Chain of Responsibility pattern, explaining What it is;Why it is; andHow it is At the end of this article, I hope you will be able to describe the use and benefits of Chain of Responsibility.  Backgrou…
Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 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