flow- based programming j.paul morrison j.p. morrison enterprises ltd

28
FLOW-BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd.

Upload: destiny-donovan

Post on 26-Mar-2015

244 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

FLOW-BASED PROGRAMMING

J.Paul Morrison

J.P. Morrison Enterprises Ltd.

Page 2: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd
Page 3: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 3

Missed deadlines; budget overruns

"Hidden" application backlog

Fads and "snake-oil salesmen"

Endless number of “new”, incompatible, tools and languages to be learned

"Reinventing the wheel"

Hard-to-maintain systems

Symptoms of the Problem

Page 4: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 4

Inappropriate for application design:- Code is procedural, sequential- One-step-at-a-time view of processing- Hierarchic structure of code- Subroutine call as building block- Programmer has to control exact sequence

of events

Procedural approach is rare in real life... and always difficult

Real life is asynchronous, cooperative

The Real Cause of the Problem: The von Neumann Model

Page 5: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 5

Maintainable Systems

Express problem in terms of transforms on streams of data

Most design technologies describe applications this way – then design has to be converted to procedural code

“Unit Record” had these characteristics

Precoded, pretested black-box (“LEGO”) components have long been IT goal

Page 6: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 6

FBP Characteristics

Asynchronous processes communicating via streams of data packets

Data packets with a lifetime of their own

Definition of connections external to components

Consistent view from macro to micro, and from design to maintenance

Page 7: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 7

Soft Drink Bottling Factory

Independent well-defined functions Clean interfaces Simple to reconfigure Minimizes side-effects Designer can sit at one “station”, or can follow an item through system

Page 8: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 8

Elements of FBP

Processes (A, B, C) Connections (M, N) - “bounded buffers” Ports (O1, O2, IN of B, IN of C) Connections defined externally to processes Streams of data chunks (Information Packets)

Page 9: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 9

Traditional “Update” Application

Page 10: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 10

FBP “Update” Application

( m1 d11 d12 ) ( m2 ) ( m3 d31)

could be subnet

complementary components

Page 11: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 11

“Coordination Language” (*)

Flow-Based Programming is a “coordination language”, not a programming language

FBP is language-independent One language doesn't have to do everything

(*) Term borrowed from “Linda” (Gelernter & Carriero - Yale)

FBP is visual and component-oriented

“Utilities” can be turned into components

Page 12: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 12

“Configurable Modularity”

(Nate Edwards, IBM)

“Characteristic of any engineered system”

Page 13: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 13

“Black boxes” Parametrization using “IIPs” Ports Parameters may be mini-language Compatible with:

Finite State Machines (PDAs) Structured Analysis Step-wise decomposition

Component-Oriented

Page 14: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 14

Scheduling Rules

Process only terminates when no more data, although it may suspend or go dormant

Process can suspend on receive or send (connections are “bounded buffers”)

This allows large amounts of data to be processed using finite resources

Typically only one process suspended waiting for an event – not whole program

Page 15: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 15

Design for an E-Brokerage Application

Page 16: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 16

Load Balancing

Sn is instance of “S” LB assigns on basis of least backlog “O[n]” is element of array port

Page 17: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

17

Page 18: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 18

TestingTesting

Look at data passing across connection

Test one process at a time“Scaffolding”Rapid Prototyping

Go from simulation to working code

Cleave network as desired – multiple job steps, regions, machines, etc.

Page 19: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 19

Simulating SubroutinesSimulating Subroutines

Subroutine can be simulated using Send/Receive

MCBSIM can also be used in “flow-through” mode

“There is no reason we know of, however, to base an entire parallel language on this one easily programmed but not crucially important special case." Gelernter

Page 20: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 20

FBP processes are “active objects” (*)

Information packets (IPs): - have a definite lifetime - have only one owner at a time (or are on a connection) - “passive” objects

5 types of “encapsulation”

(*) Ellis & Gibbs (1989)

“Active” vs. “Passive” Objects

Page 21: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 21

AMPS z90 Assembler (IBM Canada – ca. 1970) (in continuous, daily use since then)

DFDM Assembler / PL/I (IBM Canada, Japan)

THREADS written in C (JPM) - just ported to C++ fibers JavaFBP Java (J. Cowan, JPM, now at 5.0) C#FBP C# (Amanda Ge, JPM)

“language-agnostic” - interface is data

FBP Implementations

Page 22: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

22

Project T yp e U n iq u e Occu rr -

en ces

R eu se Factor

Figu re of M erit

A P roject 133 184 1.4 0.27

Gen P urpose

21 305 14.5

Total 154 489 3.2

GP /T 0.14 0.62

B P roject 46 48 1.0 0.13

Gen P urpose

17 306 18.0

Total 63 354 5.6

GP /T 0.27 0.86

C P roject 2 54 27.0 0.01

Gen P urpose

8 216 27.0

Total 10 270 27.0

GP /T 0.80 0.80

Figure of Merit = Project Unique / Total Occurrences

3 Projects

Page 23: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 23

Inter-language communication

Sockets

can be used between languages on same machine, or

to communicate between different

machines

MQSeries, ActiveMQ, TIBEMS, etc.

Page 24: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 24

DrawFBP Diagramming Tool

Written using Java Swing

Page 25: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 25

<net> <title>Update</title><blocks><block> <x> 560 </x> <y> 152 </y> <id> 6 </id><description>

Print Report</description></block> </blocks> <connections><connection> <fromx>108</fromx> <fromy>60</fromy> <tox>168</tox> <toy>84</toy> <fromid>1</fromid> <toid>3</toid> <bends> <bend> <x>132</x> <y> 60</y> </bend><bend> <x>132</x> <y> 84</y> </bend></bends></connection> </connections></net>

Data format for DrawFBP

Page 26: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 26

MASCOT (RSRE, UK) Linda - Gelernter & Carriero (Yale) A'UM - Yoshida & Chikayama (Japan) BSP - Valiant NIL/Hermes - Rob Strom (IBM) “Media Objects” / KNOs - Nierstrasz etc. “Active Objects” - Ellis & Gibbs IBM’s MQSeries Message-driven EJBs Trelliswerk, ProtoSW Pervasive, Ascential (now IBM) Visual Frameworks etc., etc., etc.

Related Concepts

Page 27: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 27

FBP Summary

Flow-Based Programming: effective way to produce reliable, maintainable, large business applications

Consistent view across all levels

Better way to program multiprocessor computers, distributed systems

Increasing interest world-wide

It’s taken 30+ years, but we’re getting there!

Page 28: FLOW- BASED PROGRAMMING J.Paul Morrison J.P. Morrison Enterprises Ltd

03/25/07 28

“State of the Art”