Forte' Frequently Asked Questions

Copyright © 1998 Vikas Malik

All Rights Reserved

This FAQ may be posted to any USENET newsgroup, on-line service, or BBS as long as it is posted in its entirety and includes this copyright statement.

This FAQ may not be distributed for financial gain.

This FAQ may not be included in commercial collections or compilations without express permission from the author.

________________________________________________________________________________________________

Vikas Malik - vmalik@albion-intl.com

Albion International, Inc.

________________________________________________________________________________________________

Contents

Q. What is Forte'?
Ans. Forte' is a set of object-oriented tools for developing distributed applications. The URL of Forte' is http://www.forte.com. Forte' means strength. Forte's forte' is in distributed computing.

Q. How do I find more info on Forte'?
Ans. Forte' Usergroup: SAGE IT Partners has a forte-users mail list that can be used by technical people to get general information about the Forté environment and tools. Its address is www.sagesoln.com/tech_forte_users.html.
Newgroup: comp.soft-sys.app-builder.forte. This newsgroup is hardly used by anyone.

TOOL:

Q. What is TOOL?
Ans.TOOL is Transactional Object Oriented language used to develop distributed applications in Forte'. TOOL has some unwanted procedural features like case statement. Forte' provides scalar data types in addition to objects.

Q. Is TOOL case sensitive?
Ans. No.

	aCustomer: Customer;
	acustomer: Customer;
	aCusTomer: Customer; 
Object references of aCustomer, acustomer and aCusTomer are treated as equal.

Q. What kind of inheritance is provided by Forte'?
Ans. Forte' has single implementation inheritance and multiple interface inheritance

Q. Is TOOL an interpreted language?
Ans. Yes, TOOL is an interpreted language but it also provides support for C++ compile.

Q. What is self?
Ans. self in Forte's is a reference to receiver of the message. It is equivalent to "this" in Java and C++.

Q. What is super?
Ans. super refers to the superclass of the class that defines the message sent to the receiver.

Q. How is a Forte' class different than classes in other OO langauages?
Ans. A Forte' class has virtual attributes, widget attributes, constants, events and event handlers in addition to attributes and methods.

Q. What do I mean by a virtual attribute in Forte'?
Ans. A virtual attribute in Forte's has an associated get and set method. The get message is sent whenever the virtual attribute is used in an expression. The set method is sent when a value is assigned to a virtual attribute. A virtual attribute does not point to an attribute. It is usually used to implement a derived attribute.

Q. What is a widget attribute?
Ans. A widget attribute is an instance of a widget class like DataField, etc. A widget attribute is created by adding a visual element within menu/window layout.

Q. Can I directly access attributes of an object in Forte'?
Ans. Yes, only the public attributes. Using accessor methods to access attributes is a very good idea.

Q. What are the different runtime attributes of a Forte' object?
Ans. Shared, distributed, transactional and monitored.

Q. What do I mean by a workshop in Forte'?
Ans. A Forte' workshop is a UI that allows one to develop a software component like class, window, etc.

Q. What is FSCRIPT?
Ans. FScript provides a command-line interface to Forte' development environment.

Q. How does Forté takes care of garbage?
Ans. Garbage collection is automatic in Forté . Garbage collection in the current partition can be forced by Using
Task.Part.OperatingSystem.RecoverMemory();

Q. How do I programmatically find the class of an object?
Ans. Send getClassType() message to an object.
anObject.GetClassType(); returns an instance of ClassType class.

Q. What is the difference between using isA() method and getClassType() method?
The IsA(type=ClassType) method tests whether the current object is an instance of the specified class or a subclass of the specified class whereas getClassType() can be used to test whether the current object is an instance of a specified class only and not one of its subclasses.

Q. What is init() method used for?
Ans. Init() method is used to allocate memory to attributes of an object and set their initial state. A typical implementation of Init() is

