Sie sind auf Seite 1von 11

BPM

(Tibco BPM Standards)


Documentation
Technical Overview

Framework Integration – Technical Overview Page 1 of 11


Tibco GI–Best Practices

Statement of Proprietary Information

The information contained in this document is confidential to GFT Iberia Solutions S.A.. The
document may not be disclosed, duplicated, or used, for any purpose, in whole or in part,
without the prior written consent of GFT Iberia Solutions S.A.

Disclaimer

Hard copies of this document which have not been authorised and included on a distribution list
are FOR INFORMATION ONLY, AND ARE NOT SUBJECT TO DOCUMENT CONTROL, WITH
NO FOLLOWING REVISIONS.

Document status.

Version number: VERSION 1.0

Date of Issue:

File name:

Document Revision History

Version Date Revision Detail Author


1.0 10.07.09 First Version Francisco Amador

www.gft-iberia.com 2 / 11
Tibco GI–Best Practices

Table of content

Purpose...............................................................................................................4

1 Scope................................................................................................................4

2 References........................................................................................................4

3 Application Design..........................................................................................4

4 UI Components................................................................................................6

5 Minimize Repainting Components ................................................................7

6 JavaScript Code...............................................................................................7

7 Web Service .....................................................................................................7

8 Setting Expires Header.................................................................................10

9 Gzip compression..........................................................................................10

10 Do’s and Don’ts............................................................................................10

www.gft-iberia.com 3 / 11
Tibco GI–Best Practices

Purpose
The purpose of this document is to serve as a best practices & a guideline for developers who
want to develop rich web applications using TIBCO GI as per bank’s brand portal guidelines.

1 Scope
The scope of the document is to list the various best practices for optimizing Tibco GI
application performance.

2 References
Video demo from Tibco GI site to Optimize Application
http://media.tibco.com/gi/tutorials/6_optimize/6_optimize.html

Tibco GI Developer Guide / Chapter 8: Optimizing Application Performance


http://developer.tibco.com/resources/gi/3_7/doc/html/wwhelp/wwhimpl/js/html/wwhelp.htm?
href=tib_gi_developer_guide/developer_guide.5.50.htm

Yahoo performance rules.


http://developer.yahoo.com/performance/rules.html

3 Application Design
One of the critical phases of software design is application design. When designing your
application, it’s important to consider the following:
• What are the end-user requirements?
• What tasks will the user need to accomplish?
• What is the work flow?
• How easy is the application to use?

Application design includes application architecture, user interface design, and component
design. If this phase of application development is neglected, usability and performance can be
adversely affected. For example, poor performance can occur if the application has a poorly
designed, complicated user interface and if the application uses components that aren’t
designed properly. While designing your General Interface application, consider the following
best practices which are in this document.

3.1 Design Applications to be Asynchronous


Whenever possible design your application to use asynchronous loading to improve
performance and usability. Use the following techniques:

• Load only those areas of the application that are viewable by the user and required for
the user to begin using the application. For example, load the tab content for the first
visible tab and load content of other tabs only when the user selects the tab.

• Load GUI components using Referenced-Asynchronous. For more information, see


Component Hierarchy Palette Context Menu.

e.g. In this sample we have 3 tabs and each tab has reference to separate xml
component file.

www.gft-iberia.com 4 / 11
Tibco GI–Best Practices

• Load XML data asynchronously. In the properties editor specify the xml file relative path
in XML URL and select XML Async = Asynchronous.

e.g.

www.gft-iberia.com 5 / 11
Tibco GI–Best Practices

3.2 Reuse Existing Components


Loading complex components can be one of the most expensive operations. Reuse
components whenever possible instead of removing and recreating General Interface
DOM nodes.

There are typically two use cases for reusing components:


1. Changing component properties reuse a component by simply changing a
property programmatically, such as a column header or cell width.
2. Showing components intermittently if a component is used intermittently, such
as a dialog or a tab, show and hide the component instead of destroying and
recreating. However, remember that repainting a component repaints all children,
even if they’re hidden.

