PDA

Click to See Complete Forum and Search --> : Visual Inheritance


Lethal
Apr 23rd, 2003, 06:17 PM
Ok, I finally have an opportunity to take advantage of Visual Inheritance. I have a form that allows simple add/update/delete functionality, as well as navigating through the records (move next, previous, first, last). I have about 20 screens that all have the exact same look and feel, except for a few minor things. Here's the thing. I can't decide whether or not to add any functionality to the base form, for example, all of the navigational functionallity, which may make the base form not generic enough, and too tightly coupled.

Maybe, have a base form that has the look and feel, then a form that extends the base to add the basic navigational functionality.

Any thoughts?

hellswraith
Apr 23rd, 2003, 11:46 PM
I think that we could make object hierarchies that are huge if we want to to get totally abstraction, but I think sometimes we can go too far.

Look at from this perspective. Will you be using the different forms you create in other projects? Is it possible that you will want a form with just the look and feel without the navigational functionality? If so, yes seperate it. But if the possibility is highly unlikely, you will end up creating more than you really needed to.

Thats my thoughts on it though, I am very inexperienced though, so what do I really know...lol. I just know that sometimes I am going way to far when creating object hierarchies, and just create more work for myself.

shutty
Apr 24th, 2003, 06:10 AM
I always look at it from a maintainability point of view. If you have 20 screens and each has it's own set of navigation buttons, and you want to, say, add a new navigation button that is shown on all of them, then you have 20 forms that require code change. If the buttons are on one base form then you only make the changes in one place.

I agree that you can get too bogged down in abstraction and a happy medium must be achieved.

Perhaps you can have a few 'base' types .i.e.

'Abstract Base Classes
Public MustInherit Class genericform : Inherits System.Windows.Form
Public MustInherit Class navigationform : Inherits genericform

'Concrete classes
'Form without navigation
Public Class myCustomGenericForm : Inherits genericform
'Form with navigation
Public Class myCustomNavForm : Inherits navigationform