--- Begin Message ---
Subject: |
problem with UI/logic separation |
Date: |
Sun, 15 Feb 2004 23:28:54 +0100 |
User-agent: |
Mutt/1.3.22.1i |
What's the "best"/accepted way to deal with this: non-GUI code
needs to make GUI functions run but has no good way of simply
returning with an error so that the (GUI level) caller can
take appropriate action ?
Specific situation:
gmClinicalRecord.__init__() tries to make sure there is an
active/ongoing encounter. If it finds one with an age between
the soft time-to-live and the hard time-to-live it must ask
the user whether to consider that one as still active or to
proceed with creating a new encounter ...
There are several options:
- do away with soft/hard timeouts (undesirable)
- only use hard timeout on __init__ (flawed)
- decompose into __init__ and init_encounter() which can
return error codes (cumbersome, undesirable)
- provide __init__ with a callback function for asking
questions at the UI level (doesn't feel clean)
- just fail the __init__ constructor and let the caller handle
the error (cumbersome to fail __init__ specific enough to
let the caller know what to do)
What's your suggestion ?
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
--- End Message ---