Sumit Khapli's Blog

May 8, 2012

Building Task Based System

Filed under: BPM, Task — Tags: , , — Sumit Khapli @ 9:22 pm

There are some scenarios in business process which cannot be automated. Something like reviewing scanned documents, approving requests, situations where system cannot determine any result or scenarios where critical decision has to be taken. Any business process management suite handles this using Task Management Apis. Even if you do not use BPM suite, the underlying core principle of Task management is same everywhere.

Before designing a Task Management Processes, following things are important to be considered

1. Business agreed wireframes (mock up screens)
2. Business agreed role hierarchy

Shared Inbox

Shared Inbox

Shared and Dedicated Inbox

Shared and Dedicated Inbox

Wireframes :

This is the most important piece of information apart from the other functional requirements specs. Wireframe exactly tells us what the user wants to view when he opens up the task. This serves as the basis of the design process.

Wireframes must include the initial task allocation scenarios (based on task allocation algorithm)

  • Shared Inbox
  • In this case, tasks are shared across the team and anyone can pick up and start working on the task

  • Dedicated Inbox
  • In this case the tasks are routed to individual team member’s task queue

  • Shared Inbox + Dedicated Inbox
  • In this case, tasks are picked up from the shared queue into the individual queue

  • No Inbox, direct mail integration
  • In this case there is no queue, the task are assigned directly to the individual

Wireframes must include screen behaviour, description of all the screen panels. It should also contain subsequent wireframes for conditional flow paths.

Role Hierarchy :

If the application access if role based then typically the task management revolves around the role hierarchy. Ex. Team Members of certain Role (say Role1) can manage individual tasks but cannot delegate them to others while Role team leaders (say Role1 Team Lead) can delegate tasks to others apart from individually managing them.

Role based task management is a very common task management framework. However it brings its own complexities with them like concurrent task allocation, optimistic locking, task re-assignment options, holiday management, sick leave management etc.

If the system is built on top of BPM suite, most of the complexities are handled out of box so that the system developer can focus on the task involved rather than build the framework from scratch.

Things to support or consider for a bare bone task management app:

  • Roles
  • Ability to configure logical roles and then link them to physical roles or groups (like LDAP groups)

  • Task Allocation to Roles
  • Ability to create tasks and assign them to the logical roles

  • Task Re-Assignment
  • Ability to re-assign tasks to either a role or to an individual person in the role

  • Task Allocation routines
  • Ability to define task allocation routine, in case dedicated inbox or direct mail integration is used

  • Leave and Holiday Management
  • Ability to add holidays and leaves so that task allocation is intelligent enough to avoid allocation to an individual who is on leave

  • Time management (Individual and Global Kpis)
  • Ability to gather KPI statistics on time spent on a particular task and time spent by a particular person the task.


February 14, 2012

Jasmine : Testing Java Scripts

Filed under: Java, Technology — Tags: , , , — Sumit Khapli @ 11:28 pm

Lately, I have been involved in some web/java development with all the latest open source apis (guava, hamcrest, TestNG etc..). Its exciting to work in java after working in webMethods and other EAI suites for some years now. So i grabbed this opportunity to work one of the BDD (behaviour driven development) framework.

Most common part of any web application development is the java script. While we write our unit/integration/acceptance tests around the java code, its very easy to forget about those java scripts.

Well there are many ways to test java scripts (as I know now – byproduct of googling internet). However thanks to my colleague when he pointed out to the Jasmine BDD framework. Although its quite easy to implement but the maven plugin to this framework is relatively new and had big time to configure this to work.

So here are the steps :

1. Configure maven plugin
2. Write specs
3. Test using browser
4. Test using maven build cycle

Its a big ocean out there especially if you start drilling inside and check the features of Jasmine. However lets stick with maven plugin configuration for now.

1. Configure maven plugin

Following is the extract of the POM file.

  • jsSrcDir — Directory where the java script “.js” files are places
  • jsTestSrcDir — Directory where the Jasmine specs are placed which would be used to test the java script
  • preloadSources — The dependent java script files to be loaded prior to running the custom java scripts. The file path is relative to either jsSrcDir or jsTestSrcDir. The plugin will figure it out. You can also give full absolute path if they are placed somewhere else.
  • browserVersion — The browser which these tests would be imitating
  • haltOnFailure — Mark the maven build cycle as failed if tests fail