Super.init();
Name := new();
Score = 0;
Object instantation invokes init method. 
Name: TextData = new(value = 'Bill Clinton');
The above new statement calls Init() method in DataValue class and then sets the 
value attribute of Name (DataValue object) to 'Bill Clinton'. 

Q. What is the difference between new and new()?
Ans. There is no difference.
aCustomer: Customer = new;
aCustomer: Customer = new();
The above statements have exactly same result. Both instantiate a Customer.

Q. How do I set the state of an object at instantiation time?
Ans. Use new to set an object's attributes.

     aCustomer: Customer = new(name = 'Bill Gates',
			address = '1 Microsoft Way');
Forte' does not provide constructors like C++. new keyword is as close as it gets to constructors.

Q. Does Forte' has public static methods/ class methods?
Ans. No.

Q. Does Forte' has class variables/ public static data members?
Ans. No.

Q. Do I need to instantiate (new) a scalar type?
Ans. No, only declaration is required for a scalar type. There is no need to use new keyword. Declaration also allocates the memory for scalar types.

Q. What is the difference between the following two statements?
a) goodCompany: Company = tempCompany;
b) goodCompany: String = tempCompany;
Ans. (a) Both object references, goodCompany and tempCompany share the same object.
(b) Both scalar variables have the same value but they are not identical. The scalar variable values occupy different memory space.

Q. What are the advantages of using scalar variables over objects?
Ans. They take less memory and therefore, more efficient to send to other partitions over the network.

Q. What is the result of sending a message to an object reference without instantiating it?
Ans.

 Name: TextData;
Name.setValue('Bill Gates');
The above code causes a runtime exception; use of a method on a nil object. This can be corrected by allocating memory to name object reference by using 'new' keyword.

Q. What is the difference between using isEqual() method and '=' operator ?
Ans.

BadValue: IntegerData;
GoodValue: IntegerData;

BadValue = GoodValue is the test for identity. 
BadValue.isEqual(GoodValue) is a test for equality. 

Q. What is the difference between Integer and IntegerData?
Ans. Integer is a scalar data type. It has no behavior. IntegerData is a class and it has both state and behavior. The names used by Forte' for DataValue classes are very confusing. The name IntegerData implies that it is data only and therefore a primitive type.

Q. What is the class equivalent of string data type?
Ans.TextData.

Q. What is the difference between TextData and TextNullable?
Ans. The TextNullable class is the nullable variant of the TextData class. The IsNull attribute of a TextNullable object can be set to TRUE to set its value to null. Nullable objects can be used to map to the nullable columns in relational database tables.

Q. What is a monitored object?
Ans. A monitored object notifies any changes in its state to the UI and these changes are displayed in UI immediately. An object can be monitored by UI by setting its isMonitored attribute to be true.

Q. What is a shared object in Forte'?
Ans. A shared object cannot be shared by two or more tasks simultaneouly. The name shared object is a misnomer. Only one task is allowed to use a shared object at a time and other tasks are queued until the lock is released by the first task. A shared object is anchored by default.

Q. What is a transactional object in Forte'?
Ans. A transactional object can be rolled back if the transaction fails.

Q. How do I make a copy of an object in Forte'?
Ans. By sending clone() message. Its deep parameter can be set to true to make a deep copy.

Q. Does cloning preserve an object's runtime properties (isShared, isAnchored, ..)?
Ans. No, copy gets the default values of these attributes.

Q. What are the different types of method parameters in Forte'?
Ans. Input, output, input output and their copy variants.

Q. What is the difference between input and copy-input method arguments?
Ans. When an object is passed to a method as input parameter, any changes made to the object are applied to original object. The implementation of input object parameters depends on whether the method is invoked from a remote partition. If the method is invoked on a remote object, Forte' passes the input parameters as copies and then on the completion of a remotely invoked method it resynchronizes the copies. If the method is invoked on a local object, input object parameters are passed as reference. Copy Input object parameters are passed as deep clones and any changes made to these parameters are not synchronized with the calling method. Copy Input is more efficient than Input whenever a method call using objects crosses physical partition boundaries because in case of Copy Input, there is no need for the object to be resynced after the method call is done and this cuts the amount of traffic cross the process boundaries in half. When an anchored object is passed as an input parameter to a remote method, it is passed as a remote reference(proxy) and referencing this anchored object from the remote partition results in undesireable network traffic and poor performance. There is no difference for scalar parameters. Scalars are always passed by value.

