Section: Application class instead of static main procedure
|
Status:
|
Description
There was the idea that a public, static main method as jump-in point is not the
best way to design a jump in point of an object oriented program. An other option
would be to provide an Application class, which the user can override. This class
would have a constructor which takes the command line arguments as parameter,
a run procedure with no parameters and a getStatus() function (or a status - Object
with a read trigger...). The Application class could also inherit from the thread
class.
When the user now calls a program he has to specify the class name to run. This would
then cause that an instance of this class is created, passing the command line args
to the constructor. Then the run procedure is called. When this procedure exits, the
getStatus() is returned to the caller.
Arguments
pro: It would be a clear, object oriented design
pro: You could easily create another thread of the same application, or inherit more
classes from the Application class to run multiple threads.
|