1 / 25

Component based software

Component based software. Building concurrent systems from reusable parts David Knight Apr05. Component construction. A Component: Encapsulates some interesting behaviour Has inputs and/or outputs An input or output can be:

banyan
Télécharger la présentation

Component based software

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Component based software Building concurrent systems from reusable parts David Knight Apr05

  2. Component construction • A Component: • Encapsulates some interesting behaviour • Has inputs and/or outputs • An input or output can be: • A Signal: A value of any type that can be changed at any time without warning • An Event: A notification that something has happened, accompnaied by optional parameters of any type

  3. A component, in pictures InstanceName ClassName inSignal outSignal inEvent outEvent

  4. Interfaces • An interface is a group of logically-related signals and/or events that are treated as a unit • An interface can contain a mixture of in and out signals or events • A component can implement an interface, in which case it must provide inputs and outputs as described by the interface • A component can implement an interface in reverse, in which case the in/out direction of all signals/events is reversed • A component can implement multiple interfaces, including the same interface multiple times • An interface can also contain other interfaces, in normal or reversed direction, to arbitrary depth

  5. Interfaces in pictures ComponentName IfcName IfcName Normal direction interface Reverse direction interface

  6. Connection rules • An output of a component can be connected to the input of one or more other components (including itself) • Interconnection is only permitted between signals and events of the same type • An interconnected network of components can itself be viewed as a component. This can be carried to any depth.

  7. Connection in pictures U1 U2 C1 C2 Error ClkIn Carry A Clk Enable B ClkOut Run U3 C1 Carry ClkIn Enable ClkOut

  8. Component interfaces • The external view of a component is specified by an interface. • Several different components can implement the same interface, and thus would be plug-compatible.

  9. Component interface in pictures Dte modem inStream ByteStream error clock enable ready speed

  10. Interface as text interface Example; ByteStream inStream; in event clock(); in boolean enable; reverse Dte modem; out event error(int reason); out boolean ready; out int speed; endinterface;

  11. Component as text... componentcNameimplementsiName; interface in int ival; in event clock(); out boolean ready; static Doofer d= new Doofer(...); Scronge s= new Scronge(...); Gadget g= new Gadget(...); connect clock d.tick g.clk s.clock; connect s.ready g.enable; connect s.out ready; connect ival d.speed; dynamic (see next slide)

  12. ...component as text dynamic machinemName; initial initialisationActions; next s1; state s1; entryActions; whenevent1(int b) doThis; next s2; whenevent2(); doThat; next s1; endwhen; state s2; etc... endmachine; endcomponent;

  13. Example 1 Simple producer/consumer See the pages: ByteStream.ifc Producer.ifc Consumer.ifc Example.ifc Producer.cmp Consumer.cmp Pc.cmp

  14. ByteStream Example data data clock Producer Consumer ByteStream Clock stream stream ByteStream Example 1 - interfaces speed

  15. SimpleProducer SimpleConsumer ByteStream Clock stream stream ByteStream Pc.cmp Clock

  16. Example 2Bounded queue See files Queue.ifc Queue.cmp Pqc.cmp Pqqc.cmp

  17. Queue inStream ByteStream ByteStream outStream Queue interface

  18. SimpleProducer SimpleConsumer ByteStream Clock stream stream ByteStream Queue ByteStream ByteStream inStream outStream Pqc.cmp Clock

  19. SimpleProducer SimpleConsumer ByteStream Clock stream stream ByteStream Queue Queue ByteStream ByteStream ByteStream ByteStream inStream inStream outStream outStream Pqqc.cmp Clock

  20. Example 3Async data transmission See files AsyncTransmitter.ifc AsyncReceiver.ifc AsyncTransmitter.cmp AsyncReceiver.cmp Ptrc.cmp Pqtrqc.cmp

  21. AsyncTransmitter txd stream ByteStream clock AsyncReceiver ByteStream rxd stream Clock Example 3 interfaces

  22. AsyncTransmitter txd stream ByteStream SimpleProducer SimpleConsumer clock ByteStream Clock stream stream ByteStream AsyncReceiver ByteStream rxd stream Clock Ptrc.cmp Clock

  23. AsyncTransmitter txd stream ByteStream SimpleProducer SimpleConsumer clock ByteStream Clock stream stream ByteStream AsyncReceiver ByteStream rxd stream Clock Pqtrqc.cmp (Queue in here) Clock (Queue in here)

  24. StatMux/StatDemux • A StatMux interleaves two data independent streams onto a single channel, to make better use of the channel data capacity • A StatDemux reverses the process, and separates the two streams again

  25. port0 port0 ByteStream ByteStream line line ByteStream StatMux StatDemux ByteStream port1 ByteStream port1 ByteStream StatMux/StatDemux

More Related