Q. What do I do with a case statement?
Ans. Case statement is to help people to write procedural code.

Q. What is the difference between an event loop and event case statement?
Ans. Event loop continues to wait for events, one must explicitly exit the loop. Event case exits automatically after handling an event.

Q. How do I print a message to log manager?
Ans. task.part.logMgr.putLine('Software development is boring.');
or task.lgr.putline('Houston, We have a problem.');

Q. What is nil?
Ans. An object reference points to nil before it is instantiated or assigned to point to an object. nil is the default value of the non scalar attributes of an object.

Q. How do I run a method asynchronously in Forte'?
Ans. Precede the message with start task keyword.
start task ConsultantSO.WriteCode();

Q. How do I access the current transaction?
Ans. Keyword transaction is a reference to the current transaction.

Q. How do I shutdown a task?
Ans. task.postShutdown();

Collection Classes:

Q. Can I have an array of scalar data types in Forte'?
Ans. Yes, Forte' allow fixed size arrays for all scalars except strings. A fixed size array begins at position 0 and can be created by using the following syntax:
integers : Array[10] of integer

Q. What is the difference between Array and LargeArray?
Ans. LargeArray is more efficient for more than 255 elements.

Q. Is array a fixed size collection?
Ans. No, an array can grow in size.

Q. How do I find the number of elements of an array?
Ans. Items attribute of an array stores the number of its elements.

Q. How do I add an element to an array?
Ans. Array provides appendRow() and insertRow() methods. AppendRow method name is a little bit relational database centric (row). Array and other collection classes should have methods like add() or addElement().

Q. How do I iterate an array?
Ans.

 Forte's provides a procedural kind of syntax for itearation. For eg. 
	Employees: Array of Employee = getEmployees();
	For eachEmployee in employees do
		EachEmployee.Fire();
	End;
Ideally in an OO language, iteration protocol should be implemented as methods of collection classes. 

Q. When do I use a HashTable?
Ans. A hash table stores objects in a keyed table and is very efficient to find an object in a hash table.

Configuration Management:

Q. What is a Repository?
Ans. A Forte' repository is a persistent store for all the classes, methods, plans, libraries, and other Forte' development components.

Q. What is a Workspace?
Ans. A Workspace is a developer's private snapshot view of the components of the central repository baseline. A user can have only one workspace open at a time.

Q. What is a Project in Forte'?
Ans. A Forte' Project is a logical collection of related components like classes, constants, service objects, and cursors.

Q. What is the difference between a Project and a Plan?
Ans. A Forte' Plan is a collection of related components. Project is a subclass of class Plan. Other subclasses of Plan are Business Model, Application Model and Library.

Q. What is a supplier plan?
Ans. Supplier plans are used to reference the components defined in other plans. The components of a plan can be referenced by the components of another plan by defining the first as supplier plan to the second. The Framework project is a supplier plan to all other projects.

Q. Is supplier plan relationship transitive?
Ans. No. If Project A is a supplier plan to Project B and Project B is a supplier to Project C, this doesn't imply that Project A is a supplier to Project C.

Q. Does Forte's allow circular supplier plan references?
Ans. No.

Q. What is the difference between Forte' Standalone and Forte' Distributed?
Ans. Forte' Distributed uses a shared server based development repository whereas Forte' Standalone uses a local development repository.

Q. What is a Shadow repository?
Ans. A Shadow repository is local client-based shadow of the central which is used to reduce server processing and network traffic.

Distributed Computing:

Q. What is a Service Object?
Ans. A Forte' Service Object is a named object that provides a service or a set of centralized operations. A Service object is a distributed object that can be referenced by objects outside of its partition. Service objects are anchored to the partition in which they are instantiated and they can be load balanced for throughput or replicated for failure resilience. Service objects are instantiated when an application is first started and they exist for the duration of an application.

Q. How do I reference a service object from a remote partition?
Ans. Just use it name. Forte' ORB allows objects to reference remote service objects as if they are local objects whereas they may actually exist in different partitions on different machines.

Q. What are the different types of service objects?
Ans. There are three types of service objects based on their class.
1. TOOL class
2. DBSession class
3. DBResourceMgr class

Q. What is the difference between a user visible and an environment visible Service Object?
Ans. A user visible Service object is visible only to its user partition whereas an environment visible service object is visible in all partitions.
A user visible SO is visible to a single partition. This partition may not be the same as one where SO is anchored. User visibility changes with the location of the service object:
(i) If it is anchored in a client partition, it is visible in the client partition only.
(ii) If it is on a server in its own partition with no other objects, it is visible to its caller partition. Each caller partition accesses its own private copy of service object on the server.
(iii) If it is in a server partition with other environment visible service objects, it is only visible to other objects in this partition.

Q. What do I mean by dialog duration of a service object?
Ans. The dialog duration is the time duration during which a caller/sender can reference a particular instance of service object.

Q. What are the different types of dialog duration of a service object?
Ans. (i) Message duration: Dialog is maintained for the duration of a method call. It is used when the sender does not need the service object to remember any info from the previous method calls.
(ii) Transaction duration: It retains the conection between the sender and service object for the duration of transaction. It is used when the sender expects the service object to remember state info for the duration of transaction.
(iii) Session duration: Caller talks with the same instance of service object for the entire duration.

Q.What do I mean by load balanced service object?
Ans. Load balancing creates multiple replicates of the service object's partition. Forte' allows all replicates of a partition to run at the same time. These replicate partitions can be assigned to a single node or to different nodes.

Q. What is a router partition?
Ans. A router partition routes the messages to the partition replicates of a load balanced service object. The router ensures that replicate partitions handle one message at a time and it lives in a separate partition that can be placed on any node.

Q. What do I mean by a service object that is marked for failover protection?
Ans. Marking a service object for failover creates multiple copies of the service object's partition, where only one partition is used at a time. All messages are routed to the primary partition and if the primary partition fails, Forte' automatically switched to a backup partition.

Q. Can I load balance a session dialog duration service object?
Ans. No. Load balancing and session duration are mutually exclusive. In load balancing, a client never knows which instance of replicate service object it will use and this would break the definition of session dialog duration.

Q. What happens when a message duration service object marked for failover fails during dialog with the caller?
Ans. The method is automatically retried on the backup service object and the caller is not informed of the failover.

Q. What happens when a transaction or session duration service object marked for failover fails during dialog with the caller?
Ans. The caller receives an exception. The caller must handle the exception and retry on a backup service object.

Q. What is a Name Server/ Forte' Name Service?
Ans. A Name server allows a client to find a service object.

Q. How do I access currently executing task?
Ans. Task keyword gives the TaskHandle object of the current task

Q. What is a Partition in Forte'?
Ans. A Partition is an independent process that can run on its own machine. Forte distributes an application into partitions.

Q. What is the difference between a logical and an assigned partition?
Ans. A Logical Partition is a logical section of an application that represents either the client portion of the application or one of the servers. An Assigned Partition is a client or server logical partition that will be installed on a particular node in the environment. When Forté partitions an application into logical partitions and these logical partitions are assigned to specific nodes.

Q. How do I get a reference to the current partition?
Ans. Task.Part points to the partition on which the task is currently executing.

Q. What is an anchored object?
Ans. An object that remains in the partition in which it was created and cannot be passed as a copy to other partitions is an anchored object. Anchored objects are accessed as proxies from other partitions. Setting distributed or shared runtime property of an object to true sets its isAnchored attribute to be true.