This blog has been moved to Redwerb.com.

Showing posts with label workflow. Show all posts
Showing posts with label workflow. Show all posts

Wednesday, June 27, 2007

Orcas Workshop: Day Three

Three days down, one to go. There was a great presentation on WCF (Windows Communication Foundation) today! I'm really impressed with some of the stuff they provide out of the box for free. They also talked about WF (WorkFlow) and mobile devices.

WCF

  • Microsoft says that WCF is the next generation platform for building distributed systems (and I haven't even gotten the chance to use the last generation platform).
  • WCF provides the infrastructure to hook up any number of different protocols to a published service. This can be SOAP, REST, or any number of different protocols (there are a lot of them that WCF understands).
  • End points are essentially the transport layer for calling a service. A single service can have multiple end points defined for it (so it can be called using SOAP, REST, etc). The developer does not have to write any code to hook up these end points, it's handled by WCF. The end points can be created in a post-deployment scenario using configuration files.
  • 3.5 offers a lot of new features such as better tooling support for building and debugging services. There is a service host similar to the ASP.Net debugging host that will run so that you can test your services without having to setup your own server. There is also a WCF client that will allow you to call any of your services, including setting parameters and viewing return values. This will allow you to set break points in  your code and debug into it. These should be available in the beta 2 (I don't believe they are in the beta 1).
  • 3.5 includes 1st class support for REST, syndication, JSON (JavaScript Object Notation), Oasis, and WF (I'm sure I'm missing a bunch!).
  • There is an SDK available for syndication that I believe will run using the 3.0 bits at http://labs.biztalk.net. The name of the SDK is BizTalk Services SDK. You should be able to just reference the assembly that exposes the syndication library in order to use it (sorry, I don't remember exactly which one it is).

WF

I didn't find this presentation as interesting because I already know something about it and it doesn't look like they are adding much for 3.5.

  • WF is the software implementation of the business process or business logic.
  • WF is a lightweight process (as compared to other workflow services available)
  • Provides the infrastructure for maintaining state over a long running process.
  • A workflow can be a flow chart, state diagram, or rules based.
  • WF can be built using either code or markup
  • 3rd party designers available for designing workflows and saving as XML
  • Context Exchange Protocol allows for long running workflows. This works on a similar concept as cookies so that the workflow instance can be re-constituted when new events arrive.
  • WF provides static role based authorization as well as dynamic (code based) authorization.

Mobile Apps

There seems to be a lot of cool new features for mobile devices within the Orcas time frame, especially for developers.

  • The designer surface in VS08 can be made to look like the mobile device that you are targeting.
  • The emulator starts quickly once you have saved the state (otherwise it has to load tons of stuff when you start it).
  • You can create unit tests the same way as you would any other project in VS08. The emulator contains the testing framework. When you run the unit tests, the emulator starts and the unit tests are loaded onto it and run.
  • The emulator can be easily configured using XML to test different deployment scenarios such as RAM, screen resolution, screen orientation, battery level, etc (I'm sure you get the picture).
  • There is a device configuration manager built into VS08 that allows you to change the security context of the device.
  • If you want to connect to devices from a desktop application, you can use the Microsoft.Smartdevice.Connectivity.dll. This will let you discover any devices connected to the computer and connect to them.

Compact Framework

  • In order to make the compact framework fit on the device, many features had to be removed. This includes many libraries that weren't that useful on the device (such as the ASP.Net assemblies) as well as removing many classes and class members from the ones that were left. The end result is around 6MB.
  • Version 3.5 of the compact framework will include WCF capabilities, however, in order to meet the size requirements, much of the WCF was stripped out. This makes it more difficult to use WCF on a mobile device, but at least it's still possible.
  • 3.5 will be supported by all devices that support 2.0. You will just need to deploy the 3.5 piece.
  • Due to the occasionally connected environment and the stripped down version of the WCF, the compact framework uses email to provide reliable transport of messages.
  • 3.5 will support LINQ, but not all implementation of it. LINQ for SQL and LINQ for entities will not be supported. Expression trees are also not supported (the compact framework doesn't support Reflection.Emit which is used by expression trees).
  • There will be a remote debugging tool made available that will make it easier to find memory leaks on a device.

Saturday, April 28, 2007

Windows Workflow and Your Next Build System

Recently I've been messing around with the new workflow foundation developed by Microsoft and included in .Net 3.0. It is very cool! It has great design-time support, it's easy to extend with your own custom activities, and it seems to be very well documented.

At first I was a bit put off by the fact that it doesn't include a simple, run-time configuration process. They do give you the ability to host the designer in your application, but it appears that you have to write a lot of code to make that work (I didn't actually try it, but I did glance over the documentation). However, as I thought about it more, it seems that Visual Studio is a great way to reconfigure the workflow. It might be a bit of overkill for a non-technical person who just wants to reconfigure one or two of the activities, however, if they just go to the workflow designer, it seems pretty easy to use (but what would I know, I'm a developer :). On the other hand, if somebody that is more technically inclined wants to extend the workflow with code, they can do that easily as well.

If you are new to Windows Workflow, I think a build system is a great starter project. It's simple (as far as workflow is concerned anyway), it fits into the workflow concept very well, and it will make your build process easier to configure and extend (if your build process is anything like our current one, as long as it's working, the last thing anybody wants to do is touch it). Even if you don't use it for the build process for the entire product, it can make many tasks that you have to perform on a regular basis on your computer easier (such as preparing your machine for a new build).

Before you can start building a workflow, you will need to install .Net 3.0 as well as Visual Studio 2005 extensions for .NET Framework 3.0 (Windows Workflow Foundation). This will provide the necessary pieces that Visual Studio needs to create workflows.

For the build system I'm creating at work, I created a Workflow Activity Library (a project template available in the New Project dialog) that contains most of the activities that I want to use, such as GetFromVSS, CopyFiles, RenameFile, AttachDatabase, RunSQL, etc. Each activity has one or more properties that allow it to be configured (for example, RenameFile has a property for the path to the file and another property for the new name of the file). As you can tell, these are just building blocks for a build system. For the build itself, I create a Sequential Workflow Console Application (this is a new project type installed with the VS 2005 workflow extensions). If you have several different types of builds (such as a developer build, test build, and production build), you can create a separate project for each one.

So what makes Windows Workflow such a great tool for a build system? Other than making configuration easy, you can also disable activities. This is very useful, especially when testing. There are several parts to the build system that I'm working on (for example, compiling the code and building the database), each one is made up of several activities. I can simply create an activity that contains all the activities for that part of the build and, if I don't want to run it, I can simply click on the parent activity and set it's Enabled property to False.

The diagram below shows a very simple workflow diagram in the Visual Studio Workflow designer. It includes two activities, one of the activities has been disabled. As you can see, the Workflow designer is very similar to the WinForm designer. You start by picking the activity that you want to run from the toolbox (on the left) and dragging it onto the workflow. The workflow will show you the places that you are allowed to drop the new activity. Once you drop an activity onto the workflow, you can set the properties associated with it using the property window (on the right).

If there is interest, I might be willing to write a more detailed article for Code Project that includes sample code. So if you want to read more, make sure you leave a comment.