1 N Degrees of Separation: Multi-Dimensional Separation of Concern (MDSOC) HyperJ: language and...
-
Upload
franklin-stephens -
Category
Documents
-
view
215 -
download
1
Transcript of 1 N Degrees of Separation: Multi-Dimensional Separation of Concern (MDSOC) HyperJ: language and...
1
N Degrees of Separation:N Degrees of Separation:Multi-Dimensional Separation Multi-Dimensional Separation of Concern (MDSOC)of Concern (MDSOC)
HyperJ: language and HyperJ: language and concepts of general concern concepts of general concern combinationcombination
2
Multi-dimensional Multi-dimensional separation of concerns separation of concerns (MDSOC)(MDSOC)
Multi dimensions separation of concerns refers to the ability to identify, encapsulate, and manipulate those parts of software that are relevant to a particular concern (concept, goal, purpose, etc.).
It helps supporting construction, evolution and integration of software.
3
Types of concernsTypes of concerns::
The prevalent concern in object-oriented programming is the class, which encapsulates data concerns.
Feature concerns, like printing, persistence, and display capabilities, are also common.
Aspects, roles, variants, and configurations.
Concern means “a particular area of interestConcern means “a particular area of interest” ”
4
Multi-dimensional Multi-dimensional separation of concerns separation of concerns (cont.)(cont.) Its goals are to enable:
Encapsulation of all types of concerns in a software system, simultaneously.
Overlapping and interacting concerns. On-demand remodularization.
It compliments existing formalisms, giving developers additional modularization flexibility while continuing to use the formalisms of their choice.
5
Hyper/JHyper/J
Hyper/J supports multi-dimensional separation of concerns for JavaTM.
It provides: Ability to specify modules according to
concerns. Synthesize systems and components by
integrating those modules.
6
7
Personnel Software - Personnel Software - RequirementsRequirements
Personnel feature: name Print
Business rules: 1-3 managers for each employee
The payroll feature: Salary information Tax regulations minimum and maximum wage.
8
Personnel Software – Personnel Software – Class hierarchyClass hierarchy
name()print()check()position()pay()
EmployeeEmployee
name()print()check()position()pay()
SalesSalesname()print()check()position()pay()
ResearchResearchname()print()check()position()pay()
StaffStaff
name()print()check()position()pay()
ResearchMgrResearchMgrname()print()check()position()pay()
SecretarySecretaryname()print()check()position()pay()
MaintenanceMaintenancename()print()check()position()pay()
SalesMgrSalesMgr
9
The tyranny of the The tyranny of the dominant decompositiondominant decomposition
Existing formalisms provide only restricted sets decomposing and composing mechanisms, and these typically support only a single, “dominant” dimension of separation at a time.
We would like the system to encapsulate all relevant kinds (dimensions) of concerns simultaneously. MDSOC.
10
Features are Scattered and Features are Scattered and TangledTangled Scattering – a single requirement affects multiple design and
code modules. Tangling – material pertaining to multiple requirements is
interleaved within a single module. In general:
Features are coherent entities from a conceptual and requirement point of view, BUT
Features are not modules in design or code So, I is difficult to:
Find and work with the code for a feature Add a new feature Remove a feature Mix-and-match features
In a Non-InvasiveNon-Invasive way!
11
Hyper/J conceptsHyper/J concepts
HyperslicesHyperslices
HypermodulesHypermodules
HyperspacesHyperspaces
12
SSetting the context and introducing etting the context and introducing terminology for Separation of Concernsterminology for Separation of Concerns
It is convenient to think of the descriptive material in each artifact as being made up of unitsunits. PrimitivePrimitive unitsunits – e.g. methods of a class, declarations.
A unit might also be a state chart or requirement specification– depending upon the artifact.
CompoundCompound unitsunits or modulesmodules – e.g. classes, interfaces. A single concept is typically modeled by a
collection of many units (primitive or compound).
A single unit often participates in modeling more than one concept.
13
Multi-Dimensional Multi-Dimensional Decomposition: Decomposition: HyperslicesHyperslices
A hyperslicehyperslice is a set of units. Hyperslices are intended to encapsulate
concerns in dimensions other than the dominant one.
The modules within it contain all, and only, those units that pertain to a given concern.
Hyperslices can overlap – a given unit may occur in multiple hyperslices.
14
Hyperslices in the Hyperslices in the personnel softwarepersonnel software::
position()pay()
EmployeeEmployee
position()pay()
SalesSalesposition()pay()
ResearchResearchposition()pay()
StuffStuff
position()pay()
ResearchMgrResearchMgrosition()pay()
SecretarySecretaryposition()pay()
MaintenanceMaintenanceposition()pay()
SalesMgrSalesMgr
PayrollPayrollhyperslicehyperslice
name()check()print()
EmployeeEmployee
name()check()print()
SalesSalesname()check()print()
ResearchResearchname()check()print()
StuffStuff
name()check()print()
ResearchMgrResearchMgrname()check()print()
SecretarySecretaryname()check()print()
MaintenanceMaintenancename()check()print()
SalesMgrSalesMgr
PersonnelPersonnel hyperslicehyperslice
15
Multi-Dimensional Multi-Dimensional Decomposition: Decomposition: HypermodulesHypermodules
Each hypermodulehypermodule is composed of: A set of hyperslices hyperslices A composition rulecomposition rule that specifies how
the hyperslices are to be integrated.
16
Multi-Dimensional Multi-Dimensional Decomposition: Decomposition: HyperspacesHyperspaces A hyperspacehyperspace is a concerns space whose
structure supports our approach to multi-dimensional separation of concerns.
Concerns are grouped into dimensions, giving hyperspaces an explicitly multi-dimensional structure.
A dimension of concern is a set of concerns that are disjoint (i.e., they have no units in common).
17
Personnel Software - Personnel Software - HyperspacesHyperspaces
CodeCode
Class
Feature
Employee Research Sales SecretaryEmployee Research Sales Secretary
Artifact
PayrollPayroll
PersonnelPersonnel
RequirementsRequirements
DesignDesign
The Hyperspace is a multi dimensional The Hyperspace is a multi dimensional space.space.
Axes are dimensions of concernAxes are dimensions of concern Points on axes are concernsPoints on axes are concerns Software units fall at points in the spaceSoftware units fall at points in the space
Encapsulation and composition via Encapsulation and composition via HyperslicesHyperslices and and HypermodulesHypermodules
18
Hyperspaces (cont.)Hyperspaces (cont.) A hyperspace can contain many
hypermodules realizing different modularizations of the same units.
Systems can be composed in many
ways from hypermodules.
Hypermodules are not, in general, complete, executable programs.
19
Hyperspaces - AdvantagesHyperspaces - Advantages The explicit identification of concerns and
dimensions, and the alignment of units according to concerns, are significant aids to comprehensibilitycomprehensibility.
Hyperspaces are intended to include artifacts from all phases of the software lifecycle (e.g., requirements, design, code), and the alignment of units promotes traceabilitytraceability.
Changes that add functionalityChanges that add functionality can always be accomplished by adding new units, and either including them within existing hypermodules or adding new hypermodules.
The structure of hypermodules and their composition rules significantly limits the impact of limits the impact of all changesall changes.
20
Using Hyper/JUsing Hyper/J – – for personnel softwarefor personnel software
21
Class
Feature
Employee Research Sales SecretaryEmployee Research Sales Secretary
PersonnelPersonnel
name()
check()
print()
position()
pay()
Employee
Research
Sales Secretary
Basic Personnel hyperspaceBasic Personnel hyperspace
name()
check()
print()
position()
pay()
name()
check()
print()
position()
pay()
name()
check()
print()
position()
pay()
hyperspace payrollPlusPersonnel composable class Personnel;*.
22
Different organization – Different organization – Different requirementsDifferent requirements
No need for payroll information
Different business rules Each employee
must have exactly one manager.
Mix-and-match the payroll feature.
Modify an existing well-formed constraint
23
On-demand On-demand remodularizationremodularization
Hyper/J permits developers to identify and noninvasively encapsulate new concerns at any time Including concerns that are scatterd
across, and tangled within existing software.
24
On-demand On-demand remodularizationremodularization The developer needs to identify those pieces of the
existing software that are part of the new concern(s)
And express this information in Hyper/J using a concern mappingconcern mapping:
packagepackage Personnel: Feature.Personnel Personnel: Feature.Personneloperationoperation position: Feature.Payroll position: Feature.Payroll operationoperation pay: Feature.Payroll pay: Feature.Payroll
By default, all members of the classes and interfaces in the Java package Personnel belong to the personnel concern in the feature
dimensionThe subsequent statements
override this to say:Any method named position position or
paypay belongs to the payroll concern in the feature
dimension )irrespective of its class(
25
Hyper/J creates a hyperslice for each featureHyper/J creates a hyperslice for each feature ))each roweach row((
name()
check()
print()
name()
Position()
pay()
Identification of ConcernsIdentification of Concerns
name()
Position()
pay()
name()
Position()
pay()
name()
Position()
pay()
Class
Feature
Employee Research Sales SecretaryEmployee Research Sales Secretary
PayrollPayroll
PersonnelPersonnelname()
check()
print()
name()
check()
print()
name()
check()
print()
Employee
Research
Sales Secretary
Employee
Research
Sales Secretary
public float pay() {System.out.println ( “Paying” + name() );return _salary; }
26
Declarative CompletenessDeclarative Completeness
name()
Position()
pay()
name()
Position()
pay()
name()
Position()
pay()
Class
Feature
Employee Research Sales SecretaryEmployee Research Sales Secretary
PayrollPayroll
PersonnelPersonnelname()
check()
print()
name()
check()
print()
name()
check()
print()
name()
check()
print()
Employee
Research
Sales Secretary
name()
Position()
pay()
Employee
Research
Sales Secretary
Hyper/J inserts abstract declarations for any membersHyper/J inserts abstract declarations for any members referred to, but not implemented within the hyperslicereferred to, but not implemented within the hyperslice
27
Composing hyperslicesComposing hyperslices
The developer needs to write a hypermodule declaration:
hypermodule PayrollPlusPersonnelhypermodule PayrollPlusPersonnel hyperslicehyperslice: : Payroll, Personnel;
relationshiprelationship: mergeByName;end hypermoduleend hypermodule
Name the hypermodule
List of hyperslices to be composed
The relationship section lists all the ways in which the
hyperslices are related
28
Class
Feature
Employee Research Sales SecretaryEmployee Research Sales Secretary
PayrollPayroll
PlusPlus
PersonnelPersonnel
name()
check()
print()
position()
pay()
Employee
Research
Sales Secretaryname()
check()
print()
position()
pay()
name()
check()
print()
position()
pay()
name()
check()
print()
position()
pay()
Composing hyperslices Composing hyperslices (cont.)(cont.)
What happened with the method name()?PayrollPlusPersonnel.Emplo
yee
29
Composing – general Composing – general strategiesstrategies mergeByName
Units in different hyperslices, that have the same name correspond and should be merged.
nonCorrespondingMerge Units in different hyperslices accidently
have the same name, but are not actually related to one another.
This strategy does not work correctly and is disabled! overrideByName
The last unit (according to the specification order) should override the others.
30
What about the changes What about the changes to the business rulesto the business rules??
method Personnel.Employee.check : BusinessRule.ThreeManagers
Creates a new dimensiondimension: BusinessRule And creates the ThreeManagersThreeManagers concernconcern
on that dimension.
method SingleManagerPkg.Employee.check: BusinessRule.OneManager
Creates the OneManagers concernOneManagers concern on that dimension.
31
Changes for Business Changes for Business RulesRules
Feature
NoneNone
Class
PayrollPayroll
PersonnelPersonnel
Business Rule
ThreeThreeManagersManagers
OneOneManagerManager
Position()
pay()
Employee
name()
check()
print()
Employee
check()
Employee
check()
Employee
Compose for new one-manager check
Compose for original3 managers check
32
HyperJ - summaryHyperJ - summary With HyperJ, a program can be decomposed according to
different concerns. New separate modules can be created, in standard Java,
that encapsulate concerns from scratch, without modifying the rest of the program or interfering with the work of other developers.
Modules can also be extracted from existing Java programs.
Selections of these modules can then be integrated to yield programs that are executable on standard JVMs.
Multiple system decompositions can be created simultaneously and new decompositions added at any stage of the software development lifecycle.
HyperJ helps in managing the interactions across different decompositions. HyperJ also provides a powerful composition capability, which can be used to combine separated concerns selectively into an integrated program or component.
33
Hyper/J vs. Aspect/JHyper/J vs. Aspect/J Hyper/J is a tooltool Aspect/J is a languagelanguage
Hyper/J supports integration of multiple models Aspect/J supports augmentation of single model
Hyper/J – composing and decomposing can be done at any time.
Aspect/J – incremental changes only