Home - this site is powered by TWiki(R)
PROBRAL/InternalArea > HealthWatcherEScala (3 vs. 4)
TWiki webs: Main | TWiki | Sandbox   Log In or Register

Changes | Index | Search | Go
 <<O>>  Difference Topic HealthWatcherEScala (4 - 2010-10-27 - LucasSatabin)
Line: 1 to 1
 
META TOPICPARENT name="CaseStudies"

Design Rules in EScala

Line: 129 to 129
 
  • An action (a method in an OO design) consists in a list of steps which are mor or less explicit. These steps could be part of the method signature, exposing more events on the internal structure without breaking modularity. The details of implementation are not shown, only the specified steps of the method.
  • Having virtual classes in Scala could also help to refine DRs. For the moment Scala supports a Virtual Class Pattern which achieves the same goal but is quite verbose. An attempt was made to implement virtual classes in Scala, but not finished yet.
Added:
>
>

Quantifying over classes

An important problem to solve is the quantification over many different instances of a class, or over objects of different classes. There exists no declarative way to do it in EScala for the moment.

Encoding quantification over different instances/classes with the current version

In the example above, if the transactionManagement class observes many different Facade, we could encode it as follows

import scala.events.VarList

...
  trait TransactionManagement {
    // the VarList class allows to observe a mutable list
    // of variables.
    val facades = new VarList[HWFacade]
    val transactionMechanisms: ITransactionMechanism

    // using the any operator, we can observe any occurrence of the 
    // referenced event occuring in the list
    // e.g. the first event is
    // if any facade in the facade list triggers its transactionStarted event
    // the reaction is called
    facades.any(_.transactionStarted) += transactionMechanisms.begin _
    facades.any(_.transactionFinished) += transactionMechanisms.commit _
    facades.any(_.transactionAborted) += transactionMechanisms.rollback _

  }
But we must imperatively registers any new HWFacade in the facades list. This is good if we do not want to observe all existing instances but dynamically add or remove them from the list.

Quantifying over classes

Another solution would be to allow quantification over classes and not over object relationships

 -- LucasSatabin - 14 Oct 2010 \ No newline at end of file

View | History: r5 < r4 < r3 < r2 | More

View | History: r5 < r4 < r3 < r2 | More
This site is powered by the TWiki collaboration platform Powered by Perl This site is powered by the TWiki collaboration platformCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback

mersin escort bayan adana escort bayan izmit escort ankara escort bursa escort