repainting the form or create another form?

  • Thread starter Thread starter rs
  • Start date Start date
R

rs

I wonder, performance wise, if it is better to have one form and repaint the
components on that form or to have mutiple forms and show and dispose them?

Thanks
 
I think it depends on the kind of the app u are constructing and also depends
on its size. Have in mind the inheritance that could be useful and try yo
organize your code in modules, etc; many smallsize files (like java classes).

Hope i made myself clear.
 
rs said:
I wonder, performance wise, if it is better to have one form and repaint
the components on that form or to have mutiple forms and show and dispose
them?

User experience is most important. So, if it's impossible to separate
things without confusing the user or making him/her less productive, keep
everything on one form, otherwise split up the form into multiple
forms/dialogs.
 
rs,
In addition to the other comments.

I would create multiple forms, show & dispose them, simply as that normally
would be the greatest chance of leveraging encapsulation. Remember
encapsulation is one of the tenants of OO. If there is common logic I would
consider a base form & inheriting from that, again encapsulation &
inheritance. Remember that inheritance is another tenant of OO.

Performance wise: I would apply the 80/20 rule & more IMHO more importantly
consider user perception of performance!


Remember that most programs follow the 80/20 rule (link below) that is 80%
of the execution time of your program is spent in 20% of your code. I will
optimize the 20% once that 20% has been identified & proven to be a
performance problem via profiling (see CLR Profiler in my other message).

For info on the 80/20 rule & optimizing only the 20% see Martin Fowler's
article "Yet Another Optimization Article" at
http://martinfowler.com/ieeeSoftware/yetOptimization.pdf

Hope this helps
Jay
 
sorry guys, I forgot to mention few things:

I am building a MDI application with treelist at the left side and a tool
bar at the top.

in the middle area the application shows one form at a time. What I wanted
to know, if it is better to have one form and add the components to the form
using code or create for example 6 forms and dispose and show them within
the main form

Thanks

Ahmed
 
rs,
Same answer.

6 forms, show & dispose them. (again encapsulation).

Depending on the nature of the forms, you can consider hiding rather then
disposing...

Again if the 6 forms have common logic I would consider inheritance.
I am building a MDI application with treelist at the left side and a tool
bar at the top.
Are you thinking a real *Multiple* Document Interface (MDI) app, or are you
thinking more along the lines of "Tools - Options" in VS.NET? Where when you
select a node in the tree & the "page" displays different controls? Where
there is only a single "page" displayed at a time.

For an VS.NET "Tools - Options" type app I would consider using 6
UserControls instead of 6 form. Where each UserControl encapsulates the
logic for 1 specific "page". I would either show & hide or create & dispose
of the UserControls, or possibly consider a delayed create & hide...

Hope this helps
Jay
 
Jay B. Harlow said:
rs,
Same answer.

6 forms, show & dispose them. (again encapsulation).

Depending on the nature of the forms, you can consider hiding rather then
disposing...

Again if the 6 forms have common logic I would consider inheritance.

Are you thinking a real *Multiple* Document Interface (MDI) app, or are
you thinking more along the lines of "Tools - Options" in VS.NET? Where
when you select a node in the tree & the "page" displays different
controls? Where there is only a single "page" displayed at a time.

For an VS.NET "Tools - Options" type app I would consider using 6
UserControls instead of 6 form. Where each UserControl encapsulates the
logic for 1 specific "page". I would either show & hide or create &
dispose of the UserControls, or possibly consider a delayed create &
hide...

That exactly what I am trying to do. Thats why I was hesitant in creating
more than one form. It seems the 6 controls then is what i am looking for.

thanks Jay and everyone. I really appreciated.
Ahmed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top