Friday, June 20, 2008

Business Module, Foundation Module and Page in Web Client Software Factory v1.1

Dear all,

It has been some time I have not posted anything about web client software factory as I was busy with my rl work. Web Client Software Factory is my favourite tool when creating a web client. I suggest everybody should give a try on it.

Recently, I have given a sharing session about Web Client Software Factory for a bunch of interns who are about to graduate from university (Multimedia University) and I realized I should continue writing more about it so that it can help others to get more details on what exactly WCSF does.

If you do not know what Web Client Software Factory is, please visit Introduction to Web Client Software Factory post to have some kick starts. Web Client Software Factory uses Model-View-Presenter architectural pattern to encourage reuse of the individual User Controls (referred to in CAB as "SmartParts") by not coupling them with their underlying data elements or presentation code.

The structure will look like this:

Page <--> Presenter <--> Controller

In this post, I will cover a few essential fundamentals about WCSF.
1.) Business Modules
2.) Foundational Modules
3.) Page/View

1.0 What is a Business Modules?
Business Module is a type of Module that encapsulate a set of concerns of the application at Module Level. The logics created in a particular business module will be shared accross the module. When a user create a business module in WCSF, a default web page will be created under the website node in the module name's folder.

Files Created by WCSF:-
Website Node: a folder named as the module name which contains a web.config, Default.aspx and Default.aspx Code Behind.
Module Node: a folder named as the module name which contains a Presenter Class file for Default.aspx, and View Interface for Default.aspx, Controller Class file and ModuleIntializer Class file.

1.1 How to Create a Business Modules
To Create a Business Module, select the MODULE node and right Click. You will notice a menu item named "Web Client Factory". Click on it and Select "Add Business Module (C# or VB)".

An add business module wizard will appear:-
1.) Add New Project: Give a name to the module and give a path(if it is different from the default).
2.) Module Details: Check the checkbox for Unit Test if you require it.
3.) Click Finish.
4.) Debug it and you will notice a new menu named as the module name added into the website.

2.0 What is Foundational Module
It is quite similar to Business Module, but it does not allow you to create Page/View under this module. Which means, Foundational Module does not have Presenters nor have Controller. It also will not create a folder with default page in the website node like how Business Module does. The set of concerns that encapsulate in this type of module is shared across the whole application. Usually, Global services are created in this module and each application will have only 1 foundational module.

2.1 How to create a Foundational Module
To Create a Foundational Module, select the MODULE node and right Click. You will notice a menu item named "Web Client Factory". Click on it and Select "Add Foundational Module (C# or VB)".

An add foundational module wizard will appear:-
1.) Add New Project: Give a name to the module and give a path(if it is different from the default).
2.) Module Details: Check the checkbox for Unit Test if you require it.
3.) Click Finish and Verify it at the MODULE node.

3.0 What is a Page/View
Page is a web page so it has .aspx extension and a Code Behind Class file. User can add UI elements to a page.

3.1 How to Create a Page
To create a page, you need to consider which business module it belongs to. For instance, a CreateMember.aspx will fall into Member module or it is directly under the root node (Website node).
1.) Right click on the module folder under the website node or right click on the root node
2.) Select "Web Client Factory" and Click on Add a View(C#/VB).

a Wizard will be appeared and Change the name for the particular View and click Finish.

You will notice that (for e.g CreateMember) a CreateMember.aspx created under the Member folder(if it is created in Member folder), and under the Member module, CreateMemberPresenter and ICreateMemberView are created.

I hope this will give you more understanding on how Web Client Software Factory does.

No comments: