by
cnwep1 >> Fri, 7 Apr 2000 10:59:19 GMT
Well Frankie I'm still not convinced.
At a minimum, the benefits obtained from being able to test and validate your logic independantly of the UI are major.
Imagine you don't have a 'controller' and just methods on a form. You can just as easily set properties on a form in a JadeScript method (say) as you can properties on a non-GUI object.
Add to that the greater deployment flexibility, ( business logic can be deployed in different tiers, and can be used in different applications ) and for any serious application it is definitely worthwhile.
Not sure what you mean by 'deployment': if you mean 'distribution' then that's not really an issue with Jade is it?
Use in different applications: If you can identify that you're going to need the same behaviour in more than one place then I can see some use of putting that behaviour on a controller class. Is it really worth the overhead of separating things just because you might possibly need to use it somewhere else for some imaginary situation in the future?
The major "disadvantage" is that extra layer of indirection, You write more "population of the UI" or "extract data from the UI" code than you might otherwise.
More code = more testing = more to go wrong = more to change = more $.
Some things that might be easily validated inside the UI might take longer to validate with remote business logic.
Not sure what you mean by 'remote business logic'. Chances are that a validation controller object is sitting in your transient cache and there'd be no trip to the server. This is JADE we're talking about not some complicated multi-tool environment.
What do some other gurus say about layering:
Fowler on the Advantages of the Presentation/Application logic split in 'Analysis Patterns':
"Layering is a good idea in principle, but it does have some disadvantages: the extra work is required to build the layer, and a performance penalty can be incurred in using it. The important question is, are the advantages worth the costs?"
He goes on to say that "One advantage comes from the different styles of programming involved in the two layers." With Jade this isn't an issue as the whole system is built using a single tool.
He also argues that "When facade (read ActivityAgent/Controller) and presentation are combined, the base computation can only be tested via the GUI, requiring manual testing" In Jade a form is just another kind of object and can be manipulated like any other if necessary.
And our mates from Scandiwegia (Jacobson OOSE A UseCase driven Approach):
"In fact, we can build any system with just these two object types (interface and entity). However, when such a model has been developed, you will notice that there are certain behaviours that are not naturally placed, from a maintainability view, in either entity objects or interface objects; or even worse, they are spread over several objects." Okay, it's a fair cop guvna.
They say one of the dangers of using control objects:
"Beginners sometimes only use entity objects as data carriers and place all dynamic behaviour in control objects. This should, however be avoided. Using this extreme, we will end up with a function/data structure" I've seen this in a system using agents/controllers. Whereas in systems with interface and entity classes the entities seem to do a lot of validation.
Craig Larman in "Applying UML and Patterns" says:
"Motivations for a multi-tiered architecture include:
a) Isolation of application logic into separate components which can be reused in other systems.
b) Distribution of tiers on different physical computing nodes, and/or different processes. This can improve performance and increase coordination and shared information in a client-server system.
c) Allocation of developers to construct specific tiers, such as a team working solely on presentation layer. This supports specialized expertise in terms of development skills, and the ability to run parallel team ddddevelopment efforts."
As far as I can see from the above only (a) might apply in Jade and even then the classes will be so specialised the opportunity for reuse must be slight.
All the received wisdom on the subject I've seen seems to relate to toolsets and environments quite different to JADE. Perhaps we can cut a few corners and get away with it. I can see that occasionally you will benefit from employing some kind of controller class but using them unnecessarily just because it's the fashion can't be productive.
Eric in Waitati (dark and misty and my dog wants to go for a wee)