Hi Ernest,

The refactoring looks great.  But if you're worried with good design, don't
forget the Law of Demeter -- which basically forbids code like

rete.getThis().getThat().doSomething();

...so if the changes you're doing will impose a lot of client traversal
code like this, it's better having the forwarding methods.

I'm also worried that without these methods, the programmer needs to
be better informed about Jess's internal structure.  Right now I don't
need to know that something called Agenda exists.  Your are exposing
detail that might better be hidden.  Look at the Rete public interface
from the Fa�ade pattern POV.  But if you do this (fwd methods) it's
better encapsulating completely the objects they are delegating to
-- so you'd provide either run() or getAgenda(), but NOT both; I think
the worst design is having multiple ways to access the same feature.

my $0.02,
Osvaldo

> I'm doing some work on Jess 6.x., and I'm trying to right some of the
> longstanding wrongs in the code. For example, there are two really
> glaring design issues I'm fixing: The ReteCompiler.addRule() method is
> ludicrously long, and therefore difficult to understand or modify;
> I've broken it out into more than a dozen pieces, and made all the
> pirces static. There are no more ReteCompiler objects, then. The other
> one is the catchall "Rete" class. Now, good O-O design says that a
> class should represent one idea and do one thing; jess.Rete
> represents, more or less, all of Jess. I've been breaking things out
> into separate classes; for instance, agenda management into a new
> Agenda class, router management into a new Routers class, etc.
>
> My question to you is: it would be a much better and cleaner design to
> have Rete look like this:
>
> class Rete
> {
>   public Agenda getAgenda() {...}
>   public Agenda getRouterManager() {...}
>   ...
> }
>
> and then have Agenda look like
>
> class Agenda
> {
>   public int run() { ... }
>   public void halt() { ... }
>  ...
> }
>
> But this would break ALL Java code that works with Jess. Should I
> compromise and put dozens of forwarding methods in Rete like
>
> public int run() { return m_theAgenda.run(); }
>
> or should we bite the bullet and do things correctly?
>
>
>
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Distributed Systems Research        Phone: (925) 294-2154
> Sandia National Labs                FAX:   (925) 294-2234
> Org. 8920, MS 9012                  [EMAIL PROTECTED]
> PO Box 969                  http://herzberg.ca.sandia.gov
> Livermore, CA 94550
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list (use your own address!) List problems? Notify
[EMAIL PROTECTED]
> ---------------------------------------------------------------------
>
>


---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to