Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Szyperski:
A software component is a unit of composition with contractually
specified interfaces and explicit context dependencies only.
A software component can be deployed independently and is
subject to composition by third parties.
• Degree of independence
• Deployment
• Size
• Standardization
• Technology-specific properties
• Units of architecture
• Units of functionality – who is responsible of functionalites?
• Units of reuse – what remains common?
• Units of product configuration – what is included in a product?
• Units of deployment – what can be upgraded in isolation?
• Units of variance – what can be changed, how?
• Units of third-party software – what can be obtained from outside?
• Units of work division – what can be separated as tasks?
C A A’
Subroutine library
B B’
Abstract service module
signature C C’
Service Module library class
implementation
Class library
Ohjelmistoarkkitehtuurit Syksy 2006 TTY Ohjelmistotekniikka 9
Interfaces as first-class entities
Interface1
ComponentA
Interface2
Interface3
ComponentB
Interface4
PowerSource
Car
required interface
PowerSource
Engine
provided interface
PowerSource
Car Engine
Warnings
Warnings
design-by-contract
(Eiffel) Service
Client
provider
Person
age: int
toberetired: int
op1(...)
op2(...)
op3(...)
invariant
age > 0 &
age < toberetired
public oper(...)
pre pre post
post
pre' post' B
pre' post
public oper(...)
pre post' C
pre'
post'
pre post'
pre' post D
Which is correct (A,B,C,D)?
client: ... if s.size() > 0 then {s.pop();} else {... error handling ...} ...
Problems?
• Subclassing
Client :Comp
ServicesI create
setProperty(...)
setProperty(...)
Comp
use
ActionListener
Button AppLogic
Button
CompanyButton
Library Comp
component
"Innocent" modification of
the original component
can make the customized
component invalid
Customized
component Custom
<<interface>>
Container
addContainer:
addElement(Object) List { ...addElement(...); ... }
addContainer(Container)
<<interface>>
CountedContainer
addElement:
getCount() CountedList { super.addElement(...);
counter++; }
<<interface>>
Container
addContainer:
addElement(Object) List { ...}
addContainer(Container)
<<interface>>
CountedContainer
addElement:
getCount() CountedList { super.addElement(...);
counter++; }