#011865: Different development modes

Description:

This is copied from the mailinglist to not be forgotten while all the devs are in Frankfurt....

Hi,

we want to integrate ezcExecution and I stumbled about a rather time consuming
point in ezcExecution::init():

Check if the passed classname actually implements the interface. We
have to do that with reflection here unfortunately since we only
// have the classname and not an object.
$interfaceClass = new ReflectionClass( 'ezcExecutionErrorHandler' );
$handlerClass = new ReflectionClass( $callbackClassName );
if ( !$handlerClass->isSubclassOf( $interfaceClass ) )
{
throw new ezcExecutionWrongClassException( $callbackClassName );
}

So for each and every request we would instantiate two ReflectionClass
objects. I've not done any Benchmark for this, but I assume, that it's an
unnecessary waste of time.

Of course it's fine to have this error during development, but I'd like to
switch this test of for production. If it worked once while testing, then it
works every time as long as I don't change the source code.

So I have a suggestion for the next ezc Releases: Add a "development" and
a "production" mode to ezcBase. Every Component can ask for the current mode
and decide, which tests to do.

Tests that should be skipped in production mode:
A test that depends only on the sourcecode and will pass everytime as long as
the sourcecode remains unchanged, should be skipped.

Maybe you'd like to take speed as a focus for the next release and consider
also #011212: speed up autoload.
http://issues.ez.no/IssueView.php?Id=11212&url


Environment:

Operating System:
PHP Version: (please be specific, like '4.4.3' or '5.1.5')
Database and version:
Browser (and version):


- Attachments

No attachments for this issue.


- Comments

If such a mode flag (production|development|testing|whatever) would be available in Base, I'd also like to access it from my application to decide which tests to do or not to do.
For example checking for newer entries in the translation XML file does not need to be done on the production server, where files do change only on updates.

#254567 by Thomas Koch on November 12th, 2007 [Permanent Link]

    /**
     * Production mode is the mode for applications used by customers. This
     * means:
     * * Fast: All caching enabled
     * * not chatty: No internal errors may be shown
     * * Logging: Is different for every mode
     */
    const MODE_PRODUCTION  = 0;
    /**
     * Development mode is used on devs workstation.
     * * Changes apply immediatly, Caching is reduced.
     * * chatty: Gimme all the backtrace, vars and files!
     * * Logging: Only for the dev
     */
    const MODE_DEVELOPMENT = 1;
    /**
     * Testing mode is for dev and stage
     * * Fast: The caching must also be tested and changes are not done
     *         anymore.
     * * a little bit chatty, but don't annoy the tester!
     * * Logging goes to one dev
     */
    const MODE_TESTING     = 2;

    /**
     * The runMode can cause different behaviour at different parts of the
     * application. The runmode must be one of the MODE_* constants.
     * See their comments for the different meanings of the runmodes.
     *
     */
    protected static $runMode = self::MODE_PRODUCTION;
#254606 by Derick Rethans on November 14th, 2007 [Permanent Link]

I've found another point, where some time could be saved: Instantiating an ezcInputForm validates the definition on every run. For a medium sized definition (8 elements) this takes nearly as long as displaying the template ($template->process).

Maybe one could add a flag to the constructor to not check the definition anymore?

__construct( $inputSource, $definition, $characterEncoding = null, $checkDefinition = true )

#255363 by Thomas Koch on January 8th, 2008 [Permanent Link]

Implemented in rev. 8575. Now an investigation needs to be done *where* to apply this new functionality.

#257410 by Derick Rethans on July 14th, 2008 [Permanent Link]

- History
Properties
Type Enhancement
Priority Medium
Component Components
Affects Unknown
Fix Version 2008.2alpha1 - eZ components 2008.2alpha1
Reporter Thomas Koch
Responsible Derick Rethans
Status 0 Closed
Resolution Implemented
Created November 8th, 2007
Updated July 14th, 2008
Resolved July 14th, 2008
 
Navigation [Permanent Link]
Previous Issue
Back to Issues List
Next Issue: #015537
  Graph shows to small and truncated rotated axis labels