mfLY! and MVC Part 1

Nov 10, 2008 at 12:34 AM
mfLY! for Visual Studio allows developers to build using many patterns, one of which is Model-View-Controller (MVC).  In this post I will focus on how the controllers load views in mfLY!.

One aspect of MVC in mfLY! I want to point out here is how navigation is handled.  In an MVC application it is the controller that decides what view to load, and mfLY! is no exception but it does it just a bit different. 

In mfLY! there are Workflow Directors and View Workflows.  If it helps think of these as a workflow controller and view navigation controllers.  Workflow Directors are responsible for controlling navigation between View Workflows.  View Workflow’s on the other hand control navigation between views.  So when an application starts it lets the Workflow Director choose what View Workflow to start and the View Workflow in turn decides what view to show.  Each action (i.e. button click) in the application that is registered with the View Workflow can trigger the View Workflow to load the next view.

View Workflows allow the developer to encapsulate different feature areas into a workflow.  An example of this may be having one application with an Inventory View Workflow and an Orders View Workflow.  Since views are decoupled from navigation they can be used across multiple workflows.

The Workflow Director creates each View Workflow on demand, but does have the ability to create all of the View Workflows at one time.
The View Workflows have a similar creation mechanism.  A View workflow can create views on demand, all at one, or one level ahead.  One level ahead means when a view is loaded the View Workflow analyzes the possible paths and creates all the views that could be the next view, this way the lag between views is less.  In many cases the best option is to create all the views for the workflow at once since a user will most likely be working in a feature area for a specific task.  Of course this all depends on how many views are in the View Workflow.

In a future post I will show how to leverage the mfLY! workflow engine to do business logic and much more.

This has also been posted at the Clydesdale Software Blogs.