|
From: David G. <dg...@co...> - 2003-08-06 12:20:11
|
Hi Dejan, My opinion is to avoid multiple exit points in programs where possible, even though this is a trivial case and probably won't make much of an impact. As an alternative, what about throwing an ApplicationExit() exception that can be caught by BabeldocCommand to exit? If you think this is overly complicated, then I'm fine with System.exit() in printUsage(). I also agree that the current classes that extend BabeldocCommand should be refactored; I've discovered at least one side effect that is causing problems in Scanner, and will probably lead to further problems elsewhere in the future. Responding to your questions with questions of my own: 1. I'm not yet very familiar with the structure of the program, but if BabeldocCommand is made abstract, what happens when the user types "babeldoc -h" ? In this instance (heh, heh), will a BabeldocCommand class be instantiated? 2. I agree with this point. It seems that the purpose of the current implementation is to perform some common pre-processing for all the tools, and I think that it would be relatively easy to restructure things so that the 'Hollywood Principle" applies (this principle, as detailed by the great and wise Dejan Krsmanovic in his excellent programming book "How Your Lousy Programming Is Helping Me Retire to a Life of Sin and Decadence", describes some of the fundamental reasons that he's rich and we're not). 3. I think this is generally good programming practice, and makes it much easier for those trying to understand the implementation of the system (i.e. me). David On Wednesday 06 August 2003 2:27 am, Dejan Krsmanovic wrote: > After looking at code you have commited I doubt if this is really good > solution... Since h option belongs to parrent class, BabeldocCommand, I > guess that class is right place for handling this situation, otherwise, all > other commands might need dealing with it. So, what do you think about > having System.exit call inside printUsage method? > > Also, some refactoring is probably needed inside BabeldocCommand class. > There are few things that I don't like right now: > 1. This should be abstract class, right? Making BabeldocCommand instance > does not make a sence. > 2. We should not expect that subclasses will call super implementation when > overide some method. For example in current implementation, subclass should > call super.execute() when overriding execute() method. Better solution > would be "Don't call me - I'll call you!" (Hollywood) principle. That is, > BabeldocCommand should have one method, for example > executeBabeldocCommand() that should call abstract execute() method. That > way, subclass will be forced to implement execute(), and it should not > worry about super implementation if it does not need to change default > behaviour. > 3. We should make all methods that subclasses need to implement abstract. > That way we can make sure that it will be implemented. > > What do you think about this? I think it is quite easy to change this, but > since many classes extend this class we need to agree with it! > > Dejan > > > ----- Original Message ----- > From: "David Glick" <dg...@co...> > To: <bab...@li...> > Sent: Wednesday, August 06, 2003 2:46 AM > Subject: [Babeldoc-devel] Scanner tool and '-h' option? > > > It's normal for a program that prints a help screen to end so that it can > > be > > > re-run with options. The process tool, for example, does this, but the > > scanner tool will print the help options and then continue to execute. > > Is this the intended functionality? If not, I'd be happy to change it, > > because > > > it's driving me slightly batty... :-) > > > > > > David > > > > -- > > David Glick > > Transmit Consulting, Inc > > 619-475-4052 > > dg...@tr... > > > > > > > > ------------------------------------------------------- > > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > > Data Reports, E-commerce, Portals, and Forums are available now. > > Download today and enter to win an XBOX or Visual Studio .NET. > > http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 > > > _______________________________________________ > > Babeldoc-devel mailing list > > Bab...@li... > > https://lists.sourceforge.net/lists/listinfo/babeldoc-devel > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 > _______________________________________________ > Babeldoc-devel mailing list > Bab...@li... > https://lists.sourceforge.net/lists/listinfo/babeldoc-devel -- David Glick Transmit Consulting, Inc 619-475-4052 dg...@tr... |