E N D
1. Prism-MW Tutorial
2. From Architecture to Design SWE 622 Distributed Software Engineering © Malek, 2007 2
3. From Architecture to Implementation SWE 622 Distributed Software Engineering © Malek, 2007 3
4. Mapping Architecture to Implementation Infeasible in general
Reduces to transformational programming
Possible by limiting target space
Middleware platforms
Software bus technologies SWE 622 Distributed Software Engineering © Malek, 2007 4
5. Relating Architecture and Implementation Architectures provide high-level concepts
Components, connectors, ports, events, configurations
Programming languages provide low-level constructs
Variables, arrays, pointers, procedures, objects
Bridging the two often is an art-form
Middleware can help split the difference
Existing middleware technologies
Support some architectural concepts (e.g., components, events)
but not others (e.g., configurations)
Impose particular architectural styles
End result ? architectural erosion
Architecture does not match the implementation SWE 622 Distributed Software Engineering © Malek, 2007 5
6. The Mapping Problem Components ? ?
classes, packages, modules,
Connectors ? ?
software buses, middleware; what else?
Interfaces ? ?
API signatures; what about protocols?
Configurations ? ?
interfaces, function pointers, reflection
Design rationale ? ?
comments, documentation
Behavior ? ?
how do we translate FSP, StateCharts, Z, etc. to code?
NFPs ? ?
indirectly via rationale, inspections, testing, user studies,
SWE 622 Distributed Software Engineering © Malek, 2007 6
7. Architectural Middleware Natively support architectural concepts as middleware constructs
Include system design support
Typically via an accompanying ADL and analysis tools
Support round-trip development
From architecture to implementation and back
Support automated transformation of architectural models to implementations
i.e., dependable implementation
Examples
ArchJava
Aura
c2.framework
Prism-MW SWE 622 Distributed Software Engineering © Malek, 2007 7
8. What Matters in an Architectural Framework Matching assumptions
Fidelity
Platform support
Efficiency
anything else? SWE 622 Distributed Software Engineering © Malek, 2007 8
9. Prism-MW Architectural middleware for distributed, resource constrained, mobile, and embedded systems
Supports architecture-based software development
Architecture-based software development is the implementation of a software system in terms of its architectural elements
Efficient
Scalable
Flexible and Extensible
Allows us to cope with heterogeneity
Supports arbitrarily complex architectures
Supports multiple architectural styles SWE 622 Distributed Software Engineering © Malek, 2007 9
10. Prism-MW SWE 622 Distributed Software Engineering © Malek, 2007 10
11. SWE 622 Distributed Software Engineering © Malek, 2007 11
12. Using Prism-MW SWE 622 Distributed Software Engineering © Malek, 2007 12
13. Using Prism-MW SWE 622 Distributed Software Engineering © Malek, 2007 13
14. Event Dispatching SWE 622 Distributed Software Engineering © Malek, 2007 14 Role of connectors in mobilityRole of connectors in mobility
15. SWE 622 Distributed Software Engineering © Malek, 2007 15
16. Prism-MW Benchmarks on a PC SWE 622 Distributed Software Engineering © Malek, 2007 16
17. Prism-MW has been adopted by several industry partners SWE 622 Distributed Software Engineering © Malek, 2007 17
18. Recent Progress SWE 622 Distributed Software Engineering © Malek, 2007 18
19. Obtaining Prism-MW Download Prism-MW 2.1 source code from http://csse.usc.edu/~softarch/Prism/
Compile and develop your code on top of it
Alternatively, you could download Prism-MW Jar file and set the appropriate class paths
The easiest way to compile the source code is to use Eclipse
You can download the eclipse from: http://www.eclipse.org/
Create a Java project and import the source code
Eclipse will automatically compile the code for you SWE 622 Distributed Software Engineering © Malek, 2007 19
20. Package Structure Prism
Benchmark
Core
Exception
Extensions
Architecture
Component
Connector
Evt
Port
Style
Test
Core
Extensible_port
real_time
Style SWE 622 Distributed Software Engineering © Malek, 2007 20
21. Simple Calculator SWE 622 Distributed Software Engineering © Malek, 2007 21
22. Simple Calculator Single Address Space 1/2
package Prism.test.core;
import Prism.core.*;
import Prism.test.*;
class testArchLocally
{
static public void main(String argv[])
{
FIFOScheduler sched = new FIFOScheduler(100);
Scaffold s = new Scaffold();
RRobinDispatcher disp = new RRobinDispatcher(sched, 10);
s.dispatcher=disp;
s.scheduler=sched;
Architecture arch = new Architecture("Demo");
arch.scaffold=s;
AbstractImplementation addition = new Addition();
Component t = new Component("add", addition);
t.scaffold=s;
AbstractImplementation subtract = new Subtract();
Component sub = new Component("Sub", subtract);
sub.scaffold=s;
GUI gui = new GUI();
Component b = new Component("GUI", gui);
b.scaffold=s;
Connector conn1 = new Connector("conn1");
conn1.scaffold =s;
arch.add(b);
arch.add(conn1);
arch.add(t);
arch.add(sub);
SWE 622 Distributed Software Engineering © Malek, 2007 22
23. Simple Calculator Single Address Space 2/2 Port subReplyPort = new Port("subReplyPort", PrismConstants.REPLY);
sub.addCompPort (subReplyPort);
Port conn1RequestPort1 = new Port("conn1RequestPort1", PrismConstants.REQUEST);
conn1.addConnPort(conn1RequestPort1);
arch.weld(subReplyPort, conn1RequestPort1);
Port tReplyPort = new Port("tReplyPort", PrismConstants.REPLY);
t.addCompPort(tReplyPort);
Port conn1RequestPort2 = new Port("conn1RequestPort2", PrismConstants.REQUEST);
conn1.addConnPort(conn1RequestPort2);
arch.weld(tReplyPort, conn1RequestPort2);
Port bRequestPort = new Port ("bRequestPort", PrismConstants.REQUEST);
b.addCompPort(bRequestPort);
Port conn1ReplyPort1 = new Port("conn1ReplyPort1", PrismConstants.REPLY);
conn1.addConnPort(conn1ReplyPort1);
arch.weld(bRequestPort, conn1ReplyPort1);
disp.start();
arch.start();
}
}
SWE 622 Distributed Software Engineering © Malek, 2007 23
24. Simple Calculator Distributed SWE 622 Distributed Software Engineering © Malek, 2007 24
25. Client Side GUI Component String hostName = "localhost";
int portNum = 2601;
FIFOScheduler sched = new FIFOScheduler(100);
Scaffold s = new Scaffold();
RRobinDispatcher disp = new RRobinDispatcher(sched, 10);
s.dispatcher=disp;
s.scheduler=sched;
Architecture arch = new Architecture("Demo1");
arch.scaffold=s;
Connector conn=new Connector("conn");
conn.scaffold=s;
ExtensiblePort ep = new ExtensiblePort ("ep", PrismConstants.REQUEST);
SocketDistribution sd=new SocketDistribution(ep);
ep.addDistributionModule(sd);
ep.scaffold = s;
conn.addConnPort(ep);
GUI gui = new GUI();
Component b = new Component("GUI", gui);
b.scaffold=s;
arch.add(conn);
arch.add(b);
arch.add(ep);
Port bRequestPort = new Port("bRequestPort", PrismConstants.REQUEST);
b.addCompPort(bRequestPort);
Port connReplyPort = new Port("connReplyPort", PrismConstants.REPLY);
conn.addConnPort(connReplyPort);
arch.weld(bRequestPort, connReplyPort);
disp.start();
arch.start();
ep.connect(hostName, portNum); SWE 622 Distributed Software Engineering © Malek, 2007 25
26. Server Side Addition Component int portNum = 2601;
FIFOScheduler sched = new FIFOScheduler(100);
Scaffold s = new Scaffold();
RRobinDispatcher disp = new RRobinDispatcher(sched, 10);
s.dispatcher=disp;
s.scheduler=sched;
Architecture arch = new Architecture("Demo");
arch.scaffold=s;
Connector conn=new Connector("conn");
conn.scaffold=s;
ExtensiblePort ep = new ExtensiblePort("ep", PrismConstants.REPLY);
SocketDistribution sd=new SocketDistribution(ep, portNum);
ep.addDistributionModule(sd);
ep.scaffold = s;
conn.addConnPort(ep);
Addition addition = new Addition();
Component t = new Component("Add", addition);
t.scaffold=s;
arch.add(conn);
arch.add(t);
arch.add(ep);
Port tReplyPort = new Port ("tReplyPort", PrismConstants.REPLY);
t.addCompPort(tReplyPort);
Port connRequestPort = new Port("connRequestPort", PrismConstants.REQUEST);
conn.addConnPort(connRequestPort);
arch.weld(tReplyPort, connRequestPort);
disp.start();
arch.start(); SWE 622 Distributed Software Engineering © Malek, 2007 26