[Uml-devel] [Bug 107347] program design: separation of responsibilities

Oliver Kellogg okellogg at users.sourceforge.net
Mon Mar 27 11:01:03 UTC 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=107347         
okellogg users sourceforge net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Various application design  |program design: separation
                   |issues                      |of responsibilities



------- Additional Comments From okellogg users sourceforge net  2006-03-27 21:00 -------
At http://www.geeksoc.org/~jr/umbrello/uml-devel/9363.html,
Daniel Calviño Sánchez <danxuliu_at_gmail.com> wrote:

> I'm adding an option to the "Export all views" action 
> (http://bugs.kde.org/58809) and I have some questions about code 
> style. The option I'm adding is keep the tree structure used to store 
> the views in the document in the target directory, so if you have your 
> diagrams in folders created by you in the document, those folders are 
> created when exporting (Logical view, use case view and so on aren't 
> created).

Interesting. Sounds like there might be some overlap with
http://bugs.kde.org/87252

> In order to add that option, I've also refactored a bit the 
> ExportViewAction class and the exportImage() method in UMLView. I've 
> made a class, UMLViewImageExporter, that contains the methods that do 
> "all the work", and that class is used by other methods that take care 
> of asking the user where to save the image, the format to use, and so 
> on. 
> 
> The problem is that the non-interactive methods can fail due to 
> various things. So I thought in throwing exceptions and catch them 
> where they were called so an information message is shown to the user 
> if needed (for example, if the exporting was made through 
> command-line, the message box wouldn't be shown). 
> 
> But, after a search, I found that no exceptions are thrown in Umbrello 
> code (at least, I haven't found them). So, the question is, can I use 
> exceptions? Or maybe I should think in another way to report errors 
> (with return values, for example)? I mean, perhaps you don't use 
> exceptions because of compiler compatibility or something like that. 

True, Umbrello has not been using exceptions - mainly due to old-compiler
concerns. (Should be less of an issue nowadays.) OTOH I'm not sure
how Qt and KDE get along with exceptions. So to be on the safe side
I'd still recommend return values instead of exceptions.

> The other question is related to where put the interactive code. Right
> now, the "Export view" action code is in UMLView class. The "Export
> all views" action is in ExportViewAction class, which is a KAction 
> subclass. I think that the UMLView class code should be extracted to 
> another class, maybe another KAction subclass. 

True, UMLView has too much stuff lumped in; the same goes for UMLApp,
and UMLDoc should be eliminated altogether (see discussion at top.)

> Or maybe you prefer the UMLView code to stay there and move the 
> ExportViewAction code to UMLApp. Or maybe let it as it is now. But I 
> think that it'd be better if a more consistent approach is used than 
> an action for the "Export all views" and embedded code in UMLView for 
> "Export view". 
 
I'm renaming the bug title to "separation of concerns" exactly for this
reason that we start thinking about the global objects in the program.
For example, it may well be that ExportViewAction deserves its own,
standalone global object (the same might be true for Undo/Redo and
other entities.) It's not clear to me why UMLApp should need to be
the container for all global objects; if somebody knows please explain.




More information about the umbrello-devel mailing list