Monday, November 19, 2007

How OTK Custom dbInstaller 2.0 achieves high flexibility and stability with MVP


As some of you may already know that, Model-View-Presenter (MVP) is a design pattern that cleanly separate the concerns between UI (View), UI-data interaction logic (Presenter), and your data logic (Model). If you came across with Web Client Software Factory (WCSF), you may notice that when you added a specific business module, guidance automatioin will create a presenter class for you for each page view. However, that doesn't mean that in MVP, you can only have one presenter for one view. In fact, you can have one presenter for multiple views. This is what dbI 2.0 alpha is currently implementing now.

If you browse through the OTK Web Community photos, you will notice quite easily that dbI 2.0 is actually providing a wizard-like database installer to facilitate the database deployment tasks of your enterprise applications. What you may not notice is that, one of the great features that dbI wanted to achieve is to allow the developers to easily take out/incorporate in any wizard dialog steps with any combinations for different usage and target users. Developers can decide which steps they want to allow the users to customize for the installation of their application's database and which they do not.

In order to achieve that, dbI 2.0 needs to find a way to separate the concerns between the dialog specific logics and cross-dialog standard logics so that the common logics do not need to be repeated on each form. Duplicating the same logic across multiple forms may introduce bugs as well as making the programs very hard to maintain.

(NOTE: The 'cross-dialog standard logics' involve the manipulation of those common form controls together with some function calls from the data object, which may not be easily achieved a clean SoC by creating common class.)

Therefore, to tackle this issue, we do the following:


  1. First of all, we got to identify what are standard UI components that available on every wizard dialog. Then we create an interface called IWizardView that exposes these standard UI objects as properties.

  2. Then we implement IWizardView on each of the wizard dialog boxes. Now every form will have all these common controls exposed as its public properties.

  3. We now create a presenter class called InstallerPresenter, having one of its property as the type of IWizardView and its associated private variable called _wizardView.

  4. Meanwhile, we also make the presenter's constructor to accept a parameter of type IWizardView and get the parameter value assigned to _wizardView.

  5. Back to each wizard form, we want the presenter class to be created once the Form object is created. Hence, on each form's contructor, we do the following:

    _presenter = New InstallerPresenter(Me)

    where 'Me' is the form itself.
Since the constructor's parameter is just an interfance but not the form, we can say that the presenter does not have the knowledge of the specific form but just the "rules" that it can accept, i.e. the IWizardView interface. Through this way, the presenter will therefore can serve multiple forms with its logic as long as each form is implementing the IWizardView interface.

Here, I also want you to take note that, in order to implement MVP design pattern, it is not necessary that you need the ObjectBuilder (for Dependecy Injection purposes) as proposed by WCSF. It is optional and just a nice-to-have feature that will further pushing the loosely-coupled practices into extreme.

Friday, November 2, 2007

Solving ReportViewer Rendering Issue on IIS7

Applies to:

  • Internet Information Services 7.o (IIS7)
  • Microsoft Report Viewer Redistributable 2005
Symptoms:
  • Unable to render ReportViewer on ASP.NET Web pages while running on IIS7.
  • You have no problem viewing your reports when running on debug mode with your Visual Studio 2005.
  • You are able to view your reports on Report Manager but not able to view them on IIS7.
  • You encounter JavaScript error when loading your report page with ReportViewer. Image buttons such as calendar appear as red 'X'.

Cause:

  • When the ReportViewer control is added to Web Form (.aspx), the
    Reserved.ReportViewerWebControl.axd httpHandler is added to System.Web section of the Web.Config file. In IIS7, it should be added under System.Webserver section.
  • IIS7 Handler Mappings does not contain Reserved.ReportViewerWebControl.axd httpHandler, and therefore unable to render the ReportViewer elements needed by the JavaSript.

Resolution:

  • Open Internet Information Services (IIS) Manager and select your Web application.
  • Under IIS area, double-click on Handler Mappings icon.
  • At the Action pane on your right, click on Add Managed Handler.
  • At the Add Managed Handler dialog, enter the following:
    Request path: Reserved.ReportViewerWebControl.axd
    Type: Microsoft.Reporting.WebForms.HttpHandler
    Name: Reserved-ReportViewerWebControl-axd
  • Click OK.

Reserved-ReportViewerWebControl-axd handler is now added to your Handler Mappings list. Notice that the following line has also been added to your Web.config file under the system.webserver's handler section:


<add name="Reserved-ReportViewerWebControl-axd" path="Reserved.ReportViewerWebControl.axd"
verb="*" type="Microsoft.Reporting.WebForms.HttpHandler" resourceType="Unspecified"
/>

Run your report again.

Sunday, March 11, 2007

People-Process-Technology:
My Belief in Successful Software Business


By looking at the subject title, some may say that: "Antonio, you're not the only one who believes this, everybody believes this also." Yes, but perhaps they will believe more of it only at the moment when they looking at this diagram -- People-Process-Technology.

I observed quite a number of software companies almost a decade, some succeeded, some failed. Those succeeded usually taking care of the balance of these three great areas, that is people quality, process quality, and technology quality. These three components are interlinked together, supporting each other, in achieving common business goals. But why People Quality as the top-most priority? Reason: At the beginning, Process and Technology do not create themselves but human does. Human defined the processes and invented the technology. Therefore, the quality of the process and technology is very much depending on the human quality, the creator's quality. How the creator behaves, how the creator thinks, are all reflected on the process and technology invented by them.

However, good business processes and technologies may help producing good people. How? For example, Software Engineering Institute (SEI) may have good people that are capable of developing great process improvement methodologies that many software companies through out the world may be able to benefit from it -- Capability Maturity Model Integration (CMMI). Therefore, if you think you do not have people who are good enough to come out with a good process for the company businesses, you can adopt CMMI. By properly adopting CMMI, you may be able to influence and improve your people quality.


The same lies to implementing great technology in your company. Your people may not be able to invent fantastic new technology for your company to be more competitive. But if you willing to bring in external expertise or adopting proven design patterns and practices brought to you by some of the successful software companies, this may help improving your people quality because they can learn from them while implementing them. In terms of business process quality, technology quality may have direct contribution on it. For example, you may want to have unified and integrated business process model but do not know how. In that case, software tools and platform like Microsoft Office SharePoint Server 2007 may be able to help by providing Business Intelligence, Workflow, Document Sharing, Version Control, Wikis, Blog, Issue Tracking System and so on, all integrated, which eventually bring you a high-efficient and productive business collaboration platform.


As you can see, People-Process-Technology are tightly integrated. In Chinese, I describe it as "三者缺一,无计可施", namely, by lacking either one of these three components, there will be no clue for us to come out with a good strategy. So, if you have not done so, try to review your current company policy, culture, and philosophy -- Are they focus on the balance of these three key factors that determining the success of your company? If not, it is time to "refactor" it!


Thank you.


Antonio Ooi
Founder & Software Architect
OTK Web Solutions
"Zero Compromise, Our Inspiration"