Solved

OO Design for a phrase

Posted on 2011-03-06
3
475 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:Praveen Kumar
[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
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:Praveen Kumar
ID: 35104998
Thanks you
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Pretext and Context: In this series, I wish to design the data model of systems in question. I will start by defining the scope and boundaries of the system, followed by subsystems involved, then finally the entities in those systems and subsystems…
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.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

705 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