Environmental Engineering Reference
In-Depth Information
IDomainClass
ComponentAPI
property
+ Estimate(IStrategyComponent, DomainClass*) : void
+ Estimate(IStrategyComponent, DomainClass*, char, boolean) : void
+ Info() : void
+ Description() : char
+ URL() : char
+ StrategyUsed() : List<char>
1..*
«interface»
IStrategy
1..*
«interface»
IStrategyComponent
DomainClass
+ Estimate(DomainClass*) : void
+ TestPreconditions(DomainClass*) : void
+ TestPostconditions(DomainClass*) : void
+ ResetOutput() : void
+ SetParamatersDefault() : void
property
1..*
+ TimeStep() : List<int>
+ IsContext() : boolean
+ Description() : char
+ URL() : char
Instances of domain classes
are input-ouput objects to be
used in the modelling of the
domain
Strategy
CompositeStrategy
ContextStrategy
1..*
2..*
Context classes encapsulate logic
to select among strategies and
composite strategies
2..*
Fig. 4.5 Class diagram of a generic component according to the design used in APES components
The sample class diagram of a generic component in Fig. 4.5 shows the different
type of strategies and the common interface which allows the design patterns
described above to be implemented. The common interface IStrategyComponent and
the capability to inherit from DomainClasses to extend them allows extending the
component independently by third parties, and still using the original ComponentAPI.
The interface used for models is the same for all modelling solutions in the
component and can be seen as an implementation of the Façade design pattern
(Bishop 2008) to hide the complexity of model solutions based on composite strate-
gies. This leads to their being a single signature for internal and extended models.
An example of simple and composite strategies is given by Villa et al. (2006) .
Composite strategies too can be added to the components without requiring a re-
compilation of their code, thus providing a way to extend component models fully
autonomously by third parties. Composite strategies are solutions to modelling
problems at a coarser granularity (in principle) than that of simple strategies. As an
example, a composite strategy may be built to simulate “crop potential production”
and be developed by putting together simple strategies such as “light interception”,
“crop development”, “leaf area expansion”, etc. In other terms, a composite strategy
is a “closed” solution which makes use of selected models of finer granularity as units
of composition. Such a closed solution is not proposed as the unique solution for a
specific modelling problem in a component as other options can co-exist or be added
by third parties. Referring to the example above, two composite strategies may use
different simple strategies to simulate “light interception” depending on whether they
target the simulation of homogeneous canopies or wide-row crops. Even though such
Search WWH ::




Custom Search