Creating a base presenter class - good idea?

Topics: Web Client Software Factory, UIP Application Block discussion, User Forum
Nov 29, 2008 at 7:40 PM
Greetings,

One of our team members has suggested the possibility of creating a base class that our presenters could extend. The base class would contain functionality commonly used across our presenters.  Individual presenters would extend the base class by adding their own specific needs.  Is this an approach that sounds like a good idea and has anyone out there taken the same approach?  What are the pros and cons of creating the base presenter class?  Would it be a better idea to encapsulate common methods and properties in a class in a foundational module?  We are new and desiring to take a best-practices approach, so any advice you can provide will be greatly appreciated.

Thanks,
BCB
Coordinator
Dec 1, 2008 at 1:39 PM

Hi

 

If you have common functionality in your presenter classes it is a good idea to place it in a base class which will be inherited by all your presenters, to avoid code duplication. To do this, you could create a common library project and reference it in all your modules to have access to the base presenter class in each of them.

 

Please let me know if this helps.

 

Damian Schenkelman

http://blogs.southworks.net/dschenkelman
Dec 2, 2008 at 2:39 PM
Hi Damian,

Thanks for your helpful response to this and other questions.  I'd like to ask where you would physically place the common library project.  Would you place the project inside a business module or foundational module or would you set it up as a project "outside" any of your modules?  Would it make sense to put the base class in the Shell project?  What if the base class is used across business modules?

As you can probably tell, I'm grappling with some basic design and organizational issues.  Do you know of any good web-based articles that address partitioning and organizational aspects of a WCSF solution?

Thanks-
Coordinator
Dec 2, 2008 at 3:53 PM

Hi

 

The common library project should be independent, placed “outside” all modules. Remember that modules are also projects, so it would not be possible to add the library project inside a module.

To make the base class available in a business modules you should add a reference to the class library project that contains the base presenter class in each of the modules.

 

Perhaps this series of articles could give you some more insight about Modularity in WCSF:

·         Modularity Guidance

 

You might also find handy the WCSF KB which is a compilation of articles on different topics of the WCSF. Some of them could be useful while developing your application.

 

Please let me know if this helps.

 

Damian Schenkelman

http://blogs.southworks.net/dschenkelman