Design-Level Considerations
Although stricter compiler enforcement for the .NET environment can catch
coding errors typically tolerated by the PowerScript compiler, the .NET environment might
also require changes in application design that are not necessarily caught by the
compiler.
Use the DESTROY statement
The .NET garbage collection service does not trigger the Destructor
event for PowerBuilder objects. If you need to trigger the Destructor event for a
nonvisual object, you must explicitly call the PowerScript DESTROY statement for
that object.
Use multiple text patterns for string matching
If you want to test
whether a string�s value contains any of a multiple set of matching text patterns,
you can use the pipe character ( | ) in your .NET applications or components. The
pipe character is a metacharacter in the .NET environment that functions as an OR
operator, although it is not a metacharacter in the standard PowerBuilder
client-server environment.
Therefore, when you call the
Match function in the .NET environment, you
can use pipe characters to determine if either of two (or one of many) text patterns
match a string you are evaluating. In standard client-server applications, you can
use the Match function to evaluate only one text
pattern at a time.
Work around unsupported features
- Restrict impact of
unsupported events � since unsupported events are never triggered, do not allow
the logic in unsupported events to affect the logic flow of other events or
functions.For example, if the code in an unsupported event
changes the value of an instance variable, it can affect the logic flow in a
supported event that uses that variable. Remove this type of coding from
unsupported events. - Avoid name conflicts �
PowerBuilder allows two objects to have the same name if they are of different
types. For example, you can use the name s_address to define a structure and a static text control or a
nonvisual object in the same PowerBuilder application. The .NET environment does
not allow two classes to have the same name. To enable your application to
compile in .NET, you must not give the same name to multiple objects, even if
they are of different types. - Use global structures
in inherited objects � using local structures in inherited objects can prevent
deployment of a .NET project. To deploy the project, replace all local
structures defined in inherited objects with global structures.
Avoid hindrances to application performance
Some functions and features that are fully supported can hinder
application performance. Use these functions and features sparingly and avoid them
where possible.
- Response windows and message boxes �
use only when absolutely necessary. Response windows and message boxes require
more server-side resources than other kinds of windows. - Yield � avoid
whenever possible, because it requires additional server-side resources. - Timers � use sparingly and avoid
including them on forms that require data entry. Timers periodically generate
postbacks and can impede data entry. When you use them, delay the postbacks by
appropriate scripting of client-side events. - PFC � the DataWindow service in PFC
handles many DataWindow events. Each event causes a postback for each
mouse-click, which adversely affects application performance. Delay postbacks by
scripting client-side events or cache DataWindow data in the client browser by
setting the paging method property for the DataWindow object to
XMLClient!.