(4 slides per page) - Updated
(4 slides per page) - Updated
(4 slides per page) - Updated
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Overview<br />
Phase 10<br />
Introduction<br />
Notations<br />
Java<br />
Implementation<br />
of modules<br />
Module Tests<br />
Procedure<br />
Example - TLC<br />
Example - SBC<br />
Phase 11<br />
Phase 12<br />
Summary<br />
Overview<br />
Phase 10<br />
Introduction<br />
Notations<br />
Java<br />
Implementation<br />
of modules<br />
Module Tests<br />
Procedure<br />
Example - TLC<br />
Example - SBC<br />
Phase 11<br />
Phase 12<br />
Summary<br />
Solution: Synchronize<br />
public class SharedMemSum {<br />
private int[] x;<br />
public SharedMemSum () {<br />
x = new int [3] ;<br />
x[0]=0; x[1]=0; x[2]=0;<br />
}<br />
synchronized int getSum() {<br />
int a,b,c;<br />
a=x[0]; b=x[1]; c=x[2];<br />
return a+b+c;<br />
}<br />
synchronized void setVal(int a, int b, int c) {<br />
x[0] = a; x[1] = b; x[1] = c;<br />
}<br />
}<br />
The statement synchronized makes a method<br />
non-interruptable.<br />
Implementation of modules / software components<br />
II<br />
Interfaces can be implemented using<br />
directly called methods,<br />
methods in interface classes, or<br />
messages, e.g.<br />
delegates in C♯,<br />
events in Java,<br />
signals and slots in C++ with the Qt-library,<br />
messages in the Windows API.<br />
Messages usually allow asynchronous communication (with<br />
queuing) and in some frameworks multiple consumers are<br />
allowed.<br />
21 / 89<br />
23 / 89<br />
Overview<br />
Phase 10<br />
Introduction<br />
Notations<br />
Java<br />
Implementation<br />
of modules<br />
Module Tests<br />
Procedure<br />
Example - TLC<br />
Example - SBC<br />
Phase 11<br />
Phase 12<br />
Summary<br />
Overview<br />
Phase 10<br />
Introduction<br />
Notations<br />
Java<br />
Implementation<br />
of modules<br />
Module Tests<br />
Procedure<br />
Example - TLC<br />
Example - SBC<br />
Phase 11<br />
Phase 12<br />
Summary<br />
Implementation of modules / software components<br />
I<br />
Amodulehasprovidedandrequiredinterfacesthatcanbe<br />
connected with other modules<br />
A module only uses functionality from the provided<br />
interfaces, from the programming language, and a limited<br />
set of o<strong>per</strong>ations of the o<strong>per</strong>ating system (e.g., tasks,<br />
threads, memory allocation, timers, messages,<br />
synchronization mechanisms).<br />
Active components are implemented using threads.<br />
Implementation of interfaces I<br />
Loose and tight coupling is possible for interfaces between<br />
components.<br />
Tight (directly called methods) coupling is used if<br />
methods of a class and not of an object are called.<br />
Tight coupling of objects can only be implemented if the<br />
called object is created by the calling class.<br />
For loose coupling (methods in interface classes) the<br />
objects are created by a different class. The object that<br />
uses an interface of another object needs a reference to<br />
the used object. The reference can be provided in the<br />
constructororinanadditionalmethodtoconnectthe<br />
objects.<br />
22 / 89<br />
24 / 89