<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Intalio's Developer Corner</title>
	<atom:link href="http://dev.intalio.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.intalio.org</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Tue, 28 Oct 2008 01:35:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>Why Business Process Languages?</title>
		<link>http://dev.intalio.org/2008/10/why-business-process-languages/</link>
		<comments>http://dev.intalio.org/2008/10/why-business-process-languages/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 12:17:27 +0000</pubDate>
		<dc:creator>matthieu</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dev.intalio.org/?p=19</guid>
		<description><![CDATA[I&#8217;ve heard that too many times when first mentioning what a business process language does to a random hacker &#8220;So this is some sort of bash script, right?&#8221; (bash being a fairly powerful Linux shell). So let me say that clearly: a business process language has very little to do with bash. Except maybe that [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve heard that too many times when first mentioning what a business process language does to a random hacker &#8220;So this is some sort of bash script, right?&#8221; (bash being a fairly powerful Linux shell). So let me say that clearly: a business process language has <em>very little</em> to do with bash. Except maybe that they&#8217;re both domain specific languages (like SQL, or HTML, or a wiki markup).</p>
<p>But what people usually really want to ask is why one would need a specific language to write business processes. Why a general purpose language like Java, C#, Ruby, Python or Perl wouldn&#8217;t fit the bill. Why one would want to learn a new language.</p>
<p>The first thing to realize, if you haven&#8217;t already, is that programming languages are made for people to write or read, not for machines. Otherwise we would all program in assembler or poke our way in hexadecimal. So a language that makes writing (maintaining, reading, generating, &#8230;) a given program significantly easier is usually worth the upfront effort. At least if it&#8217;s been well designed. Even so-called general purpose languages all have their sweet spot and pain factors.</p>
<p>That being clarified, let&#8217;s see with an example how the need for a Business Process Language (BPL) would arise and what would be so different about it that it would motivate a specific language.</p>
<h3>A Use Case</h3>
<p>Say that you want to develop the service I mentioned in my <a href="http://dev.intalio.org/2008/09/hello-world/">last post</a>, to guide people through the process of buying a home, from financing to finding an agent to the end of escrow. You want to develop this service as a Ruby on Rails website, where people can see a clear outline of what to expect with approximate dates, browse apartments and houses based on their criteria (maybe partnering with other services), select banks from offers that are automatically made to them, etc. You also want to remind them by e-mail or SMS when a deadline approaches for example.</p>
<p>The raw services that provide each or these functionality will be either implemented by you or by a partner you communicate with. The communication channel doesn&#8217;t really matter for now. On top of that you&#8217;re going to need some sort of glue that will implement what obviously look like a long-living, non trivial process. That process can change from one day to the other based on new legislation, new partnerships or evolution of your business where you&#8217;d provide additional functionalities.</p>
<p>As your web site is mostly a Rails application, you decide to implement that process using Ruby, which is also pretty good at gluing things together. Your first task is going to be implementing the primitives to invoke your backend services or your partners&#8217; services. Your services are most likely going to be RESTful Rails services and your partners might do SOAP. Now that you have that you can implement your first naive script, doing those calls and implementing the process logic, including timers, loops, conditions, etc.</p>
<p>Now there are obvious problems here. The overall process can last several weeks, you can&#8217;t afford to lose all that data if you have a server failure. Or if you have to restart your application. Or upgrade. So you&#8217;re going to have to add some sort of persistence, the idea being that any of those process executions can survive a restart.</p>
<p>Adding persistence in your script is actually non trivial work. You need to find places where you can &#8220;snapshot&#8221; the execution in the script and resume from there. So far you hadn&#8217;t made those places explicit so you&#8217;ll probably need to rewrite your process to make them more obvious and then add more code to handle the saving and restoring of the process state. Knowing the exact position in the script is not enough because you have conditions and iterations, so you need to know exactly what was the path that leads you to where a process is currently executing and what is the current value of the variables used by your process.</p>
<p>Another problem arises when you start thinking of failure scenarios. Say that a user selects a mortgage that he likes from all the offers that were made to him. But since the offer, the loan percentage has increased. You only discover that when you actually try to lock the loan with the bank, which refuses it. So now you need to &#8220;go back&#8221; in your process, notify your user and possibly cancel a few steps that happened in the middle (like notifying the seller). And there are multiple places in your overall process where similar business failures can happen.</p>
<p>Also asynchronous interactions are actually not so trivial. To get loan offers from banks you invoke all the ones you have a contract with and they guarantee a reply within 6 hours. So you have to wait for and collect all those replies. If you have thousands of users, you can&#8217;t have thousand of processes physically waiting and locking resources (memory mostly), your data center will explode before you know it.</p>
<p>By now it should be clear that the naive Ruby script encoding your business process is evolving toward a full blown, homegrown kitchen sink. And I haven&#8217;t even brushed up the surface of what could go wrong.</p>
<p>That kitchen sink is what most applications where a direct need for business processes tooling (and a programming language is a tool in my book) hasn&#8217;t been identified end up with.</p>
<h3>Business Process Languages and Runtimes</h3>
<p>The requirements that influence the writing and execution of business processes trickle down at the language and runtime level. I&#8217;m going to introduce here what are the design impacts on a business process language. In later posts, I&#8217;ll probably address how those are handled in SimPEL and also how <a href="http://ode.apache.org">Apache ODE</a> supports the runtime requirements.</p>
<p>What you should expect from a Business Process Language (BPL) is:</p>
<ol>
<li>Conditionals, loops (alternatively recursion) and variables.</li>
<li>Native high level process specific constructs.</li>
<li>At least implicit support for persistable <a title="Continuations in computing (Wikipedia)" href="http://en.wikipedia.org/wiki/Continuation" target="_blank">continuations</a>.</li>
<li>Long-living transactions.</li>
</ol>
<p>The first point just guarantees a minimal level of expressiveness.</p>
<p>The second point means that BPLs usually have language keywords or constructs relevant to the domain. Simple things like process waiting. And more complex ones like asynchronous interactions or parallel processing (two branches of execution happening at the same time).</p>
<p>The third point guarantees that the whole state and the current execution step can be suspended and saved at any point in time in your process. As illustrated in my previous example, you need to be able to pause and resume execution pretty much at any point. Practically, the BPL usually constrains when those pauses happen (which doesn&#8217;t mean that the runtime should be similarly constrained).</p>
<p>Finally, the support of long-living transactions requires language-level mechanisms to deal with the failure of long-living transactions. It usually requires some error handling primitives (like throw and try/catch) and the notion of a unit of work that makes rollbacking possible.</p>
<p>Note that I haven&#8217;t defined anything really groundbreaking, most existing BPLs cover all or most of the points that I&#8217;ve listed.</p>
<h3>Concluding Remarks</h3>
<p>By now, you should have realized what motivates the use of a language specialized for business processes and have some ideas of what to expect from one. Hopefully that will help you identify situations where a BPL could be a good fit.</p>
<p>In this post I&#8217;ve only been talking about <em>executable</em> business process languages. You&#8217;ve probably heard of <a href="http://www.bpmn.org/">BPMN</a>, which is strictly about modeling. Just like in many other problem space, there&#8217;s a wide spectrum of possible languages or notations which address different levels of abstraction. Take a typical Java application for example, a whole lot of languages have usually been used before its final execution. Plain English for specifications. UML for design. The internal representation of Java constructs that an IDE uses (its <a href="http://en.wikipedia.org/wiki/Abstract_syntax_tree">AST</a>). Java for the application (it doesn&#8217;t end here). Bytecode that gets fed in the virtual machine. The VM internal representation. And finally machine code. All those different levels exist for a reason, they all address a different degree of abstraction. Some need to be public and standardized (English, UML, Java, Java bytecode), others don&#8217;t.</p>
<p>The <a href="http://www.infoq.com/articles/bpelbpm">fallacy</a> is that a single language or notation can handle all those different levels of abstraction or detail. Standard high level notations are good and needed. Standard lower level programming languages are good and needed. And even the standardization of bytecode level representations for process runtimes could be good and needed, to encourage a strong runtime ecosystem.</p>
<p>There&#8217;s a lot of work left, I&#8217;m <a href="http://svn.apache.org/repos/asf/ode/sandbox/simpel/">off</a> coding now&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.intalio.org/2008/10/why-business-process-languages/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Business Processes for Developers</title>
		<link>http://dev.intalio.org/2008/09/hello-world/</link>
		<comments>http://dev.intalio.org/2008/09/hello-world/#comments</comments>
		<pubDate>Sat, 27 Sep 2008 05:25:51 +0000</pubDate>
		<dc:creator>matthieu</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dev.intalio.org/?p=1</guid>
		<description><![CDATA[Any good blog introduction has to start with a Wikipedia quote. Call that Matthieu&#8217;s Rule #4 of Blog Writing (I&#8217;ll tell you about the 3 first ones another day). Quoting the big W is a good way to not have to forge a good definition yourself, so let&#8217;s proceed:
A business process or business method is [...]]]></description>
			<content:encoded><![CDATA[<p>Any good blog introduction has to start with a Wikipedia quote. Call that Matthieu&#8217;s Rule #4 of Blog Writing (I&#8217;ll tell you about the 3 first ones another day). Quoting the big W is a good way to not have to forge a good definition yourself, so let&#8217;s proceed:</p>
<blockquote><p>A business process or business method is a collection of interrelated <span class="mw-redirect">tasks</span>, which accomplish a particular goal.</p>
<p>A business process begins with a customer’s need and ends with a customer’s need fulfillment. Process oriented organizations break down the barriers of structural departments and try to avoid functional silos.</p>
<p>Business Processes are designed to add value for the customer and should not include unnecessary activities. The outcome of a well designed business process is increased effectiveness (value for the customer) and increased efficiency (less costs for the company).</p></blockquote>
<p>Clear, no? Not so much actually. A long assemblage of semi buzzwords perfectly forged for direct publication to CIO magazine. It certainly sounds nice, all this customer&#8217;s need fulfillment and value added, could you get some for me too, please? So far, it&#8217;s always been the way business processes have been described. For people who actually have to <em>implement</em> a business process, developers like you and me, it&#8217;s not very helpful. A little too, how to say&#8230; light on the details side.</p>
<p>A business process is whatever happens after you&#8217;ve hit that &#8220;order&#8221; button on Amazon, until you receive the vacuum cleaner robot you&#8217;ve been dreaming of. Including when the item isn&#8217;t available anymore and the production line has to be notified. Or when a new supplier needs to be selected because the last one ran out of business (selling vacuum cleaner robots can be tough sometimes). Or when they sent you a pool cleaning robot instead and you have to send it back.</p>
<p>Another business process takes place when you buy a house. It could be a good time now, except that you might actually have more cash than your bank. So you have to visit places, select one that you like, make offers, sign a contract, select a loan, secure the loan, end your escrow, all within a precise timing. Painful little process.</p>
<p>In many organizations those processes are ad-hoc, disseminated between various sources, from pieces of paper to people&#8217;s brain and computer backends. Or it&#8217;s just hard-coded within your own application. And often, it&#8217;s just fine this way. But sometimes, it bites.</p>
<p>You know those little pieces of code that you&#8217;ve assembled so carefully and that users keep on changing their mind about? Turns out they change their mind for a reason. And modeling this logic in its own layer using specific semantics that allow easy modification can make a lot of sense. <em>Separation of concerns apply for processes too and unfortunately for quite a few applications, is often ignored</em>.</p>
<p><span id="more-1"></span></p>
<div class="mceTemp mceIEcenter">
<dl id="attachment_11" class="wp-caption aligncenter" style="width: 510px;">
<dt class="wp-caption-dt"><a href="http://dev.intalio.org/wp-content/uploads/2008/10/singleshot-small.png"><img class="size-full wp-image-11" title="singleshot-small" src="http://dev.intalio.org/wp-content/uploads/2008/10/singleshot-small.png" alt="Singleshot" width="500" height="152" /></a></dt>
</dl>
</div>
<p>So what if you wanted to implement that service, helping home buyers, from selecting an agent to moving in? How would you explicitly implement the process that drives your application? If you look for standards, there&#8217;s pretty much only WS-BPEL nowadays. A few years ago you would have all those standards that would compete with each other and the market was fragmented. I hear BPMN? Definitely nice to have but I&#8217;m talking about implementation here, BPMN is not in that field. So your first step would probably be to select a WS-BPEL engine, an <a href="http://ode.apache.org">open source</a> one preferably.</p>
<p>The thing is, even if BPEL defines the right level of semantics (I&#8217;ll come back to that point in a later post), as a language it really sucks. It&#8217;s XML all over the place, tied to WSDL, verbosity at its best with many levels of unnecessary indirection that forces you to triple check most references. <a href="http://tempo.intalio.org/tempo/trunk/processes/TaskManager/src/main/resources/TMP-TaskManagementProcess.bpel">Check</a> <a href="http://tempo.intalio.org/tempo/trunk/processes/TaskManager/src/main/resources/TaskManagementSystem.wsdl">for</a> <a href="http://tempo.intalio.org/tempo/trunk/processes/TaskManager/src/main/resources/TaskManagerProcess.wsdl">yourself</a> if you want. And it somehwat makes sense: BPEL has been designed for tools to generate and other tools to consume, not for people to write. It&#8217;s a bit like Java bytecode if you want, the compiler generates it, the VM reads it but no sensible human (except the implementers) should have to look at it.</p>
<p>So the toolset for programmers is actually fairly poor at the moment. Don&#8217;t get me wrong, design tools are actually good but when you&#8217;re used to code, the expressiveness is limiting. Which is why we&#8217;ve started thinking about changing that. And the solution we&#8217;re currently designing will probably be organized around those main pieces:</p>
<ul>
<li>A Simple Process Execution Language (dubbed SimPEL) that feels like a modern programming language but with domain specific constructs.</li>
<li>A versatile runtime for SimPEL that can be easily embedded in most environments. One important goal is to make it easy to use, whatever your language: Javascript, Ruby, Python, Java, PHP, &#8230; The runtime should also be able to execute BPEL, being part of <a href="http://ode.apache.org">Apache ODE</a>.</li>
<li>A task manager called Singleshot, integrated with the runtime and easy to invoke from SimPEL programs, to give a human-friendly face to your processes.</li>
<li>An IDE with all the features you&#8217;re used to: syntax highlighting, debugging, refactoring. &#8230;</li>
</ul>
<p>All of this with a strong emphasis on web standards: RESTful interfaces and feeds where appropriate. And open source under a liberal license.</p>
<p>So expect more posts detailing different parts of that solution and some of them going deep into the guts of SimPEL, which is what I&#8217;m working on right now. I&#8217;ll end this too long description with a couple of teasers. First the screenshot above comes from Singleshot, our task manager. Second and last, below is a small sample program written in SimPEL which currently executes. I also have a <a href="http://svn.apache.org/repos/asf/ode/sandbox/simpel/src/test/resources/auction.simpel">longer one</a>, it doesn&#8217;t execute yet but I&#8217;m getting there.</p>
<p><!--more--></p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;">process InvokeTwoWays <span style="color:#006600; font-weight:bold;">&#123;</span>
    receive<span style="color:#006600; font-weight:bold;">&#40;</span>itwPl, itwOp<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> |initial|
        operands = <span style="color:#006600; font-weight:bold;">&lt;</span>operands<span style="color:#006600; font-weight:bold;">&gt;&lt;/</span>operands<span style="color:#006600; font-weight:bold;">&gt;</span>;
        operands.<span style="color:#9900CC;">op1</span> = initial;
        operands.<span style="color:#9900CC;">op2</span> = <span style="color:#006666;">3</span>;
        invoke<span style="color:#006600; font-weight:bold;">&#40;</span>calculator, add, operands<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> |result|
           response = result;
        <span style="color:#006600; font-weight:bold;">&#125;</span>
        reply<span style="color:#006600; font-weight:bold;">&#40;</span>response<span style="color:#006600; font-weight:bold;">&#41;</span>;
    <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://dev.intalio.org/2008/09/hello-world/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