There are many properties, check this link to understand the configuration properties (read the comment section in the plugin source code which opens in this link to understand how to use them)

2. Write Specs

Lets say we have a simple script to clear form fields on click of button.

function  clearFormFields() {
   document.getElementById("field1").value = '';

To test this script using Jasmine, you will need to write a Jasmine spec something like below :

describe('clearFormFields() call', function() {
   it('should clear the form fields', function() {
     addTagToHtmlBody('<input id="field1" type="text" value="" /&gt);



    function addTagToHtmlBody(new_tag) {

The spec here creates an html fragment and then calls the clearFormFields() on the same.

expect(…) validates that the form field is cleared.
toMatch(…) is one of many jasmine matchers. You can check this link for more details on the matchers.

3. Test using browser

Navigate to the project directory and execute.

mvn jasmine:bdd

The bdd goal will be executed if you hit the following default url http://localhost:8234.
This is very useful for testing the specs on the fly.

4. Test using maven build cycle

Navigate to the project directory and execute.

mvn test

This should execute the maven build cycle and will execute the jasmine specs along with other tests.
It should look like below.

 J A S M I N E   S P E C S
clearFormFields() call
  should clear the form fields

Results: 1 specs, 0 failures

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] SAMPLE Application .................................. SUCCESS [0.875s]
[INFO] SAMPLE Application Web Module ....................... SUCCESS [3:25.797s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:26.860s
[INFO] Finished at: Wed Feb 15 00:25:09 EST 2012
[INFO] Final Memory: 13M/75M
[INFO] ------------------------------------------------------------------------

And there you go :), its ready and remember its just a tip of an iceberg.

September 28, 2011

Remind me please !!!

Filed under: Idea, Technology — Tags: , , — Sumit Khapli @ 2:09 pm

I still remember the good old days when I used to run to a groceries store chanting the list of things to buy (2kg potato, 1kg onion, 100gms lentils). Ultimately, I would buy 100gms of potato, 2kg of onion and 1kg of lentils!!! The fun part was that, my mum would already know that her stupid son is going to goof up everything. Well to my defence I still did better than my father . Fortunately nowadays we both carry mobile phone with us. Thank god to the technology and smart phones. I can even have apps to store the list of items to buy and set reminders of tasks to complete before I start getting calls (Did you finish that yet?….. yikes !!!)

Talking of reminders makes me think of different tasks that a software bloke would do in his day to day office life. Being a software developer, you need to keep track of so many things before the software system falls apart , you start getting myriad of calls from the frustrated business users and the software dooms day becomes a reality.

Some of the mundane things which we normally have to setup reminders include:

• Password renewal dates
• Certificate expiry dates
• Sending reminders to third party to update contact emails
• Setting up restart schedule for the servers
• Roster schedule
• Fill time-sheets
• Cleaning up logs / archiving etc…

We have numerous mechanisms to automate these activities. We use email client reminders (Outlook / thunder bird or any other client), setup excel sheets with expiry dates to monitor, create schedule jobs/ cron jobs. All the mentioned methods are good and they work fine but what if we have a single interface to solve all our worries? Sounds interesting?

Yes a universal reminder service!!! Configure once and forget. No need to set reminders. The service would do all for you.

Its rightly said necessity is the mother of invention !!!
I wonder if someone has already thought of this and has a service (obviously open source) so that I don’t have to re-invent the wheel 🙂



June 20, 2011

Business Process Managment

Filed under: BPM, Technology — Tags: , , , , — Sumit Khapli @ 7:01 am

BPM (Business Process Management) has become the de-facto standard for designing and governance of enterprise business processes.  There are many definitions, explanation which are worth to read on but I am not going to discuss this here. You can very well google it. I am going to explain it in a plain and the crudest way ever!!!

“Understand the business case/process. Go to your drawing board and draw the process as blocks of abstract steps. Then drill down each block even further and expand the process in more detailed blocks”

This may take time and lot of iterations but trust me its not difficult, it’s the perfection which tests your patience. The next part is the technical implementation. This depends upon which tool-set you are going to use depending on the organization’s IT needs. If you want to have a feel of the orchestration process then you can use the open source tools.

Before we talk of technical details and acronyms like BPEL, BPMN, and XPDL, we need to first understand few considerations while orchestrating a business process

  1. Process Efficiency and effectiveness
    1. Are there any gaps?
    2. Is it fully automated?
    3. Is the process efficient enough?
  1. Process Scalability
    1. Will this process scale as the business becomes more complex. In other terms can we quickly change the process without affecting much and still achieve what we want?
  1. Integration
    1. Which systems are involved or departments are involved to which we have to integrate?
  1. Delivery
    1. What is being delivered by the process?
    2. Is it worth spending time to automate this process?
  1. Process Metrics
    1. What kind of process metrics can be stored?
    2. What is required by the business if they want to have a holistic view of the process over a period of time?
    3. Will this process be able to provide some insight and recommend improvement to the business?
  1. Audience
    1. Offcourse its business but in what sense? Is the business going to monitor the process using the technology stacks or is it going to leave it to IT guys to monitor?
  1. No spaghetti please…
    1. Don’t go for a BPM implementation if you are going to implement a process which no can comprehend in first attempt. In other words, orchestrate it in such a way that anyone can understand it just by looking at the BPM blocks. Remember neatness is the key here.
    2. Other recommendation is to let the business/functional analyst have a look at your BPM and explain him the process keeping the functional document in hand and then get his approval
    3. Or let the business/functional analyst orchestrate the BPM using whatever tools he is comfortable with. Just make sure he uses all the BPMN notations, which is hard especially if the functional analyst is not from IT background and that’s why this approach should be taken only if you are certain.


Once done with detailing the building blocks and are ready to orchestrate it using a UML tool / BPM tool, you need to make sure to adhere to the industry wide standards. The object management group ( came up with a standard called as BPMN (Business process management notation) to represent each activity in the BPM. The implementation of the BPMN specs differ form tool to tool but generally it is being accepted as general guideline to orchestrate BPM.


It often occurs that the process is defined by the business analyst or the business user using the business tools (or to say the tools which they are comfortable with) like Visio, Rational Rose etc and then the technical developers or architects transform or rather re-do the whole thing in BPM tools to move it to the execution environment.

To address this problem, Workflow Management group ( standardised a format called XPDL (XML Process Definition Language). The XPDL is designed to capture the graphical details (layout) and any important information required to execute it. Ideally any BPM tool / UML tool which is XPDL compliant can interchange the process orchestration diagrams. The BPM vendors may choose to extend the XPDL using custom attributes to store vendor specific details.

Having said so not all of the layout will be copied in reality due to various vendor specific constraint, however this will guarantee that the overall process semantics are moved. Once you start adding more details specific to the tool, you should then stick to that tool till it moves to the execution environment. There are limitation again if you have a major change request on the process (either start from scratch or make the changes in the vendor specific tool)

Frankly speaking, I have not used the XPDL feature yet in real time projects apart from small research concepts. However industry is finding it more useful given the variety of software applications/tools within the organizations.


Before I proceed on this, let me clarify one thing. BPEL and XPDL are NOT same.

BPEL (Business Process Execution Language) was designed collectively by IBM, SAP, Microsoft, and BEA System (now part of Oracle) and submitted to OASIS ( It’s an execution language i.e. when you deploy our process onto a process engine, the execution of that process is defined using BPEL if the BPM vendors are BPEL compliant and your business process uses XML as a data exchange format and consists of web services (lots of ‘ifs and buts’) but BPEL has got some solid supporters in the market. However, the BPM vendor is free to use any execution language either BPEL or its own proprietary.


Following are some of my tips to orchestrate an abstract and yet fine-grained process. How can a process be an abstract when it is fine-grained?

Take an example of following scenario

User Registration and download process: User A wants to register on site and then download some BPM fact sheets. He may participate in the voluntary survey or skip it.

Below example shows how different sections of the organisation view / use business process as per the needs and if someone can guess them then its correct I have used ARIS Express to draw them.

Strategy Planners :

Process - Strategy Planners

Process - Strategy Planners

The top management (CEO/CTO/COO etc…) would look at what is going on as an overall process. They do not want to go in details. This part of an organisation is interested in

  1. How this can increase the ROI (rate of investment) ?
  2. How this can help them to identify growth ?
  3. How this can help them to identify bottlenecks ?
  4. How this can help them to predict business outcomes ?
  5. How this can help them in taking business decisions ?

Now all of them above cannot be done using only BPM, we need something more. That something more is called as process analytics or rather BAM (business administration and monitoring). BAM can provide key inputs in analysing data, grouping it in logical form to create business patterns. It was predict future outcomes based on past results. However we are not going to discuss BAM here.

Business Planners :

Process - Business Planners

Process - Business Planners

Business Analysts would look at how to achieve the goal. They would want to check each process and drill down to the core of the functionality. This part of an organisation is interested in

  1. How this can help to make it efficient ?
  2. How this can help to remove current complex process ?
  3. How this can help to make it flexible for future changes ?
  4. How this can help to cater to all the business requirements ?
  5. Are all validation and rules catered for ?

Technical Planners :

Process - Technical Planners

Process - Technical Planners

* Actual Technical Steps in above diagram is the logical representation of technical work

Technical SMEs / Developers / Architects would look at how to implement this in the technological stack available with them at the moment. They would be interested in

  1. How to implement this in the available tool ?
  2. Are there any constraints and if so then what are the workarounds ?
  3. Is there a need to further drill down sub-process to support technical limitation?

As this is the final and last phase where the actual technical implementation is done, there are many ways in which the process can be collapsed. One may want to keep the process as it is and prefer to handle the complexity of the implementation which would eventually be deployed in the process engine. One may want to actually break the sub process into further technical steps and then write code inside which is eventually deployed on the process engine. I have shown the first step in this way in the figure below.

Some points on making process less complex:

1. Use of Pool  :   Always group activities under a pool. A pool by definition is a participant of the process. (ex. System, Company or partner).

2. Use of Swinlanes : Always divide a pool into Swimlanes.  Swimlane groups the activities of the pool.  Grouping can be based on roles, internal mechanism or anything which can divide them and make it simple to comprehend.

3. Use of Sub-processes : Sub-process is a compound activity which can be broken into finer process. It encapsulates finer details. If you see above process diagrams, the strategy planning is compound activity which can be broken into the business planning view.

4. Use of BPMN notation: Try to use correct BPMN notations for the scenarios.

More on Sub-process :

Sub process can be embedded and/or individual. Different tool-set have different way of expressing this. Lets call an embedded process as a ” Embedded Sub Process” and individual sub-process as a “Referenced Process”

Sample Referenced Process

Referenced Process

Referenced Process

Sample Embedded Sub Process

Embedded Sub Process

Embedded Sub Process

The decision on when to use Referenced Process and when to use Embedded Sub Process is best left to the designing team (consisting of strategy/business/technical planners).  However it may be taken into note that too much of compounding will leave your business process unreadable (make it complex to comprehend) and too less of compounding will make it fuzzy or sometimes too complex to read. There has to be a balance. Trust me I got this advice from the experts 🙂

In case of referenced process, depending on the product/tool-set which you are using, there are some considerations to make for these inter process communication links. You may call a referenced process synchronously or you may call a referenced process asynchronously. Again it depends on the designing team and the product you are using.

Handling process failure

Process failure can happen at any level

1. Step Failure (Defect / Data Issue)

2. Task Failure (Manual Task)

3. Transient Failure (Network Fallout / Database Error)

4. Force Failure (Something where you want process to fail)

Again depending on the product / tool-set there are diff ways to handle the failures. The product which I used had a process wide error step along with step error transition. Depending on the requirement one can use a error step transition or a process wide error step. No matter whatever way you choose always make sure you have a process wide error step (if product supports one) or customise the code to have one.

In the process wide error step you may

1. Invoke the neccesasry alerting mechanism like creating a trouble task and allocating to the support personnel

2. Send a mail to the appropriate team

3. Invoke your generic error handling framework if you have one

If you follow this, it would make your process more reliable.

While handling manual task (workflow steps) , you may also want to create an escape/exit route.  For example, if a task is allocated to the user X for creating an order Y, however after sometime user X realises that order Y should not be in the system and cannot be cancelled and he wants to get rid of this task then in that case the escape route would be useful.

Task Escape / Exit

Task Escape / Exit

Another way to handle this situation is to set task expiration rules. So you can simple ask user X to ignore and you can fire task expiration rules which will make sure this task expires. However what happens next is again left to you to decide.

There are many thing to put in but I will limit this blog here. I hope its useful for beginners.

View Sumit Khapli's profile on LinkedIn

Create a free website or blog at