Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
Component-Based Software Engineering
ReviewPaul Krause
Thursday, 26 March 2009
Why Software Engineering? The difference between writing a program
and engineering a software systemis like the difference between building a
patio table and building a bridge You can patch up one until it works You need careful analysis and design to
succeed with the other Good Software Engineering practice is
essential for Software Components
Thursday, 26 March 2009
Software Components mean? The main driver behind software
components is reuse. That means we must modularise
applications if they are to have potentially reusable parts.
The expectation is that if the parts (often collections of classes) can be reused then costs will be reduced (in the long run…).
Thursday, 26 March 2009
Drivers for CBD The development of the WWW and
Internet Systems of loosely coordinated services
Object-oriented design techniques and languages
Move from Mainframe to client-server based computing
Rapid pace of technological change Economic necessity of maximising reuse
Thursday, 26 March 2009
Definition 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.
1996 European Conference on Object-Oriented Programming
Thursday, 26 March 2009
Connector Design
:Button
:Button
:Motor :Meter
pressed
pressed
start
stop
speed
value
Thursday, 26 March 2009
Connector Design
:Button
:Button
:Motor
:Meter
pressed
pressed
start
stopspeed
value:OR
:Threshold
a
b
a ∨ b
a > b
a < b
:Multiplier
:Selector{1, 10, 100}
a b
a x b
5:int
a
b
Thursday, 26 March 2009
Interfaces Interfaces allow the clients of a component
to access the services provided by a component
Different interfaces will normally provide access to different services
Each interface specification could be viewed as a contract between the component and a client
Thursday, 26 March 2009
Component Specification Provides Interfaces
The services a component can offer to a client Requires Interfaces
The services required by a component to help it deliver its promises
Context of Use The “world” the component lives in
Thursday, 26 March 2009
Interfaces Interfaces allow the clients of a component
to access the services provided by a component
Different interfaces will normally provide access to different services
Each interface specification could be viewed as a contract between the component and a client
Thursday, 26 March 2009
What is a Java Bean? “A Java Bean is a reusable software
component that can be manipulated visually in a builder tool”
JavaSoft
Thursday, 26 March 2009
Downside of Beans
As components, they are not “wired” together, but tightly coupled:
public class KnightOfTheRoundTable {private String name;private HolyGrailQuest quest;
public KnightOfTheRoundTable(String name) {this.name = name;quest = new HolyGrailQuest();
}......
}
12
Thursday, 26 March 2009
A simple Changepublic class KnightOfTheRoundTable {
private String name;private Quest quest
public KnightOfTheRoundTable(String name) {this.name = name;quest = new HolyGrailQuest();
}...public void setQuest(Quest quest) {
this.quest = quest}
}
13
Thursday, 26 March 2009
Use of Interfaces
public interface Quest {abstract Object embark();
}
public class HolyGrailQuest implements Quest {public Object embark() {
// do Knightly stuff herereturn new HolyGrail();
}}
14
Thursday, 26 March 2009
Giving a Knight a Quest
<beans ... // some setup stuff><bean id=”quest” class=”knight.HolyGrailQuest” /><bean id=”knight”
class=”knight.KnightOfTheRoundTable”><constructor-arg value=”Bedivere” /><property name=”quest” ref=”quest” />
</bean></beans>
15
Thursday, 26 March 2009
Big fleas have little fleas upon their backs to bite them,
and little fleas have lesser fleas, and so on ad infinitum
16
Thursday, 26 March 2009
REST- Interfacing across the Web “The Web used properly” Roy Fielding’s PhD dissertation
identified the architectural principles that had emerged in the design of http http://www.ics.uci.edu/~fielding/pubs/
dissertation/top.htm
17
Thursday, 26 March 2009
1. Give Every “Thing” an ID
http://example.com/customers/1234
http://example.com/orders/2007/10/776654
http://example.com/products/4554
http://example.com/processes/sal-increase-0
18
Thursday, 26 March 2009
2. Link Things to Each Other
<order self=‘http://example.com/orders/1234> <amount>23</amount>
<product ref= ‘http://example.com/products/4554><product ref= ‘http://example.com/customers/888>
</order>
19
Thursday, 26 March 2009
3. Use Standard Methods
GET retrieve information, possibly cached
PUT Update or create with known ID
POST Create, or append sub-resource
DELETE (Logically) remove
20
Thursday, 26 March 2009
4. Allow for Multiple “Representations”
HTML XML SVG ATOM JSON ...
21
Thursday, 26 March 2009
5. Communicate Statelessly
GET /customers/1234Host: example.comAccept: application/vnd.mycompany.customer + xml....shutdown, change server, update software, buy new car, save planet, startup
GET /customers/orders/46Host: example.comAccept: application/vnd.mycompany.order + xml
22
Thursday, 26 March 2009
Consequences
23
Thursday, 26 March 2009
24
Thursday, 26 March 2009