Is [Mixin] really a good way to initialize sfapi with?

25 views
Skip to first unread message

Per Olesen

unread,
Apr 16, 2010, 10:11:22 AM4/16/10
to Selenium-Flex API - Development
Hi,

I would like to hear your opinions on the use of [Mixin] metadata on
the SeleniumFlexAPI class.

As I understand it, the init(...) method really isn't supposed to be
called by users of sfapi. It will be called by the flex framework at
load time automagically. Aside from the fact that developers might
miss this "feature" :) (I am sure we could document us out of that), I
find it hard to NOT have this init(...) method be called. The only
actual option I have made work, is to simply NOT compile with sfapi,
if I don't want it to be called.

Here's my story: When I compile a flex app with sfapi and let it go
through testing, I would like that exact tested binary to be the one,
that is actually deployed in production. I do specificly NOT want to
have to go back and recompile without sfapi, and then put that (new
and changed) binary into production.

I thought of a couple of solutions to this, and would like to hear
your opinions on the subject:

a) Remove [Mixin] on SeleniumFlexAPI

This removes the magic, but puts the "burden" of calling
SeleniumFlexAPI onto the user of sfapi. The client app can then
utilize their own solution to make sure they only call the init method
when in development and testing environments.

or

b) Keep [Mixin] but let SeleniumFlexAPI.applicationCompleteHandler
check a flag

The code inside SeleniumFlexAPI.applicationCompleteHandler could be
guarded with a construct like this:

if (Application.application.parameters['sfapi.disabled'] !=
'true') {
... do the initialisation stuff like always
} else {
trace("Specificly NOT initializing sfapi due to flag
sfapi.disabled set");
}

I am not quite sure which one I like the most (or if there are other
good solutions?), but I know these would work.

About the [Mixin] metadata: In my opinion, this is best suited for
something that the user of the framework ALWAYS would like to have
mixed in when compiled with. With something like sfapi, which for the
most users will be for testing environments, the magic seems more
harmfull than good. At least that is my opinion. How do you guys see
it?


--
Subscription settings: http://groups.google.com/group/sfapi-dev/subscribe?hl=en-GB
Reply all
Reply to author
Forward
0 new messages