Objects by Design Forums Here you can view your subscribed threads, work with private messages and edit your profile and preferences Registration is free! Calendar Find other members Frequently Asked Questions Search Home  
Objects by Design Forums : Powered by vBulletin version 2.3.5 Objects by Design Forums > Main Forums > UML Certification Review Questions > name collision
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
bhaskar
Junior Member

Registered: Jan 2002
Location:
Posts: 14

name collision

Which of the following is the BEST strategy for resolving class name collisions that occur during OO analysis?

a)Allow each team member to choose names for only those classes which they will build.

b)Create a class for each domain name, passing on requests to the one class that implements the behavior for all of them to share.

c)Discover unique names for different concepts that are referred to by the same term.

d)Put the classes into different packages so that the fully qualified class names are different.

I believe answer is c. Any other explanations?

Report this post to a moderator | IP: Logged

Old Post 03-19-2002 05:49 PM
bhaskar is offline Click Here to See the Profile for bhaskar Click here to Send bhaskar a Private Message Find more posts by bhaskar Add bhaskar to your buddy list Edit/Delete Message Reply w/Quote
rchon123
Junior Member

Registered: Mar 2002
Location:
Posts: 4

I would think the answer is d.

Explanation:
For example, Consider the University Registration System. There could be several use cases - a student registers for a class and prints the class schedule, a teacher views the classes that the teacher will be teaching and prints the class roster. Each of these use cases has a "print" functionality. It would be difficult to come up with unique names for a same print concept. Instead, we could have a student package with a print class that would specifically handle the student's printing needs and a teacher package with a print class that would handle the teacher's printing needs.

I am new to the field of UML, and could be totally off.

Thanks

Report this post to a moderator | IP: Logged

Old Post 03-19-2002 07:49 PM
rchon123 is offline Click Here to See the Profile for rchon123 Click here to Send rchon123 a Private Message Find more posts by rchon123 Add rchon123 to your buddy list Edit/Delete Message Reply w/Quote
smsreedhar
Junior Member

Registered: Feb 2002
Location: USA
Posts: 14

OOPS! First of all, I think, "print" is not a concept. It is action.

The answer should be (c).

Let's examine the example(say case-study) that mentioned. Here, in the first step-
you can derive the following concepts like this-

-University
-Student
-Teacher/Instructor
-Class/Program
-College/Institution
-Course/Subject
-Degree
-etc.,

Next step-
Write down the description of each concept and name it. Add attributes and associations between them.

Next step-
Take the specification perspective and add interfaces like

-Schedulable
-Printable
-etc.,

Next step-
Create a class or derive a new one which implements one or more of the above interfaces and implement them.

The above question can be simulated like this-

Think of graduation courses, regular and part-time. Then a Student class will have same name when considering a regular course or part-time course. In that case, modify the Student class's name to RegularStudent and PartTimeStudent.

Any one have better explanation?

__________________
smohan

Report this post to a moderator | IP: Logged

Old Post 03-20-2002 08:25 PM
smsreedhar is offline Click Here to See the Profile for smsreedhar Click here to Send smsreedhar a Private Message Find more posts by smsreedhar Add smsreedhar to your buddy list Edit/Delete Message Reply w/Quote
cejac63
Junior Member

Registered: Mar 2002
Location:
Posts: 20

I agree the answer should be (c).

Another example is say you have the following classes on the conceptual level, Checking Account, Savings Account or Money Market Account, which are all referring to a type<<interface>> of Account, but the names are more meaningfull.


Also look at the java.io package, Reader, BufferedReader, CharArrayReader etc.

Report this post to a moderator | IP: Logged

Old Post 03-20-2002 10:23 PM
cejac63 is offline Click Here to See the Profile for cejac63 Find more posts by cejac63 Add cejac63 to your buddy list Edit/Delete Message Reply w/Quote
rchon123
Junior Member

Registered: Mar 2002
Location:
Posts: 4

Looks like my example instead of proving my point took the discussion on a tangent.

My point is this:
Option "c" in my opinion, eliminates one of the benefits of OO - that is, being able to provide things with useful names that make sense in a specific context, even if they aren't completely unique - that is what packages are for. We see this in method names with polymorphism - adding a number doesn't mean the same as adding to a date. The examples that were presented by smsreedar and cejac deal with specialization, in which case it makes sense to have unique names - but we are not talking about specialization here.

Report this post to a moderator | IP: Logged

Old Post 03-21-2002 05:51 PM
rchon123 is offline Click Here to See the Profile for rchon123 Click here to Send rchon123 a Private Message Find more posts by rchon123 Add rchon123 to your buddy list Edit/Delete Message Reply w/Quote
donnipadu
Junior Member

Registered: Jun 2002
Location: Pennsylvania, US
Posts: 11

RCHON123,

Hmm.. resolving class name collissions during OO analysis!

I think the key is during OO Analysis. During analysis we are debating different concepts of the domain and trying to understand it. If there are two checking accounts offered by the bank (say one that offers interest and the other that doesn't), it would be convenient to have unique names for the domain concepts (in this case checking accounts). This helps unambiguous communication among the stake holders. In this context, discovering unique names for the concepts is the best strategy.

During design and implementation, the classes could be grouped in different packages and may be referred with their fully qualified names.

Hope that helps.

Report this post to a moderator | IP: Logged

Old Post 07-02-2002 12:40 AM
donnipadu is offline Click Here to See the Profile for donnipadu Click here to Send donnipadu a Private Message Find more posts by donnipadu Add donnipadu to your buddy list Edit/Delete Message Reply w/Quote
rgulati
Junior Member

Registered: Jul 2002
Location:
Posts: 9

Answer should be "c"

Report this post to a moderator | IP: Logged

Old Post 07-15-2002 06:39 PM
rgulati is offline Click Here to See the Profile for rgulati Click here to Send rgulati a Private Message Find more posts by rgulati Add rgulati to your buddy list Edit/Delete Message Reply w/Quote
cbedford
Member

Registered: Aug 2002
Location:
Posts: 71

Don't choose 'd'... it is a clever trap. Look at the 'reasons for grouping classes into a package' in the Larman notes on this site (section 3 architecture).... resolving naming conflicts is not on this list.... and if you think about is not a very good reason for grouping classes in one or another package... choose a different name.

Report this post to a moderator | IP: Logged

Old Post 09-05-2002 03:56 AM
cbedford is offline Click Here to See the Profile for cbedford Click here to Send cbedford a Private Message Find more posts by cbedford Add cbedford to your buddy list Edit/Delete Message Reply w/Quote
GVR
Junior Member

Registered: Aug 2002
Location: FL
Posts: 20

As I understand, given a namespace and a name, a particular element in a namespace can be found. The top level namespaces are packages.

Packages only aid in a logical grouping and it is possible that you have a name clash within that logical grouping (during analysis). In such a situation, one would look at coming up with alternative names (unique) rather than moving the class to an other package - to overcome the name conflict problem.

So I would route for option 'C'.

Report this post to a moderator | IP: Logged

Old Post 09-07-2002 04:01 PM
GVR is offline Click Here to See the Profile for GVR Click here to Send GVR a Private Message Find more posts by GVR Add GVR to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 11:20 PM. Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 

< Contact Us - Objects by Design >

Powered by: vBulletin Version 2.3.5
Copyright ©2000 - 2018, Jelsoft Enterprises Limited.
Copyright 1999-2005, Objects by Design, Inc.