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

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

Design Rules in EScala

Line: 158 to 158
  } 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.
Added:
>
>
An example of the syntax is showed below

  trait TransactionManagement {
    val transactionMechanisms: ITransactionMechanism

    // by referencing the event on the trait name, we observe all the existing instances
    HWFacade.transactionStarted += transactionMechanisms.begin _
    HWFacade.transactionFinished += transactionMechanisms.commit _
    HWFacade.transactionAborted += transactionMechanisms.rollback _

  }
 

Quantifying over classes

Changed:
<
<
Another solution would be to allow quantification over classes and not over object relationships
>
>
Another solution would be to allow quantification over classes and not over object relationships. The HWFacade type must be observable. One need a way to indicate that the IHWFacade is globally observable, that is to say one may observe all the existing instances of this type.

  type HWFacade <: IHWFacade
  observable trait IHWFacade {
    evt transactionStarted[Unit]
    evt transactionFinished[Unit]
    evt transactionAborted[Unit]
  }

(the use of the observable keyword here is not definitive, it is a first idea). By using this, we do not loose the OO modularity and can observe all the instances, the class/trait is instrumented when it is compiled. This mechanism could also mean that one can observe method executions of all instances of a class. This observable modifier for a class/trait would mean, that all events (explicit and implicit) may be observed on all instances. So this code would be a regular code

observable class C {
  def m(...) = ...
}

evt e = afterExec(C.m)
  -- 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