-
question on best programming option
I've got a question for you guys. You probably know more about using system
resources than I do. I'm converting the software I developed from VB6 to
VB.Net and I'm looking at an option of either designing all the different
forms (about 30) at design time ___ or ___ making a base form (base class)
and creating new instances of that form and populating them with controls
at run time. The first option is what has already been developed. I was wondering
if creating the forms at run time dynamically would be better than doing
it at design time. I know it will make the application smaller in size but
do you have any idea if it will adversely affect the system resources???
Here's a recap of the question:
Currently the program is written in VB6.
I am re-writing the program in VB.Net (and most likely C# as well after).
I want to find a way to shrink the program down (has about 30 data forms).
current programming options:
1) Leave style as is and design every form at design time.
2) Make a base form; create new instances of this base form (class)
at run time and populate them then, keeping track of them in a collection
class that inherits this base class (base form).
overall question: which option would be better, more efficient maybe?
Besides the data forms mentioned about (20-30) I have already programmed
the MDI portion along with 4 other of the communications forms need for the
app. I like VB.Net a lot and from looking at C# a little, I think I'm gonna
like it too. I've been learning a lot trying to program this application
so far. The reason I'm thinking of the second option is that all of the panels
have the possibility of using the same for types of control, but different
quantities of each. The four controls are textboxes (in all), labels (all),
checkboxes (only some), and 1 command button (only some). The base form
would have only the command button and some textboxes and labels that are
common to all data forms. The command button would be made invisible for
those panels that don't need it.
If anyone has any thoughts on my question I'd appreciate the input.
James
-
Re: question on best programming option
James,
Your "Base Form" idea is goos. But why don't you consider inheriting your
other forms from it?
What I suggest is:
1) Make a Base-Form (consisting of just the basic, common controls and the
functionality related to 'em)
2) Inherit other forms from this - adding much specific functionality to
each. At least the common buttons, textboxes etc won't be re-coded in these
forms.
3) Override/Overload your existing functionality from Base-Form (class) and
code it the form-specific way.
By doing this you are both saving your comon code from being re-written and
making the whole approah (architecture) re-usable. Your adding-coltrols-at-run-time
option was equally re-usable, but lacking the traditional OO flavor. Moreover
you had to call some common functions (codes in some third class) to add
controls at runtime and maintain that collection object separately.
Think about this. Mine is just a superficial suggection. But I feel going
the OO way would definitely be good for you..
HTH
Cheers
Rohit
"James" <wolfjj79@sbcglobal.net> wrote:
>
>I've got a question for you guys. You probably know more about using system
>resources than I do. I'm converting the software I developed from VB6 to
>VB.Net and I'm looking at an option of either designing all the different
>forms (about 30) at design time ___ or ___ making a base form (base class)
>and creating new instances of that form and populating them with controls
>at run time. The first option is what has already been developed. I was
wondering
>if creating the forms at run time dynamically would be better than doing
>it at design time. I know it will make the application smaller in size but
>do you have any idea if it will adversely affect the system resources???
>
>Here's a recap of the question:
>
>Currently the program is written in VB6.
>
>I am re-writing the program in VB.Net (and most likely C# as well after).
>
>I want to find a way to shrink the program down (has about 30 data forms).
>
>current programming options:
>1) Leave style as is and design every form at design time.
>2) Make a base form; create new instances of this base form (class)
>at run time and populate them then, keeping track of them in a collection
>class that inherits this base class (base form).
>
>overall question: which option would be better, more efficient maybe?
>
>Besides the data forms mentioned about (20-30) I have already programmed
>the MDI portion along with 4 other of the communications forms need for
the
>app. I like VB.Net a lot and from looking at C# a little, I think I'm gonna
>like it too. I've been learning a lot trying to program this application
>so far. The reason I'm thinking of the second option is that all of the
panels
>have the possibility of using the same for types of control, but different
>quantities of each. The four controls are textboxes (in all), labels (all),
>checkboxes (only some), and 1 command button (only some). The base form
>would have only the command button and some textboxes and labels that are
>common to all data forms. The command button would be made invisible for
>those panels that don't need it.
>
>If anyone has any thoughts on my question I'd appreciate the input.
>
>James
-
Re: question on best programming option
Thanks for your thoughts Rohit. I'm still a little undecided about which would
be better but I think I'll try it the OO way you suggested. It seems to be
a little easier than the other, but I'm not going to throw the other one
away just yet.
Does anyone else have any ideas?
Thanks again,
James
"Rohit Wason" <rohitw@ggn.hcltech.com> wrote:
>
>James,
>
>Your "Base Form" idea is goos. But why don't you consider inheriting your
>other forms from it?
>
>What I suggest is:
>
>1) Make a Base-Form (consisting of just the basic, common controls and the
>functionality related to 'em)
>2) Inherit other forms from this - adding much specific functionality to
>each. At least the common buttons, textboxes etc won't be re-coded in these
>forms.
>3) Override/Overload your existing functionality from Base-Form (class)
and
>code it the form-specific way.
>
>
>By doing this you are both saving your comon code from being re-written
and
>making the whole approah (architecture) re-usable. Your adding-coltrols-at-run-time
>option was equally re-usable, but lacking the traditional OO flavor. Moreover
>you had to call some common functions (codes in some third class) to add
>controls at runtime and maintain that collection object separately.
>
>Think about this. Mine is just a superficial suggection. But I feel going
>the OO way would definitely be good for you..
>
>HTH
>Cheers
>Rohit
>
>
>"James" <wolfjj79@sbcglobal.net> wrote:
>>
>>I've got a question for you guys. You probably know more about using system
>>resources than I do. I'm converting the software I developed from VB6 to
>>VB.Net and I'm looking at an option of either designing all the different
>>forms (about 30) at design time ___ or ___ making a base form (base class)
>>and creating new instances of that form and populating them with controls
>>at run time. The first option is what has already been developed. I was
>wondering
>>if creating the forms at run time dynamically would be better than doing
>>it at design time. I know it will make the application smaller in size
but
>>do you have any idea if it will adversely affect the system resources???
>>
>>Here's a recap of the question:
>>
>>Currently the program is written in VB6.
>>
>>I am re-writing the program in VB.Net (and most likely C# as well after).
>>
>>I want to find a way to shrink the program down (has about 30 data forms).
>>
>>current programming options:
>>1) Leave style as is and design every form at design time.
>>2) Make a base form; create new instances of this base form (class)
>>at run time and populate them then, keeping track of them in a collection
>>class that inherits this base class (base form).
>>
>>overall question: which option would be better, more efficient maybe?
>>
>>Besides the data forms mentioned about (20-30) I have already programmed
>>the MDI portion along with 4 other of the communications forms need for
>the
>>app. I like VB.Net a lot and from looking at C# a little, I think I'm gonna
>>like it too. I've been learning a lot trying to program this application
>>so far. The reason I'm thinking of the second option is that all of the
>panels
>>have the possibility of using the same for types of control, but different
>>quantities of each. The four controls are textboxes (in all), labels (all),
>>checkboxes (only some), and 1 command button (only some). The base form
>>would have only the command button and some textboxes and labels that are
>>common to all data forms. The command button would be made invisible for
>>those panels that don't need it.
>>
>>If anyone has any thoughts on my question I'd appreciate the input.
>>
>>James
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks