Business & Foundational Modules

Topics: CAB & Smart Client Software Factory
Jan 22, 2007 at 7:49 AM
Hi ,

I want to know what exactly is the difference between the business & foundational modules in scsf???
Jan 22, 2007 at 9:56 AM
From the Developer Labs Documentation # 2
""Creating a buisness module" page 4
----

Business Modules
A business module represents the conventional Composite UI Application Block module. It has at least one WorkItem (specifically, a ControlledWorkItem) and contains business logic elements. Typically, it includes some combination of services, views, presenters, and business entities.
The Smart Client Software Factory reference implementations contain examples of business modules. In the Branch Client reference implementation, the BasicAccounts.Module, BranchSystems.Module and CreditCardAccounts.Module projects are business modules. These modules encapsulate the logic for the different types of back-end financial systems. For example, the BranchSystems.Module module contains business logic to manage a queue of customers. This logic includes determining the user interface elements to display based upon the current user’s role.
When you use the Smart Client Software Factory to create a business module, the Add Business Module recipe creates both a Module class and a ModuleController class. As with all Composite UI Application Block modules, the Module class derives from the ModuleInit class. In the Load method of the Module class, the recipe generates code to create a new ControlledWorkItem and add it to the application WorkItem hierarchy, as shown in the following code.
C#
public override void Load()
{
base.Load();
ControlledWorkItem<ModuleController> workItem =
_rootWorkItem.WorkItems.AddNew<ControlledWorkItem<ModuleController>>();
workItem.Controller.Run();
}

Foundational Modules
A foundational module is a module that either provides services to the shell and other modules, provides a layout, or both. It does not implement a use case or contain a WorkItem.
In the Branch Client reference implementation, the BranchSystems.Layout and Infrastructure.Module projects are foundational modules. The BranchSystems.Layout module does not contain a WorkItem (there is no ModuleController class). Instead, it contains a view to provide the layout of the shell form’s user interface. The Infrastructure.Module module provides services (for example, caching) to other modules in the application.
Jan 25, 2007 at 5:23 PM
I am studying the same question. Here is my understanding:

1. The Business Module deals with a Use case, it is easy to tell when you want to use it. You will have to solve a lot of use case in your app, so most time you create the individually deployed, loosely coupled Business Module.

2. The major difference between BM and FM is FM doesn't have WorkItem. The SCSF doesn't create the ModuleController for FM. Why, because it doesn't deal with any Use Case, but can be used cross all other(or some) Use Cases.

FM should contains Shell related services such as Security Service, Web Service and all other base services. It will be loaded automatically when shell starts.

By the way, you can create as many FM as you want.