tags:

views:

11

answers:

2

I believe this mostly applies to custom dialog boxes being put into DLLs, but I'm sure there are some outlying situations I haven't thought of. Is there ever a reason for a DLL (besides perhaps a Control Library) to display dialog boxes, popups or other GUI elements? I see that it takes away control from a developer using that library, by circumventing the developer and passing the decision directly to the user, but are there situations where this might be a valid design? Or is it strictly bad design?

A: 

I believe that using the exception mechanism is the best way to go here.

thelost
+1  A: 

Why would it be bad?

Obviously, it would be bad if non-GUI layers of your application such as a data abstraction layer or business logic would try to display UI elements directly because this contradicts the layered architecture and limits the reuse of components.

However, a dll does not necessarily correspond to a logical or functional application layer, it is a deployment unit that can contain about anything from resources to code to graphical elements. In fact, you might want to bundle business logic and GUI in a single dll, e.g. when you create and deploy an application extension.

0xA3