Talk:Action at a distance (computer science)

From Wikipedia, the free encyclopedia

Is the Perl code really necessary here? I understand from the discussion that it is a language that has historically suffered from many problems of this kind, but the code for "package WhineyScalar" is completely incomprehensible to me -- and I used to be a part-time Perl programmer for a while, only five years ago. Perhaps it would be best if it were placed on a web page and a link added in the "See also" section?

Also, what exactly is "MoveCollectionsOfFunctionsToObjects" and how does it help reduce action across objects? It sounds like a design pattern, but it's not one I've come across before, and isn't in my copy of the original Design Patterns book. A search for that text (with spaces added) on wikipedia turns up no matching documents either.

JulesH 9 July 2005 19:06 (UTC)


Contents

[edit] Catching action at a distance in scalars

I removed this material (icncluding the heading above) from the article to talk because it is perl specific.RJFJR 21:10, 29 September 2005 (UTC)

package WhineyScalar;

sub new { tie $_[1], $_[0]; }

sub TIESCALAR {
  bless \my $a, shift;
}

sub FETCH {
  my $me = shift;
  $$me;
}

sub STORE {
  my $me = shift;
  my $oldval = $$me;
  $$me = shift;
  (my $package, my $filename, my $line) = caller; 
  print STDERR "value changed from $oldval to $$me at ", join ' ', $package, $filename, $line, "\n";
}

1;

Use this with:

use WhineyScalar;
new WhineyScalar my $foo;
$foo = 30;  # this generates diagnostic output
print $foo, "\n";
$foo++;     # this generates diagnostic output

Using tie on a scalar, one can intercept attempts to store data, and generate diagnostics to help one track down what unexpected sequence of events is taking place.


[edit] removed from article

I removed this paragraph

Accumulate and fire situations should be replaced with a command object or whole object arrangement, or a model view controller configuration.

because it contains too many redlinks and isn't clear. If we are going to reinsert it then we need to reword it first (IMHO). RJFJR 01:39, 30 September 2005 (UTC)


[edit] Removed

I also removed this:

Communications should occur in events or queues rather than shared state. If events are used, unexpected events are communicated immediately, because any component can evaluate and react to values. If queues are used, the direction of data flow is defined.

It seems a little too specific. RJFJR 01:10, 1 October 2005 (UTC)


[edit] Cleanup Taskforce

I did a good deal of editing on this article as part of the Wikipedia:Cleanup Taskforce. If anyone has comments on the changes I'd appreciate hearing them. This article has been closed out as a taskforce item. RJFJR 01:23, 1 October 2005 (UTC)

Cleanup Taskforce article This article has been improved by the Cleanup Taskforce to conform with a higher standard of quality. Please see its Cleanup Taskforce page for more details on this process, and possible ideas on how you can further improve this article!