3.3 Don’t Store Data in Form Elements

Storing data in form elements, which is a typical HTML pattern, is not recommended for General
Interface applications. Instead of hiding and showing form elements to access data, persist data
separately in an XML/CDF document or JavaScript variable.

Note that persisting data as XML is recommended, because memory management for XML is
better than for JavaScript objects. Once data is persisted, load and unload components as
needed without losing data. For example, persist login and username data from a dialog and
remove the dialog from the General Interface DOM instead of hiding the dialog.

4 UI Components
Use the following best practices when working with components and component serialization
files.

4.1 Eliminate Unnecessary Components

Follow these best practices to improve application performance:

• Reduce the nesting and total number of blocks


− Design your application with the fewest blocks possible. Too many blocks can slow
performance when resizing and repainting.

• Use layout components sparingly


− Only use layout components when appropriate.

www.gft-iberia.com 6 / 11
Tibco GI–Best Practices

4.2 Use Matrix and Paging


• Use the Matrix components whenever possible to display large amounts of data. The
Matrix component uses various paging models to improve overall rendering
performance and paging tuners to provide greater control over how and when data is
loaded.

5 Minimize Repainting Components


The on-screen rendering of HTML is often the slowest aspect of browser-based
applications. Using efficient repaints can make your application faster and more
responsive to user input.
Follow these best practices for repainting:
• Look for unnecessary repaints in your JavaScript code and remove them.
• Repaint the smallest area of your application to obtain the desired effect.
• For Matrix components, call the repaintData() method if only the data has changed.

6 JavaScript Code
Use the following best practices when developing JavaScript code for your
application.
Remove Unused JavaScript Code
Remove unused portions of code to make the JavaScript file smaller, speed up the JavaScript
loading time, and make the code run faster.

Avoid Initializing Unused Variables

Replace JavaScript Manipulation of CDF with XSL Transformations


Replace JavaScript manipulation of CDF with faster, more efficient XSL transformations. For
example, if fifty customer records are returned from a jsx3.net.Request response, iterating
through all the elements in JavaScript is less efficient than building an XSL template and
applying it using the jsx3.xml.Template API

Avoid Excessive String Concatenations


In Internet Explorer, string concatenations are very expensive, especially with large strings. A
better approach is to replace string concatenations with an array, push new strings to the array,
and then use an Array.join() method call to get a single string. This approach essentially uses a
string buffer instead of successive concatenations.

7 Web Service
7.1 Rule Mapping
Most times, when processing data returned by web services developers generally would need to
convert it to the CDF document format to loading it into a GI component. For such requirements
generally developers tend to create an initial “raw” CDF document from the web services using
the web service rule mapping & then try to modify it using javascript or transform it to another

www.gft-iberia.com 7 / 11
Tibco GI–Best Practices

CDF document using XSLT. This results in multiple processing of the data finally slowing down
the application.
So we strongly suggest that the developers use the various features of the rule mapping
approach to its fullest to generate the expected “final” CDF document in a single shot & prevent
any further processing of the document again.
e.g. If the developer needs to use some complicated javascript to process the data, he could
directly include this javascript function inside the web service rule mapping itself thus preventing
multiple processing. This can be done via the following steps.
a) Select the item to be processed
b) In the mappings section choose the type as “Script”
c) Call the javascript function as the “Path/Value” & pass the item’s value as an argument to the
function.
d) The item’s value can be obtained by the statement
“CDFCONTEXT,MESSAGENODE.getValue()”
e) The parent CDF Record can be obtained via “CDFRecord”
e.g.
If a in the format “Accountno||Bankname||Location||Dealercode” needs to be split as distinct
CDF attributes of a record the rule mapping for this item will be as below
Type: Script
Path/Value: MyClass.myFunction(CDFCONTEXT,MESSAGENODE.getValue());
Function code:
MyClass.myFunction = function(CDFRecord, str) {
var values = str.split("||");
CDFRecord.setAttribute("jsxid", values[0]);
CDFRecord.setAttribute("jsxbankname", values[1]);
CDFRecord.setAttribute("jsxlocation", values[2]);
CDFRecord.setAttribute("jsxdealercode", values[3]);
};

7.2 XML Binding

Use xml bind approach for mapping CDF documents to GUI controls such as CDF GUI
containers, matrix, select boxes, combo boxes etc.
e.g.
a) Use the web service rule mapping approach to store a CDF document into the cache as
below with a unique CACHE_ID say “PROGRAM_LIST”.

SCREEN SHOT

www.gft-iberia.com 8 / 11
Tibco GI–Best Practices

b) Choose the GUI control to be populated with the data

c) Open the Properties Editor of GUI component and map the XML Cache Id as
PROGRAM_LIST.
Select Share Resources = Share, XML Async = Asynchronous and XML Bind = Bound.

By this approach the combo box get updated with the values when ever the web service call is
made for the first time and for the subsequent load of the component the CDF document is
loaded from the cache. This removes over head of calling web service for each time load of the
same component in the same browser.

7.3 Web Service calls

When multiple web services are being called make sure that the application code does not call
the web services sequentially but the calls are made asynchronously.

www.gft-iberia.com 9 / 11
Tibco GI–Best Practices

8 Setting Expires Header


Setting Expires header makes all static components cacheable in the
browser. This avoids unnecessary HTTP requests on subsequent page
views. Browser uses cache to reduce the number and size of HTTP
requests, making web pages load faster.
1. Set a far future expires header (1 year+) for the Tibco GI installation. (As
the GI installation for a particular version will never change)
2. Set a shorter future expires header (1 day) for the addin and application.
This ensures that the component is cached for 1 day atleast. (providing
far future expires header is not advised as these files generally are
expected to change with newer releases)

9 Gzip compression
The time it takes to transfer an HTTP request and response across the network can be
significantly reduced by decisions made by front-end engineers. It's true that the end-user's
bandwidth speed, Internet service provider, proximity to peering exchange points, etc. are
beyond the control of the development team. But there are other variables that affect response
times. Compression reduces response times by reducing the size of the HTTP response.

Starting with HTTP/1.1, web clients indicate support for compression with the Accept-Encoding
header in the HTTP request.
Accept-Encoding: gzip, deflate

If the web server sees this header in the request, it may compress the response using one of
the methods listed by the client. The web server notifies the web client of this via the Content-
Encoding header in the response.
Content-Encoding: gzip
Gzipping generally reduces the response size by about 70%. Approximately 90% of today's
Internet traffic travels through browsers that claim to support gzip. If you use Apache, the
module configuring gzip depends on your version: Apache 1.3 uses mod_gzip while Apache 2.x
uses mod_deflate.

10 Do’s and Don’ts


1. Avoid loading too much upon application initialization instead load
minimum set of feature for the user to get started, and then load more as
needed.
2. Avoid persisting data in hidden forms instead persist data in data object
in the data cache.
3. Avoid redundant and unnecessary rendering instead only paint, repaint
as needed. Use paintchild() and paintchildern() to incrementally render
newly added components.
4. Tibco GI applications/portlets should preferably be developed using
Firefox browsers (not IE) due to it's more strict adherence to standards
and availability of debugging/dev tools (Firebug, YSlow).

www.gft-iberia.com 10 / 11
Tibco GI–Best Practices

5. Tibco GI portlets should be developed and tested in a Liferay Portal


Server environment from begin on.
6. Tibco GI applications/portlets should be tested against the following
browsers at minimum : Firefox 3.0, Firefox 3.5, IE7 and IE8.
7. Follow the guidelines in the YSlow (http://developer.yahoo.com/yslow/)
and apply them while implementing Tibco GI application.

www.gft-iberia.com 11 / 11

Das könnte Ihnen auch gefallen