eScript Checklist

Checklists are a great way to help you catch common mistakes by focusing your attention on the items on the list. In the tradition of Code Complete, here’s a checklist for coding eScript in Siebel. I’ve¬†included items that are specific to eScript development or are particularly pertinent to eScript; and not general programming ones, as they’re covered in existing resources.

"Jules Verne Pocketwatch (compass)", nullalux, Flickr

"Jules Verne Pocketwatch (compass)", nullalux, Flickr

In no particular order:

Can the equivalent functionality be achieved through configuration?

Before attempting to code a solution, check if there is a way to achieve the same result using configuration. In general, eScript executed within Siebel will be slower than the equivalent configured functionality.

Have you removed Trace statements?

Trace statements are generally used by the programmer to check the flow of the application during development or to debug a particular error. If left in they clutter the code and logs, and degrade performance through unnecessary IO.

Are there any ’empty’ functions?

In this instance, empty means functions with only comments in them. These will still have to be parsed by Siebel and can negatively impact performance. They’re also unnecessary and normally a leftover from functionality that was there but has subsequently been removed.

Are your errors being handled correctly?

You should have a standard covering how and where exceptions are handled. Far too often programmers will arbitrarily sprinkle try catch blocks throughout their code, causing errors to be caught and rethrown multiple times, leading to some very odd messages and in some cases completely obfuscating the cause of the problem.

Are you correctly destroying objects?

This is an easy one to let fall by the wayside. Ensure you set Business Object, Business Component, PropertySet and Business Service object variables to null once you are finished with them. This should be done in a finally clause as you still want them to be set to null even if an error occurs.

You also need to ensure your variables are destroyed in the reverse order to that in which they were assigned.

An example of the correct way to destroy objects:

var businessObject;
var businessComponent;
try {
    businessObject = TheApplication().GetBusObject("Eg BO");
    businessComponent = bo.GetBusComp("Eg BC");
} finally {
    businessComponent = null;
    businessObject = null;

It’s especially difficult to pick up the destruction ordering when you’ve named your Business Component and your Business Object similarly. (For example bcAccount and¬† boAccount) So consider your naming conventions carefully.

Have you improved the script you’re changing?

For example, I’ve seen far too many functions that you cannot add any more code to because they’ve reached the maximum script size. These functions didn’t start out this way, but developer after developer simply added more code without taking the time to refactor.

Don’t just add to the existing code, set out to actively improve it.

Is your code being reviewed?

This doesn’t need to be as part of a formal review process (although these do have value). It could be as simple as asking a colleague to look at your code every now and then. Checklists, such as those found in Code Complete, are useful in formal and informal reviews.

Have you got the programming basics right?

The items above are applicable to eScript development, but you’re still programming when developing eScript and should treat your scripts accordingly. Far too often scripting in Siebel is approached as a secondary skill. If you haven’t become proficient at programming then you need to start! You won’t create well crafted functions and code if you don’t apply yourself to the discipline of coding. A great start is to work through Code Complete.

For additional items to look out for, checkout the following Bookshelf resource: Optimal Performance

What would you add to this checklist?

This entry was posted in Programming and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *