[MUD-Dev] Re: OO Design Question

J C Lawrence claw at under.engr.sgi.com
Tue Nov 10 16:52:46 CET 1998


On Wed, 11 Nov 1998 11:24:05 +1100 
Brad Leach<c9608122 at alinga.newcastle.edu.au> wrote:

> My question is this: Should the "Server" object be started (via a
> public "startup" function) and look after everything (Method "A")
> or should the main() function look after the specific's of calling
> AServer::Init(), AServer::MainLoop(), etc (Method "B").

What I do:

  main.c:  

    1) Is very very non-OO, and mostly does environmental checks
(gross error checking) for the upcoming server.

    2) Instantiates a "State" object which loads and configures the
server for the task it is about to do (also does some error handling
configs/instantiation, memory pool configs, singleton setups etc)

    3) Instantiates a "Server" object which takes the State object
as an argument (the State object is done first to simplify error
handling in constructors).

    4) The instantiated Server object gets the server all up and
ready to run.

    5) Call Server.Run().

    6) Handle exceptions arising from Server.Run() as applicable.

--
J C Lawrence                               Internet: claw at kanga.nu
(Contractor)                              Internet: coder at kanga.nu
---------(*)                     Internet: claw at under.engr.sgi.com
...Honourary Member of Clan McFud -- Teamer's Avenging Monolith...




More information about the mud-dev-archive mailing list