Windows Workflow as Business Logic (Workshop)- Part 2: Custom Activities (Objects)

(To save you some reading, here's the link to the file: www.federaldeveloper.com/workshops), but please read on...

 

Imagine, if you will, an application development environment where you can build an application without writing code; Assembling an application by snapping together code objects like Lego Blocks!  Well, stop dreaming!  :)  We haven't gotten there yet with the .NET Framework, but Windows Workflow Foundation with Custom Activities, is pretty darn close.

One of the most powerful features of Windows Workflow Foundation is Custom Activities, which are very similar to Objects in OOP.  They allow you to pre-build very complex/large sections of business logic into simple workflow shapes that you can drag into your application and "snap" it on to other Workflow Shapes (Activities) to build very complex applications in minutes/hours versus days.

Custom Activities are Workflow “components” that hold discrete pieces of business logic or application logic that can be used on many if not all of your organizations Software Development Projects. 

For example, a bank might have:

A Bank Transaction Activity (handling Debits/Credits/Transfers/etc.)

  • A Credit Check Activity (performing complex credit check algorithms resulting in a simple credit score number)
  • A Transfer Funds Activity
  • A Bank Transaction Logging Activity

Whereas a Company’s Job Web site might have:

  • A Submit Resume Activity
  • A Parse Resume Activity (picking out details about education, or programming languages for example)

Both organizations might have common Activities, like:

  • Get a Record from a Database (Customer, Resume, Loan Application, etc.)
  • Update a Records Activity
  • Send Email Activity
  • Print Report Activity
  • etc.

Now, in the case of most of the activities that I’ve listed, they can be complex and involve a very specific set of requirements based on business rules. Each activity can be a superset (container) for smaller sub-activities. But, if care is taken to build them by people who understand the business logic and know how to write optimal code (e.g., database code, encryption code, etc.) then any developer, even more junior developers, can use these Activities, or components if you will, to build or “assemble” more sophisticated applications.  You will also find many Custom Activities that you need (database, file I/O, encryption, etc.) freely downloadable at https://wf.netfx3.com/files/14/default.aspx

 

Happy coding,

~ Robert Shelton

 

Again, here's the link to the workshop: www.federaldeveloper.com/workshops