Reimplementation of app.initalize method

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Reimplementation of app.initalize method

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:48 am

by Gloria McFarlane >> Mon, 31 Jan 2000 7:27:46 GMT

When reimplementing initalize method for an application in Jade,
should it call inheritMethod ??

What does the initalize method on the Application class do?
I am curious and the source code "is not available"


Is it automatically called if you don't include inheritMethod in your code inside initalize on the class you create under RootSchemaApp?

When I did the development course, it wasn't possible to reimplement
the initalize method and we made ours initialise instead. And from
that I assume that initialize is called automatically and requires inheritMethod on reimplementations??

Gloria McFarlane
Southcom Ltd

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Reimplementation of app.initalize method

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:48 am

by Richard Mitchell >> Wed, 2 Feb 2000 21:35:07 GMT

initialize is the default startup method for an application. You can specify a differently-named method as the initialize method on the Applications browser. This method is called at application startup, after getAndValidateUser (if used) but before the startup form (if any) is loaded.

If you leave the application definition so that it uses the default initialize method, then if you re-implement initialize in your subschema it will not execute the code in any initialize methods in superschemas. If you want it to do this then use inheritMethod in your re-implementation of initialize.

Because I have a number of non-GUI background applications and I want to handle initialisation differently for each, I find it useful to define explicit initialisation methods for each application e.g. methods named 'initializeMessageServer' or 'initializeCommsMgr'.

Richard

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Reimplementation of app.initalize method

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:49 am

by Craig Shearer >> Wed, 2 Feb 2000 22:00:57 GMT

Regarding initialise methods, does anybody else find it a pain that from JADE 5 onwards, no initialise method is called when a JadeScript method is called?

In our applications, we have an initialise method that sets up various root object references on our app object. So for convenience, we can use app.root to get at our root object.

However, no initialise method is called when a JadeScript executes, and it is not possible to define one. This effectively means that for any JadeScript we write, we have to remember to call an application initialisation method at the start, otherwise app.root will return null.

I have put in an NFS that there be a method on Application called (something like) initJadeScript that could be reimplemented to do whatever we wished.

Thoughts?

Craig.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Reimplementation of app.initalize method

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:49 am

by Allistar Melville >> Wed, 2 Feb 2000 11:02:39 GMT

One handy thing with this is that if you are already running an application from the development envirnoment then the Jadescript will
run in that application instead of creating another one. This means
you have access to the references of that application object.
Craig.

Allistar.

------------------------------------------------------------------
Allistar Melville
Software Developer
Auckland, NEW ZEALAND

Greentree International,
Developer of Greentree Financial Software. ------------------------------------------------------------------

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Reimplementation of app.initalize method

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:49 am

by Eric Peachey >> Thu, 3 Feb 2000 2:55:15 GMT
However, no initialise method is called when a JadeScript executes, and it is not possible to define one. This effectively means that for any JadeScript we write, we have to remember to call an application initialisation method at the start, otherwise app.root will return null.

It's not too much effort to code something like app.initialize; at the start of a method (where appropriate as you don't always want to do app initialization anyway).
One handy thing with this is that if you are already running an application from the development envirnoment then the Jadescript will
run in that application instead of creating another one. This means
you have access to the references of that application object.

Sometimes find this a bit of a pain especially if the app has armed global exception handlers that go off and do stack dumps to files etc. - I'd be happier with the default handler but I suppose it's easy enough to arm your own exception handler in the JadeScript method. I think I'd prefer it if the JadeScript method executed in its own process every time - at least that way it would be consistent.

I suppose there's lots of arguments both ways.

Eric in Dunedin


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 21 guests