Article on MVC

This is a great article on MVC.

It covers MVC and a lot of related patterns.

It is very hard to find articles that go beyond the basics.
For example what is the best practice to allow multiple controllers to interact?
How do you decouple the database from the model?

Is it possible to reuse a controller between a windows form and a web site for a non-trivial application?

Composite Model

Over the last year and a half I have been working on a Composite Model Framework.

This uses:

  • Smart Types” for model attributes (A smart type is a primitive type that knows that it has been set and changed),
  • Explicit attached “business rule objects”
  • Rules can navigate the model using xslt

Use of the composite pattern for the model makes for a very robust model component (rules can survive the addition of nodes above them in the tree).  This is very easy to self check, maps directly to requirements, has a single obvious implementation point for almost any functionality to be added.

One of the key points is that the model is responsible for holding data, validating data and performing other buisiness functions.  The model is not responsible for data persistance.

The components of the system are:

Model (M)
View (V)
Controller (C)
Data Access Layer (D)

Typically the controllers constructor has a signature of C(M,V,D).
This allows us to keep the Model independent of the database and the View.

Most business rules belong in the model – the exceptions being referential integrity and uniqueness constraints that have to be on the database.

Literate User Interface

I have been writing a user guide for the data entry section of a website.
I had copied some of the links from the site into the document.

One of the users mentioned that is the userguide available on the website?
That got me thinking – why not embed the user interface for infrequently used code into the user manual?
The users will not fail to find the documentation and it will encourage the developer to keep the documentation upto date.

User Hostile User Interfaces

I have had the pleasure of trying to make the VB6 Package and Deployment wizard work.

I know that this is 10 years old but given that I had to learn Clipper earlier this year…

The package and deployment wizard is the tool supplied with VB6 to bundle up the executables and create an installation package.  This is theoretically quite straightforward until you try to make some obvious changes.  For various configuration reasons the location of the package file has moved drive.  Not a big deal – I should be able to use the UI to edit the attached resources and move them.  However you can remove exiting items but if you try to add it it complains that the file already exists.  So I go through the process and output the package creation file.  The package creation file is simply and INI file – a text document containing name=value pairs within [Section Name] blocks.  Great – a quick search and replace later and the files to good to go.  Reload the package deployment wizard and it fails to start with a 457 error.  It turns out that the PDW will write distinct entries to the file that it can’t display.  If you have items that have repeated keys that differ only by case then it will not load.  Previously this had been hidden due to them being on different drives – after the search and replace the names mix up.  It takes a lot of sorting of sections and careful comparisons to eliminate the duplicates.

Fully service packed applications at version 6 need to be more stable than this.

VB6 References are also a nightmare.  You use the reference form to select the new location to set them.  However until you close and reopen the Reference list the origonal location is displayed.  Great example of WYSAWYG.

VB6 Build before debug – this will happily say that the application is fine.  Try the make option and it is a different story.

sed and grep save the day

I use thunderbird for one of my less recently used email accounts – I get a lot of spam.

I was trying to use a website to fill in a survey  but I forgot my password so they emailed it to this email account.

Of course the email goes straight into the spam folder.  This is rather large and I cannot browse it.

Easy solution: copy  the Junk file to my linux box.

Find the location in the file of the retailer:

grep -in retailer Junk

This lists the location in the file of the retailer.

The first entry was on line 920123 

sed -e”1,920000d” Junk > Junk.tail

I can now edit Junk.tail and find the temporary password.

Can you find a quicker solution? 

Windows Developer Power Tools

This is a great book.  It provides descriptions, why to use and how to use guides for over 170 free windows devlopment tools.  Scott Hanselman provides the foreward.

 It has its own website.

I can definately see myself plugging several of the tools myself.

For example I have used, but forgotten about SourceMonitor. This allows analysis of an entire codebase to allow detection of excessively long methods, overlyly complex methods, uncommented code.

VB6 is dying

VB6 was consider flexible largely due to the suite of third party controls available.

Out of the box VB6 was always much weaker than it’s rivals.

The problem is that while MS will be releasing the VB6 runtime for the foreseeable future, I can’t see the add on developers maintaining VB6 versions indefinately.  For example certain grid controls are no longer supported and the documentation is unavailable.