aspose file tools*
The moose likes Beginning Java and the fly likes what is strong law of demeter ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what is strong law of demeter ?" Watch "what is strong law of demeter ?" New topic
Author

what is strong law of demeter ?

Honggui Li
Greenhorn

Joined: Aug 10, 2001
Posts: 26
Hello, everyone:
I got this question from my instructor,and i can't find the answer from the sun website. Please help me as soon as you can.
What is Strong Law of Demeter ? In each implementation of methods getArea() and calculateColor(),which form of Law of Demeter is broken?
class R
{
protected int width;
protected int height;
}
class FR extends Rectangle
{
private int color;
public int getArea()
{
return width * height;
}
public int calculateColor(float f)
{
return color * f;
}
}
I am looking forward to hearing from you.
Thanks in advance.
Honggui
James Hobson
Ranch Hand

Joined: Aug 28, 2001
Posts: 140
http://www.softcomp.com/class7/demeter.htm http://www.cs.vu.nl/~eliens/online/oo/I/4/develop.html
Law of Demeter
Do not refer to a class C in a method m unless C is (the type of)
1. an instance variable
2. an argument of m
3. an object created in m
4. a global variable
Honggui Li
Greenhorn

Joined: Aug 10, 2001
Posts: 26
Hello:Mr. Hobson:
Thank you for your help. I appreciate it.
Have a nice day.
Honggui
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Thank God for Google.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is strong law of demeter ?