{"id":938,"date":"2012-03-18T15:11:06","date_gmt":"2012-03-18T21:11:06","guid":{"rendered":"http:\/\/bateru.com\/news\/?p=938"},"modified":"2012-03-18T15:15:50","modified_gmt":"2012-03-18T21:15:50","slug":"siebel-escript-headaches","status":"publish","type":"post","link":"https:\/\/bateru.com\/news\/2012\/03\/siebel-escript-headaches\/","title":{"rendered":"Siebel eScript headaches."},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/www.packtpub.com\/sites\/default\/files\/1865EN_Oracle%20Siebel%20CRM%208-2%20Developers%20Guide.jpg\"\/><br \/>\nHere are a few problems that I&#8217;ve encountered while spending a week programming in Siebel eScript 7.8.<\/p>\n<ol>\n<li>\n<blockquote><p>\n\tSiebel eScript is ECMAScript compliant.<br \/>\n\tECMAScript is the standard implementation of JavaScript as defined by the ECMA-262 standard.<br \/>\n\tBeginning with Siebel Business Applications version 7.8, the script engine supports ECMAScript Edition 4.<br \/>\n\tYou 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.<br \/>\n\t<cite>http:\/\/docs.oracle.com\/cd\/B31104_02\/books\/eScript\/eScript_JSLOverview.html<\/cite>\n\t<\/p><\/blockquote>\n<p>\tHere&#8217;s a link to <a href=\"http:\/\/www.ecma-international.org\/activities\/Languages\/Language%20overview.pdf\">ECMAScript Version 4.0. proposed draft<\/a>.<br \/>\n\tExample code for ES4.<br \/>\n\t<code><\/p>\n<pre lang='javascript'>\r\ninterface I { function f() } \r\ninterface J { function g(n) } \r\nclass C implements I, J { \r\n\tfunction f() { return \"foo\" } \r\n\tfunction g(n) { return n+2 } \r\n} \r\n\t<\/pre>\n<p><\/code><br \/>\n\tIt should be noted that most major web browsers abandoned ES4 due it the complexity of feature implementations.<br \/>\n\tSo 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.<br \/>\n\tSiebel eScript says it&#8217;s ECMA-262 compliant but I&#8217;ve found a few bugs in the engine that require some work around.\n\t<\/li>\n<li>\n\tDeveloping a simple way to unit test your code is essential.<br \/>\n\tHere&#8217;s a easy way to add test function to your library.<br \/>\n\t<code><\/p>\n<pre lang='javascript'>\r\nfunction logThis( name, result ){\r\n\t\/\/ Log this values to a Property Set Object that get's converted to XML.\r\n\tAddParameterPS( logObjs.Outputs, name, result, \"logThis\");\r\n}\r\nfunction testThis( name, func ){\r\n\ttry{\r\n\t\tlogThis( \"Passed: \"+ name, func() );\r\n\t}\r\n\tcatch(e){\r\n\t\tlogThis( \"Failed: \"+ name, e );\r\n\t}\r\n}\r\n\t<\/pre>\n<p><\/code><br \/>\n\tTest example<br \/>\n\t<code><\/p>\n<pre lang='javascript'>\r\nfunction runTest(Input, Output){\r\n\r\n\ttestThis( \"Test strict equivalence support\", function(){\r\n\t\treturn \"1\" !== 1;\r\n\t});\r\n\t\/\/ This will fail since Siebel doesn't support the apply and call Object function calls.\r\n\ttestThis( \"Test isArray using call\", function(){\r\n\t\t\/\/ Siebel eScript: FAIL, Browser: Pass\r\n\t\tfunction isArray( arr ){\r\n\t\t\treturn Object.prototype.toString.call( obj ) == \"[Object Array]\";\r\n\t\t}\r\n\t});\r\n\ttestThis( \"Test isArray using instanceof\", function(){\r\n\t\t\/\/ Siebel eScript: Pass, Browser: Pass\r\n\t\tfunction isArray( arr ){\r\n\t\t\treturn arr instanceof Array;\r\n\t\t}\r\n\t});\r\n}\t\r\n\t<\/pre>\n<p><\/code>\n\t<\/li>\n<li>\n\tSiebel Business Applications in high-interactivity mode requires an ActiveX plugin, which forces you to use Internet Explorer on Windows.\n\t<\/li>\n<li>\n\tSiebel eScript has errors with it&#8217;s engine and it&#8217;s hard to debug eScripts for run-time business services.<br \/>\n\tHere&#8217;s a strange bug in Siebel eScript.<br \/>\n\tYou can&#8217;t create return objects when they are generated from a function attached to an object.<br \/>\n\tExample Code:<br \/>\n\t<code><\/p>\n<pre lang='javascript'>\r\n\tvar x = {};\r\n\tx.getObj = function( a, b ){\r\n\t\tvar obj = function(){\r\n\t\t\tthis.x = a;\r\n\t\t\tthis.y = b;\r\n\t\t};\r\n\t\treturn new obj();\r\n\t};\r\n\tvar getObj = function( a, b ){\r\n\t\tvar obj = function(){\r\n\t\t\tthis.x = a;\r\n\t\t\tthis.y = b;\r\n\t\t};\r\n\t\treturn new obj();\r\n\t};\r\n\tvar arr = [];\r\n\tarr.push( getObj() );\t\/\/ successful\r\n\tarr.push( x.getObj() );\t\/\/ Run-time Error.\r\n\t<\/pre>\n<p><\/code>\n\t<\/li>\n<li>\n\tSiebel eScript engine is pretty damn slow. So avoid writing these two performance killers.<br \/>\n\t1: Wrapping all your code within a closure.<br \/>\n\t2: Defining an object inside closure with the same name as an object in the outer scope.<br \/>\n\tExample:<br \/>\n\t<code><\/p>\n<pre lang='javascript'>\r\n\tvar x = (function(){\r\n\t\tvar x = {\r\n\t\t\ta:1\r\n\t\t};\r\n\t\treturn x;\r\n\t}());\r\n\t<\/pre>\n<p><\/code>\n\t<\/li>\n<\/ol>\n<p>Siebel eScript Reference from Oracle.com:<br \/>\n<a href=\"docs.oracle.com\/cd\/E05553_01\/books\/PDF\/eScript.pdf\">eScript Lanague Reference (2004 edition)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are a few problems that I&#8217;ve encountered while spending a week programming in Siebel eScript 7.8. 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 &hellip; <a href=\"https:\/\/bateru.com\/news\/2012\/03\/siebel-escript-headaches\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Siebel eScript headaches.<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,86],"tags":[185,121],"class_list":["post-938","post","type-post","status-publish","format-standard","hentry","category-frontend-tech","category-reviews","tag-escript","tag-siebel"],"_links":{"self":[{"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/posts\/938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/comments?post=938"}],"version-history":[{"count":6,"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/posts\/938\/revisions"}],"predecessor-version":[{"id":948,"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/posts\/938\/revisions\/948"}],"wp:attachment":[{"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/media?parent=938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/categories?post=938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/tags?post=938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}