[vwnc] Law of demeter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
jb
Reply | Threaded
Open this post in threaded view
|

[vwnc] Law of demeter

jb
Hi,

I am looking for a tool, that is able to check, wether my students
obey the rules of law of demeter when they program in Smalltalk. Does
anybody know if such a tool exists?

Johannes


Staatlich anerkannte private Fachhochschule
NORDAKADEMIE
Gemeinnützige Aktiengesellschaft
Köllner Chaussee 11
25337 Elmshorn

Vorstand:
Prof. Dr. Georg Plate (Vorsitzender), Dipl.-Ing. Jörg Meier (stellv. Vorstand)

Vorsitzender des Aufsichtsrats:
Dr. h.c. Hans-Heinrich Bruns

Sitz:
Elmshorn, Amtsgericht Elmshorn, HRB 1682


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Law of demeter

thomas.hawker
I personally have not heard of one, but for VisualWorks it shouldn't be too hard to manage.  Once you've run the source code through the parser, you get a program node tree.  By adding suitable extensions to the ProgramNode class hierarchy, you can have it answer whether the parse tree satisfies the Law of Demeter.

Reading through the Wikipedia article, the detection would seem to be that you for a message chain "(receiver message1) message2", which with the three kinds of method formats could make the identification tricky or selective.  The obvious form of a chain can be determined by looking for message nodes whose receiver is an embedded message.  You might need to do the same check with the arguments, but I wonder how you distinguish arithmetic expressions and computations...

I assume the assignment to a temporary case "variable := receiver message1" followed later by "variable message2" is not considered a problem, although I think the semantics are ambiguous in this sense.  When is "message1" only an accessor?  I also noticed that the statement of the law indicated that it was OK to send messages to objects created in the method - but how do you figure that out?  #new and #new: are just the more obvious factory methods, but they are by no means the only.

Good Luck.

Cheers!
 
Tom Hawker
--------------------------
Senior Framework Developer
--------------------------
Home +1 (408) 274-4128
Office +1 (408) 576-6591
Mobile +1 (408) 835-3643
 
-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Dr. Johannes Brauer
Sent: Monday, September 21, 2009 10:48 AM
To: VWNC
Subject: [vwnc] Law of demeter

Hi,

I am looking for a tool, that is able to check, wether my students
obey the rules of law of demeter when they program in Smalltalk. Does
anybody know if such a tool exists?

Johannes


Staatlich anerkannte private Fachhochschule
NORDAKADEMIE
Gemeinnützige Aktiengesellschaft
Köllner Chaussee 11
25337 Elmshorn

Vorstand:
Prof. Dr. Georg Plate (Vorsitzender), Dipl.-Ing. Jörg Meier (stellv. Vorstand)

Vorsitzender des Aufsichtsrats:
Dr. h.c. Hans-Heinrich Bruns

Sitz:
Elmshorn, Amtsgericht Elmshorn, HRB 1682


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

IMPORTANT NOTICE
Email from OOCL is confidential and may be legally privileged.  If it is not
intended for you, please delete it immediately unread.  The internet
cannot guarantee that this communication is free of viruses, interception
or interference and anyone who communicates with us by email is taken
to accept the risks in doing so.  Without limitation, OOCL and its affiliates
accept no liability whatsoever and howsoever arising in connection with
the use of this email.  Under no circumstances shall this email constitute
a binding agreement to carry or for provision of carriage services by OOCL,
which is subject to the availability of carrier's equipment and vessels and
the terms and conditions of OOCL's standard bill of lading which is also
available at http://www.oocl.com.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Law of demeter

Andres Valloud-4
In reply to this post by jb
IIRC, Caesar Systems used SUnit Based Validation to enforce that code
follows standard practices.  I seem to recall one of the things they did
was to enforce Demeter's Law.  I'll send you some contact information
privately (to prevent their email addresses from becoming spam
targets).  If anybody else is interested, let me know.

Dr. Johannes Brauer wrote:

> Hi,
>
> I am looking for a tool, that is able to check, wether my students
> obey the rules of law of demeter when they program in Smalltalk. Does
> anybody know if such a tool exists?
>
> Johannes
>
>
> Staatlich anerkannte private Fachhochschule
> NORDAKADEMIE
> Gemeinnützige Aktiengesellschaft
> Köllner Chaussee 11
> 25337 Elmshorn
>
> Vorstand:
> Prof. Dr. Georg Plate (Vorsitzender), Dipl.-Ing. Jörg Meier (stellv. Vorstand)
>
> Vorsitzender des Aufsichtsrats:
> Dr. h.c. Hans-Heinrich Bruns
>
> Sitz:
> Elmshorn, Amtsgericht Elmshorn, HRB 1682
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>  
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc