Re: Separating code from UI
- From: "Larry Serflaten" <serflaten@xxxxxxxxxxxxxx>
- Date: Tue, 4 Mar 2008 07:52:04 -0600
"MP" <NoSpam@xxxxxxxxxx> wrote
with the philosophy of decoupling ui from business logic in mind,
What is the preferred way for the "remote" proc to communicate back to the
form?
The first thing I would mention is not to get too carried away with some
philosophy that it makes your design significantly more difficult. If you
have code that interacts with 'the' form you call it from, then it should
probably be in the same module as all the other code for that form.
If you have (as you possibly intended) a routine that may be called from
several different places, different forms, (whatever) then consider returning
your value(s) from a function, or raising events from a class.
When you talk about decoupling, you should be thinking 'black box'
barriers where one knows nothing about the other except through the
public interface.
While I wouldn't disagree with passing in a lable to provide updates
(or whatever) I would suggest that such a parameter creates a dependancy
which makes it not so 'decoupled' anymore....
Had you wrapped your routines in a class and provided a Cancel routine,
as well as the progress 'event', I'd say that would be moreso 'decoupled'.
FWIW, YMMV...
LFS
.
- Follow-Ups:
- Re: Separating code from UI
- From: MP
- Re: Separating code from UI
- References:
- Separating code from UI
- From: MP
- Separating code from UI
- Prev by Date: Re: Error handling in VB6
- Next by Date: Re: Showing Excel Taskbar while useform is open
- Previous by thread: Re: Separating code from UI
- Next by thread: Re: Separating code from UI
- Index(es):
Relevant Pages
|