Alternatives to programming Wednesday, December 05, 2012 11:06 AM Alternatives to programming Force provides a radically different model of "programming" Web forms. Privilege-based access. Event-Condition-Action (triggers) Force claims that "no programming is necessary." What other alternatives are there to "programming"? Alternatives Page 1
Alternatives Page 2 Caveats in the following Wednesday, December 05, 2012 11:35 AM Caveats in the following: We presume that the goal of programming is to enable people to get work done. We presume that there is a very clear concept of what it means to get work done. We treat people and programs as equal partners in this process. This is a fundamental paradigm shift.
Alternatives Page 3 The policy/programming divide Wednesday, December 05, 2012 11:07 AM The policy/software divide Management determines policies: how a business or other enterprise will operate. Engineers develop software coherent with policies. How do these entities communicate?
Alternatives Page 4 The lesson of COBOL Wednesday, December 05, 2012 11:10 AM The COBOL language had some unique properties: Technical professionals write code. Code is readable to can be verified by a non-technical person. Thus, management can ensure that policies are obeyed... without even knowing high school algebra...(!) There is value in a representation that is Crafted by technical experts. Verifiable by non-technical management. There is value in a representation in which Human roles are represented along with program roles. Workflows can be represented, critiqued, and optimized.
Alternatives Page 5 IBM's dream Wednesday, December 05, 2012 11:12 AM IBM's dream Management describes policies in a precise form. Policies are converted directly into programs. (There's no programmer.) Program infrastructure is self-healing. (There's no system administrator or database administrator.)
Alternatives Page 6 Steps toward the dream Wednesday, December 05, 2012 11:21 AM Steps toward the dream Describing policies (BPMN). Converting them to programs (BPEL). Executing those programs: orchestration and choreography.
Alternatives Page 7 Two approaches Wednesday, March 30, 2011 3:56 PM Two prevalent approaches to business modeling BPMN (Business Process Modeling Notation): draw a process, irrespective of whether it's executable by a computer or not. Intrinsically, a diagramming method that cannot be converted into an executable program. People play roles in process. BPEL (Business Process Execution Language): define an executable part of a business process, separate from the human parts. Intrinsically, a programming language for creating services that implement a business process. Basic strategy: Managers create BPMN Programmers convert this to BPEL All else is done via magic. Axis services. Websphere services. The plumbing to make them work together.
Alternatives Page 8 Business Process Modeling 10:11 AM Business Process Modeling Describes "how a business works". Has human and IT elements. Reference: http://www.bpmn.org/documents/introduction_to_bpmn.pdf
Alternatives Page 9 Business Process Modeling Notation (BPMN) 10:12 AM Business Process Modeling Notation (BPMN) A way of graphically describing a business process. Depicts workflow. Can be created via the Eclipse SOA Tools Project (STP). File/New /New project /General /Project File/New /Other/BPMN Diagram
Alternatives Page 10 Processes 10:14 AM Rounded boxes are processes: Something that happens. Can receive messages or send messages. Can have sub-processes (that are sub-boxes).
Alternatives Page 11 Data 10:46 AM Page icons represent data
Connectors 10:18 AM Connectors Solid arrows represent precedence: Dashed arrows represent messages/data: Dashed arrows with open arrowheads indicate inputs to a process. Alternatives Page 12
Alternatives Page 13 Events 10:16 AM Circles represent events Start event: begins a process. End event: stops a process. Intermediate event
Decisions 10:21 AM Decisions are notated by diamonds: Watch out: Both sides of a fork have to have a symmetry If one side sends a message, the other one must as well. Or the recipient will deadlock. Alternatives Page 14
Alternatives Page 15 Sub-processes 10:22 AM Sub-processes Can be described via nested boxes.
Basic example of BPMN: course registration 10:26 AM Too simple, because There are two entities. They exchange information. Exchange isn't modeled. Alternatives Page 16
Alternatives Page 17 But 10:29 AM Processes are never this simple! Multiple participants ("pools"). Timing requirements ("events"). Loops ("negotiations"). Exceptions and errors.
Pools 10:49 AM Pools represent participants (entities) involved in an event. (Some authors call this a "swimlane diagram".) Alternatives Page 18
Alternatives Page 19 Doctor's appointment example 11:50 AM Source: http://www.bpmn.org/documents/introduction_to_bpmn.pdf
Alternatives Page 20 Loops 10:59 AM Loops represent repeated tasks or negotiations Try for appointment until you succeed!
Alternatives Page 21 Some helpful notations: 10:31 AM Some helpful notations:
Alternatives Page 22 Low- and high-level depictions 11:54 AM Low and high-level depictions: High level: Low level: Source: http://www.bpmn.org/documents/introduction_to_bpmn.pdf
Alternatives Page 23 Why BPMN is important 11:13 AM Why BPMN is important: Makes business processes explicit. Defines roles as pools. Depicts interactions between roles, and precedences between interactions. Exhibits the true complexity of processes. Documents failure modes. Can be used to analyze and tune processes.
Alternatives Page 24 The big issue Wednesday, March 30, 2011 5:05 PM The BPMN diagram tells us exactly what impact IT has upon the business. The diagram can be analyzed for the impact of software failures.
Alternatives Page 25 Process versus orchestration 11:19 AM Process versus orchestration BPMN: defines business processes Orchestration: assigns (internal) processes to responsible parties. Orchestration language: WS-BPEL (Web Services Business Process Execution Language)
Alternatives Page 26 The dream of BPEL 11:30 AM The dream of WS-BPEL You define services via, e.g., AXIS (or by hand (gasp!)). This generates a WSDL file for each service, which contains Xschemas for input and output. BPEL "orchestration" defines how services interact, and which services are "bound" to each activity, by referencing (AXIS-generated) WSDL files for each service. A BPEL "engine" (e.g., IBM Websphere, Apache ODE) executes the orchestration file and creates a website that supports your business process. With the proper BPEL, a web "solution" pops into existence, with interfaces for all involved people!
Alternatives Page 27 WS-BPEL 11:58 AM WS-BPEL An "XML Programming Language" An open standard Derived from IBM and other process standards. Executed by several engines. Reference: http://www.eclipse.org/stp/b2j/docs/tutorials/wsbpe l/wsbpel_tut.php (I am fairly sure the example is incorrect!)
Alternatives Page 28 Contents of a BPEL description 12:00 PM Contents of a BPEL description Process descriptions within a pool in BPMN. Bindings for particular services. Note that unlike BPMN, BPEL has non-graphical components, including the service bindings themselves. A BPEL process describes activities for one pool of a BPMN diagram.
Alternatives Page 29 Parts of BPEL 12:01 PM Parts of BPEL XSD (XML Schema Definitions) define types to be used. (internally, uses XSL and XSLT!) XPATH specifies data queries and boolean operators when choices are made. WSDL (Web Service Definition Language) defines services you may have created (using, e.g., AXIS). BPEL (Business Process Execution Language) glues together WSDL's to create a business process.
Alternatives Page 30 A BPEL definition 2:23 PM A BPEL process <process name='foo'> <!-- BPEL "activities" --> </process> An activity can be Receiving a message. Sending a message. Querying a service. A sequence of activities. A set of parallel activities. For, while, do until loops. If-else constructions. Pick: switch on first message received. Aside: BPEL is not based upon lambda-calculus, but upon an alterative pi-calculus, which is in turn based upon petri net semantics. BPEL is an orchestration language: It says what components should do in order to interact.
Alternatives Page 31 Scope 2:32 PM Scope By default, all variables are global to a process One can use <scope>...</scope> declarations to keep variables, exception handling, etc local to a region.
Variables 12:57 PM Variables <variables> <variable name="myvar1" messagetype="myns:mywsdlmessagedatatype" /> <variable name="myvar1" element="myns:myxmlelement" /> <variable name="myvar2" type="xsd:string" /> <variable name="myvar2" type="myns:mycomplextype" /> </variables> Pasted from <http://www.oasis-open.org/committees/download.php/23964/wsbpel-v2.0-primer.htm> Kinds of variables: messagetype: appropriate for a SOAP message, declared in WSDL. type: appropriate for local processing, declared in XSD. element: a piece of XML. Alternatives Page 32
Alternatives Page 33 Receiving requests from others 12:59 PM <receive name="receiverequestfrompartner" createinstance="yes" partnerlink="clientstartupplt" operation="startprocess"... /> Pasted from <http://www.oasis- open.org/committees/download.php/23964/wsbpel-v2.0- primer.htm> Taking this apart createinstance: create a new process when this happens. partnerlink: which partner sends you the message. operation: what to do when you get it.
Alternatives Page 34 Replying to requests 1:02 PM <reply name="replyresponsetopartner" partnerlink="clientstartupplt" operation="startprocess"... /> Pasted from <http://www.oasis- open.org/committees/download.php/23964/wsbpel-v2.0- primer.htm> Taking this apart: partnerlink: who to send it to. operation: what to do when it's done.
Alternatives Page 35 Invoking other services 1:00 PM Two forms of valid requests: a. Request/response: <invoke name="requestresponseinvoke" partnerlink="businesspartnerservicelink" operation="requestresponseoperation" inputvariable="input" outputvariable="output" /> Pasted from <http://www.oasis- open.org/committees/download.php/23964/wsbpel-v2.0- primer.htm> Taking this apart partnerlink: who to contact. operation: what to do on the other side. inputvariable: what to send. outputvariable: where to put what you get back. This is an RPC call: request/response. Appropriate use: Query by key a. One-way: <invoke name="onewayinvoke" partnerlink="businesspartnerservicelink" operation="onewayoperation" inputvariable="input" /> Pasted from <http://www.oasis- open.org/committees/download.php/23964/wsbpel-v2.0- primer.htm> Taking this apart: partnerlink: who to contact.
Alternatives Page 36 operation: what to do on the other side. outputvariable: what to send. Appropriate use: Storing data.
Alternatives Page 37 Sequencing 1:03 PM Sequencing means doing things in order. <sequence name="invertmessageorder"> <receive name="receiveorder"... /> <invoke name="checkpayment"... /> <invoke name="shippingservice"... /> <reply name="sendconfirmation"... /> </sequence> Pasted from <http://www.oasis- open.org/committees/download.php/23964/wsbpel-v2.0- primer.htm>
Alternatives Page 38 Conditionals 1:07 PM Conditionals <if name="isorderbiggerthan5000dollars"> <condition> $order > 5000 </condition> <invoke name="calculatetenpercentdiscount"... /> <elseif> <condition> $order > 2500 </condition> <invoke name="calculatefivepercentdiscount"... /> </elseif> <else> <reply name="sendnodiscountinformation"... /> </else> </if> Pasted from <http://www.oasisopen.org/committees/download.php/23964/wsbpel-v2.0-primer.htm>
Alternatives Page 39 Iteration 1:08 PM Iteration <while> <condition> $iterations < 3 </condition> <invoke name="increaseiterationcounter"... /> </while> Pasted from <http://www.oasis- open.org/committees/download.php/23964/wsbpel-v2.0- primer.htm> and <repeatuntil> <invoke name="increaseiterationcounter"... /> <condition> $iterations > 3 </condition> </repeatuntil> Pasted from <http://www.oasis- open.org/committees/download.php/23964/wsbpel-v2.0- primer.htm> True use of iteration: evaluating multiple alternative services. This is not a calculation language. It is a glue language. Best use of iteration: try a set of services until one answers.
Alternatives Page 40
foreach 1:10 PM foreach <foreach parallel="no" countername="n"...> <startcountervalue>1</startcountervalue> <finalcountervalue>5</finalcountervalue> <scope> <documentation>check availability of each item ordered</documentation> <invoke name="checkavailability"... /> </scope> </foreach> Pasted from <http://www.oasis-open.org/committees/download.php/23964/wsbpel-v2.0-primer.htm> Alternatives Page 41
Parallel execution 1:11 PM Parallel execution <flow...> <links>... </links> <documentation> check availability of a flight, hotel and rental car concurrently </documentation> <invoke name="checkflight"... /> <invoke name="checkhotel"... /> <invoke name="checkrentalcar"... /> </flow> Pasted from <http://www.oasis-open.org/committees/download.php/23964/wsbpel-v2.0- primer.htm> Alternatives Page 42
Alternatives Page 43 Links 2:34 PM Links During a parallel computation, you may want certain phases to wait for others. A "link" is a boolean variable that becomes true under specified conditions. This controls whether a parallel process can continue or not.
Links and parallel execution 1:12 PM <flow...> <links> <link name="request-to-approve" /> <link name="request-to-decline" /> </links> <receive name="receivecreditrequest" createinstance="yes" partnerlink="creditrequestplt" operation="creditrequest" variable="creditvariable"> <sources> <source linkname="request-to-approve"> <transitioncondition> $creditvariable/value < 5000 </transitioncondition> </source> <source linkname="request-to-decline"> <transitioncondition> $creditvariable/value >= 5000 </transitioncondition> </source> </sources> </receive> <invoke name="approvecredit"...> <targets> <target linkname="request-to-approve" /> </targets> </invoke> <invoke name="declinecredit"...> <targets> <target linkname="request-to-decline" /> </targets> </invoke> </flow> Pasted from <http://www.oasis- open.org/committees/download.php/23964/wsbpel-v2.0- primer.htm> Alternatives Page 44
Taking this apart request-to-approve: a flag that is true if the request should be approved. approvecredit: a service call that will be invoked if request-toapprove is true. A link is a variable that is set entirely for its side-effects. The side-effect of a link being true is invocation of a specific service. Alternatives Page 45
Alternatives Page 46 Join conditions 1:15 PM Join conditions: operation is invoked if one target is present: <flow...> <links> <link name="request-to-approve" /> <link name="request-to-decline" /> <link name="approve-to-notify" /> <link name="decline-to-notify" /> </links> <receive name="receivecreditrequest" createinstance="yes" partnerlink="creditrequestplt" operation="creditrequest" variable="creditvariable"> <sources> <source linkname="request-to-approve"> <transitioncondition> $creditvariable/value < 5000 </transitioncondition> </source> <source linkname="request-to-decline"> <transitioncondition> $creditvariable/value >= 5000 </transitioncondition> </source> </sources> </receive> <invoke name="approvecredit"...> <source linkname="approve-to-notify" /> <targets> <target linkname="request-to-approve" /> </targets> </invoke> <invoke name="declinecredit"...> <source linkname="approve-to-notify" />
Alternatives Page 47 </ <invoke name="declinecredit"...> <source linkname="approve-to-notify" /> <targets> <target linkname="request-to-decline" /> </targets> </invoke> <reply name="notifyapplicant"...> <targets> <joincondition> $approve-to-notify or $decline-to-notify </joincondition> <target linkname="approve-to-notify" /> <target linkname="decline-to-notify" /> </targets> </invoke> </reply> </flow> Pasted from <http://www.oasisopen.org/committees/download.php/23964/wsbpel-v2.0-primer.htm> Taking this apart Either decline-to-notify or approve-to-notify gets set. When either one is set, notifyapplicant gets called. There is no sequence to whether decline-to-notify or approve-tonotify gets set first. The whole interaction is asynchronous: The event notifyapplicant gets called when the arrival event is approve-to-notify or decline-to-notify.
Alternatives Page 48 Fault Handling 1:16 PM Fault Handling <faulthandlers> <catch faultname="bookoutofstockexception" faultvariable="bookoutofstockvariable">... </catch> <catchall>...</catchall> </faulthandlers> Pasted from <http://www.oasisopen.org/committees/download.php/23964/wsbpel-v2.0-primer.htm>
Scopes 1:18 PM Scopes Can use scopes to create local: Variables Fault handlers <scope> <faulthandlers> <catch faultname="xyz:anexpectederror">...</catch> <catchall><!-- deal with other errors -->... </catchall> </faulthandlers> <sequence> <!-- or flow --> <!-- do work --> </sequence> </scope> Pasted from <http://www.oasis-open.org/committees/download.php/23964/wsbpelv2.0-primer.htm> Alternatives Page 49
Alternatives Page 50 Waiting for events 1:20 PM Waiting for mutually exclusive events <pick> <onmessage partnerlink="buyer" operation="inputlineitem" variable="lineitem"> <!-- activity to add line item to order --> </onmessage> <onmessage partnerlink="buyer" operation="ordercomplete" variable="completiondetail"> <!-- activity to perform order completion --> </onmessage> <onalarm> <for>'p3dt10h'</for> <!-- handle timeout for order completion --> </onalarm> </pick> Pasted from <http://www.oasis- open.org/committees/download.php/23964/wsbpel-v2.0- primer.htm> Taking this apart: onmessage: first one that is received is processed. onalarm: handles timeout events: 3 days 10 hours.
Alternatives Page 51 Critique 2:41 PM Critique Much slower execution time than Java glue... But glue program here is shorter! Very general: Responses can be whole web pages (servlet invocations). Requests can be AJAX. But: there is a very serious limit BPEL isn't "reusable". The concept of a subroutine does not exist. Using BPMN, one can define a process. Using BPEL, one can refine a pool into a program. This is the policy/program divide in action. Solution: look at interactions as subroutines, rather than steps. => Web Service Choreography.
BPMN summary Wednesday, December 05, 2012 5:35 PM Alternatives Page 52