Siebel eScript headaches.


Here are a few problems that I’ve encountered while spending a week programming in Siebel eScript 7.8.

  1. Siebel eScript is ECMAScript compliant.
    ECMAScript is the standard implementation of JavaScript as defined by the ECMA-262 standard.
    Beginning with Siebel Business Applications version 7.8, the script engine supports ECMAScript Edition 4.
    You can opt to use the updated functionality of this engine, including the Siebel ScriptAssist tool, or you can opt to leave this updated functionality inactive.
    http://docs.oracle.com/cd/B31104_02/books/eScript/eScript_JSLOverview.html

    Here’s a link to ECMAScript Version 4.0. proposed draft.
    Example code for ES4.

    interface I { function f() } 
    interface J { function g(n) } 
    class C implements I, J { 
    	function f() { return "foo" } 
    	function g(n) { return n+2 } 
    }


    It should be noted that most major web browsers abandoned ES4 due it the complexity of feature implementations.
    So even if your scripts pass jshint.com and jslint.com 100%, and works on all major browsers you still have the possibility of your code throwing an during execution.
    Siebel eScript says it’s ECMA-262 compliant but I’ve found a few bugs in the engine that require some work around.

  2. Developing a simple way to unit test your code is essential.
    Here’s a easy way to add test function to your library.

    function logThis( name, result ){
    	// Log this values to a Property Set Object that get's converted to XML.
    	AddParameterPS( logObjs.Outputs, name, result, "logThis");
    }
    function testThis( name, func ){
    	try{
    		logThis( "Passed: "+ name, func() );
    	}
    	catch(e){
    		logThis( "Failed: "+ name, e );
    	}
    }


    Test example

    function runTest(Input, Output){
     
    	testThis( "Test strict equivalence support", function(){
    		return "1" !== 1;
    	});
    	// This will fail since Siebel doesn't support the apply and call Object function calls.
    	testThis( "Test isArray using call", function(){
    		// Siebel eScript: FAIL, Browser: Pass
    		function isArray( arr ){
    			return Object.prototype.toString.call( obj ) == "[Object Array]";
    		}
    	});
    	testThis( "Test isArray using instanceof", function(){
    		// Siebel eScript: Pass, Browser: Pass
    		function isArray( arr ){
    			return arr instanceof Array;
    		}
    	});
    }

  3. Siebel Business Applications in high-interactivity mode requires an ActiveX plugin, which forces you to use Internet Explorer on Windows.
  4. Siebel eScript has errors with it’s engine and it’s hard to debug eScripts for run-time business services.
    Here’s a strange bug in Siebel eScript.
    You can’t create return objects when they are generated from a function attached to an object.
    Example Code:

    	var x = {};
    	x.getObj = function( a, b ){
    		var obj = function(){
    			this.x = a;
    			this.y = b;
    		};
    		return new obj();
    	};
    	var getObj = function( a, b ){
    		var obj = function(){
    			this.x = a;
    			this.y = b;
    		};
    		return new obj();
    	};
    	var arr = [];
    	arr.push( getObj() );	// successful
    	arr.push( x.getObj() );	// Run-time Error.

  5. Siebel eScript engine is pretty damn slow. So avoid writing these two performance killers.
    1: Wrapping all your code within a closure.
    2: Defining an object inside closure with the same name as an object in the outer scope.
    Example:

    	var x = (function(){
    		var x = {
    			a:1
    		};
    		return x;
    	}());

Siebel eScript Reference from Oracle.com:
eScript Lanague Reference (2004 edition)

Larry Battle

I love to program, and discover new tech. Check out my stackoverflow and github accounts.

More Posts - Website

Follow Me:
Twitter