by
Paul Mathews >> Sun, 18 Feb 2001 14:04:20 GMT
It is good that there is a demostration as Dean points.
The following is some feedback I gave Dean on the Erwhon Investments application, on the 26th of April 2000.
So these comments may be out of date.
=================================================================================================== Thanks Dean for sharing your expertise on the the Erwhon Investments application.
There is one major area which I feel is overcomplicates matters quite
a bit.
That is the use of the Activity Agent and it's implementation, TransactionAgent and ValidationAgent.
eg Looking at the Agent Class for example there are the following methods.
TransactionAgent.trxCreateAgent(agentName,address1,address2,address3,phone,fax,email,webSite,agentNew Output
TransactionAgent.trxDeleteAgent(Agent io) TransactionAgent.trxUpdateAgentagentForUpdate,agentName,address1,address2,address3,phone,fax,email,webSite) ValidationAgent.valCreateAgent(agentName,address1,address2,address3,phone,fax,email,webSite)
ValidationAgent.valUpdateAgent(agentForUpdate,agentName,address1,address2,address3,phone,fax,email,webSite)
Company.createAgent(agentName,address1,address2,address3,phone,fax,email,webSite)
Agent.createEntity(agentName,address1,address2,address3,phone,fax,email,webSite, company) Agent.update(agentName,address1,address2,address3,phone,fax,email,webSite)
1) There are 7 methods with a similar set of parameters which have to
be updated any time a parameter is added/changed/deleted.
Using the existing approach this could be simplified by
1) removing:
ValidationAgent.valCreateAgent
ValidationAgent.valUpdateAgent
Company.createAgent
Agent.createEntity
2) i)renaming/changing Agent.update to Agent.setAgent which now is
passed it Parent (currently Company)
ii) All validation Code is now also within this one method. Agent.setAgent(agentName,address1,address2,address3,phone,fax,email,webSite,myParent)
The Interim outcome is now:
TransactionAgent.trxCreateAgent(agentName,address1,address2,address3,phone,fax,email,webSite,agentNew Output
TransactionAgent.trxDeleteAgent(Agent io) TransactionAgent.trxUpdateAgent(agentForUpdate,agentName,address1,address2,address3,phone,fax,email,webSite) Agent.setAGent(agentName,address1,address2,address3,phone,fax,email,webSite,myParent)
If one looks at the code where TransactionAgent.trxCreateAgent and TransactionAgent.trxUpdateAgent are used.
Both methods are not required only TransactionAgent.trxUpdateAgent.
When need to create, null is passed across.
Hence without changing the approach of an ActivityAgent, the number of methods that need to be maintained has been reduced signicantly and provides for future flexibility (changing myParent latter to another Class).
The Final outcome is now:
TransactionAgent.trxDeleteAgent(Agent io) TransactionAgent.trxUpdateAgent(agentForUpdate,agentName,address1,address2,address3,phone,fax,email,webSite) Agent.setAGent(agentName,address1,address2,address3,phone,fax,email,webSite,myParent)
1) For people new to Jade I think they will find this easier to understand.
2) Using this approach it is easier for setMethods to inherit Valid/Updating code when classes are subclassed.
3) When a setMethod updates/creates instances in other Classesall
error handling is encapsulated as other setMethods are called.
PS I may have missed something, but an example of a destructor method
I believe would also be usefull.
A new Exception Class, DeletionException (under NormalException Class)
is added, etc.
eg
delete() updating;
// Date: 19 January 1999
// User: paulm
// Copyright: C&M Systems Group
begin
if app.massDelete = false then// No validation check when
doing massDelete
if allCMLists.size > 0 then
DeletionException.raise_(64000,'Cannot Delete,
Children still exist');
endif;
endif;
end;
Paul Mathews
pem@cmsystemsgroup.com.au
Phone: [612] (99717384) Fax[612] (99711679)
(Dee Why,Sydney,Australia)