IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
-Collapse +Expand Cross Ref Guide
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesCorel Paradox  Print This     

Corel Paradox and Java Cross Reference Guide

By Mike Prestwood

Corel Paradox versus Java: A side by side comparison between Corel Paradox and Java.

Corel Paradox

Version: This content is based on Corel Paradox 11 (applies to the current version) but applies to earlier versions including Paradox 7, 8 , 9, and 10 as well (differences and exlusions are noted). The versions of Paradox sometimes known as 12, X3, X4, etc. are actually Paradox 11 with a patch (no real new features).

Java

Version: This content is based on jre1.6.0_07 and tested in Eclipse 3.3.2 and/or JBuilder 2008 (which is based on Eclipse 3.3). 

This content focuses on topics in common among the languages documented here so nearly all this syntax applies to other Java development environments as well as earlier versions of Java.

Much of Java's syntax will look similar to both C++ and C# but with significant differences.

Note: To be clear, the subject of this information is generic Java and all code snippets were tested in either Eclipse or in JBuilder by CodeGear (or both). Although much of the information applies to other Java tools, we only verified the syntax and information within Eclipse or JBuilder.

 
Tool Basics
 

Developer environment basics such as common file extensions, common keyboard shortcuts, etc.

Deployment Overview

[Other Languages] 
Corel Paradox: 

To deploy a Paradox application, you need to deploy either the full version of Paradox or the Paradox Runtime both of which will include the BDE as well as any dependecies you've added such as psSendMail DLL, ezDialogs, etc.

More Info / Comment
Java: 

Java applets and applications both require the Java Runtime Environment (JRE) and any additional dependencies you've added.

More Info / Comment




Development Tools

[Other Languages] 

Languages Focus

Primary development tool(s) used to develop and debug code.

Corel Paradox: 

Corel Paradox for Windows (was Borland Paradox). Also, Borland used to offer a Paradox for DOS tool which support it's Paradox Application Language (PAL) which is not compatible with ObjectPAL. The biggest drawback to Paradox is that Corel does not have anyone at Corel actively developing Paradox for Windows (as opposed to Microsoft Access which does).

Java: 

Many compilers and development tools are available. Common development tools include Sun's J2EE, CodeGear JBuilder, and Eclipse.

More Info / Comment




File Extensions

[Other Languages] 

Languages Focus

Common or primary file extensions used (not a complete list, just the basics).

Corel Paradox: 

Paradox for Windows has two primary file types: source files and delivered files:

Source Files
Source files in Paradox are binary but can can be opened in later versions of Paradox and even in earlier versions if you don't use any new features.

  • .FSL = Form
  • .RSL = Report
  • .SSL = Script
  • .LSL = Library

Since Paradox source files do not compile to an EXE, Paradox developers tend to use a startup form or script to start the application.

Java:   .java

The customary primary source file extension for Java code is ".java" which could contain anywhere from a single class to the entire source code.

Other important files:

  • .JAR - Java archive file (compressed code file). Archive that contains multiple Java files and is compressed using .ZIP compression; stores Java classes and metadata and may be digitally signed; runs as a program if the Java Runtime Environment (JRE) is installed on the computer.
  • .CLASS - compiled source code which are platform-independent. If a source file has more than one class, each class is compiled into a separate .class file. These .class files can be loaded by any Java Virtual Machine (JVM).




Overview and History

[Other Languages] 
Corel Paradox: 

Language Overview: Object based language. Although ObjectPAL uses object oriented techniques "under the hood", it is not object oriented. Although you cannot create classes, ObjectPAL has built-in objects you can use in your code. You code in a traditional approach attaching code to objects or within a script. Most Paradox applications are form based. You may have a short startup script but you design forms and reports and tie them together with a common form. You can store reusable code such as custom methods and procedures in a library.

Target Platforms: Corel Paradox is most suitable for creating business desktop applications that run within Corel Paradox for Windows.

More Info / Comment  
Java: 

Promoted as a single source cross-platform runtime system (Write Once, Run Anywhere). Java builds on and in some ways simplifies the object oriented features of C++. Java applications are typically compiled to byte-code and can run on any platform running the Java Virtual Machine (JVM).

Target Platforms: Java is suitable for creating many types of cross-platform applications that target the JVM including desktop business applications as well as Java applets which target all the major web browsers.

More Info / Comment




Report Tools Overview

[Other Languages] 

Languages Focus

Built-In: Some development tools have a reporting tool built-in and some do not. For example, typically desktop databases such as Paradox and Access have a built-in reporting tool and typically that reporting tool is used with nearly every application built with it. A built-in reporting tool makes development of reports across many clients and applications consistent and therefore easy.

Add-On: Development tools that do not have a built-in reporting tool need to use either a currently bundled report writer, or one of the popular reporting tools that integrates well with the development tool. For example, popular reporting tools include Crystal Reports, ReportBuilder, and MS SQL Reporting Services (tied to MS SQL).

Corel Paradox:   Built-In

Paradox offers a built-in reporting tool that will suffice for most desktop database applications.

More Info / Comment
Java: 

Both Eclipse 3.3 and JBuilder 2008 come bundled with Business Intelligence and Reporting Tools (BIRT). BIRT is an Eclipse-based open source reporting system with both a report designer based on Eclipse, and a runtime component that you can add to your app server plus a charting engine that lets you add charts.

More Info / Comment




 
Language Basics
 

Language basics is kind of a catch all for absolute beginner stuff. The items (common names) I chose for language basics is a bit random and include items like case sensitivity, commenting, declaring variables, etc.

Case Sensitivity

[Other Languages] 

Languages Focus

Case sensitiviy in this case is referring to commands and variable names. For example, are "printf" and "PrintF" equivalent? Are fullname and FullName equivalent? When you create commands, operations, methods, or variables should you worry about case?

Corel Paradox:   No

ObjectPAL is not case sensitive. My preference for ObjectPAL is to follow the camel casing promoted in the examples and help files originally developed by Borland.

Syntax Example:  

All of the following are equivalent:

msgInfo "", "Hello"
MsgInfo "", "Hello"
msginfo "", "Hello"
MSGINFO "", "Hello"

Variables are not case sensitive.

Var
FullName String
endVar
fullname="Mike Prestwood"
msgInfo("", fullNAME)
Java:   Yes

Java is case sensitive.

Customary casing:

  • Classes - Initial Caps (Pascal Casing)
  • Variables - Initial lowecase (Camel case)
  • Methods - Initial lowecase (Camel case)
More Info / Comment




Code Blocks

[Other Languages] 

Languages Focus

The rules for code blocks within a language dictate where you can declare variables, how you "bracket" code, etc.

Corel Paradox:   endXxxx

ObjectPAL code blocks are surrounded by statement ending keywords that all use End with camel caps such as endMethod, endVar, endIf, endSwitch, and endTry.

Syntax Example:
method
endMethod
 
var
endVar
 
if
endIf
 
switch
endSwitch
 
try
endTry
Java:   { }

Curly braces are used to bracket code blocks including classes and the methods within a class.

For Java, JavaScript, PHP, and C++, I prefer to put the first { at the end of the first line of the code block as in the example above because I see moreJava codeformatted that way.

Syntax Example:
public class Dog {
  public bark() {
    System.out.println("Ruff");
  }
}




Comments

[Other Languages] 

Languages Focus

Commenting code generally has three purposes: to document your code, for psuedo coding prior to coding, and to embed compiler directives. Most languages support both a single line comment and a multiple line comment. Some languages also use comments to give instructions to the compiler or interpreter.

Corel Paradox:   ; and { ... }

Commenting Code
ObjectPAL uses ; for a single line comment and { } for a multiple line comment.

Syntax Example:  
;Single line comment.

{
Multiple line
comment.
}
Java:   // or /* ... */

Commenting Code
Java uses "//" for a single line comment and /* */ for a multiple line comment.

Syntax Example:
//Single line comment in MS (not ANSI compliant so do NOT use).
/* ANSI compliant single line comment. */
/*
Multiple line
comment.
*/
/*
* This is another popular way 
* to write multi-line comments.
*/




Constants

[Other Languages] 

General Info: Computer Language Constants

A constant is just like a variable (it holds a value) but, unlike a variable, you cannot change the value of a constant.

Corel Paradox:   const..endConst

In ObjectPAL, you declare one or more constant values within a const..endConst block. Optionally, you can specify the dataType by casting the value as part of the declaration.

If you do not specify the data type, the data type is inferred from the value as either a LongInt, a Number, a SmallInt, or a String.

As with variables, the const..endConst block can come within a method or procedure as the first bit of code, or in the Const window. Putting it above the method or procedure is allowed but has no significance so don't.

Syntax Example:
const
kFeetToMeter = Number(3.2808)
kMeterToFeet = Number(.3048)
kName = String("Mike")
  kCA = "California"     ;String inferred.
endConst
[Not specified yet. Coming...]




End of Statement

[Other Languages] 

Languages Focus

In coding languages, common End of statement specifiers include a semicolon and return (others exist too). Also of concern when studying a language is can you put two statements on a single code line and can you break a single statement into two or more code lines.

Corel Paradox:   whitespace

ObjectPAL is a bit unique in that it doesn't use a semicolon nor a return to mark the end of a line, it uses whitespace which can be a return, space, or tab. This is a bit unusual but does allow for some nice formatting of code.

Syntax Example:  
msgInfo("", "Hello1")
msgInfo("", "Hello2")
msgInfo("", "Hello3")

;The following single line of code also works.
msgInfo("", "Hello4") msgInfo("", "Hello5")

;Two or more works too:
msgInfo
("", "Hello6")
Java:   ;
Syntax Example:
System.out.println("Hello");




Literals

[Other Languages] 

General Info: Programming Literals

A value directly written into the source code of a computer program (as opposed to an identifier like a variable or constant). Literals cannot be changed. Common types of literals include string literals, floating point literals, integer literals, and hexidemal literals. Literal strings are usually either quoted (") or use an apostrophe (') which is often referred to as a single quote. Sometimes quotes are inaccurately referred to as double quotes.

Languages Focus

In addition to understanding whether to use a quote or apostrophe for string literals, you also want to know how to specify and work with other types of literals including floating point literals. Some compilers allow leading and trailing decimals (.1 + .1), while some require a leading or trailing 0 as in (0.1 + 0.1). Also, because floating point literals are difficult for compilers to represent accurately, you need to understand how the compiler handles them and how to use rounding and trimming commands correctly for the nature of the project your are coding.

Corel Paradox:   quote

String literals are quoted as in "Prestwood". If you need to embed a quote use a slash in front of the quote as in \".

In ObjectPAL, string literals are limited to 255 characters but there's nothing preventing you from using multiple string literals together as in:

msgInfo("", "You can " + " add literals together in ObjectPAL") 

To specify a floating point literal between 1 and -1, you can preceed the decimal with a 0 or not (both work). In other words, preceding and following decimals are allowed (both .1 and 0.1). Trailing decimals are also allowed (1, 1., and 1.0 are all equivalent and allowed).

Syntax Example:  
msgInfo("", "Hello")
msgInfo("", "Hello \"Mike\".")
  
;Does ObjectPAL evaluate this simple
;floating point math correctly? No!
If (.1 + .1 + .1) = .3 Then
 msgInfo("", "Correct")
Else
 msgInfo("", "Not correct")
EndIf
Java:   quote

String literals are quoted as in "Prestwood". If you need to embed a quote use a slash in front of the quote as in \".

To specify a floating point literal between 1 and -1, you can preceed the decimal with a 0 or not (both work). In other words, preceding and following decimals are allowed (both 1. and 1.0 work as well as .1 and 0.1). In general, Java follows the IEEE 754 Binary Floating-Point Arithmetic standard.

Syntax Example:

System.out.println("Hello");
System.out.println("Hello \"Mike\".");
  
//Does Java evaluate this simple
//floating point math correctly? No!
if ((.1 + .1 + .1) == 0.3) {
System.out.println("Correct");
} else {
System.out.println("Not correct");
}




Variables

[Other Languages] 

Languages Focus

A variable holds a value that you can use and change throughout your code so long as the variable is within scope. With variable declaration, you not only want to know the syntax of how you declare a variable but you also want to know where. Are you allowed to declare a variable inline? What are the available scopes: local vs. global. Can you assign a value at the same time you declare a variable?

Corel Paradox:   var x SmallInt endVar

Declaring variables is optional unless you click Program | Compiler Warnings while in the ObjectPAL editor for every form, script, and library you create. Using Compiler Warnings is strongly recommended to avoid incorrectly typing an existing variable and to avoid any confusion about variable scope. Also recommended is turning on Compile with Debug for every form, script, and library too for tighter, cleaner code.

Undeclared variables are AnyType variables. Common data types include Currency, Date, Datetime, Logical, LongInt, Number, SmallInt, String, and Time.

Syntax Example:
var
    FullName String
    Age SmallInt
    Weight Number
endVar
 
FullName = "Mike Prestwood"
Age = 32
Weight =154.4
msgInfo("", FullName + ", age=" + String(Age) 
             + ", weight=" + String(Weight))
Java:   int x = 0;

Variable names are case sensitive.

The Java basic types are boolean, byte, short, int, long, float, double, and char. You can also declare a variable to hold a particular instance of a class such as String.

Syntax Example:

C++, Java, and C# all use C-like variable declaration.

int a;
int a, b;
int age = 43;
String FullName;




 
Language Details
 

Language Details is kind of a catch all for stuff that didn't make it into language basics nor any other category.

Custom Routines

[Other Languages] 

Languages Focus

For non-OOP languages, a custom routine is a function, procedure, or subroutine and for pure OOP languages, a custom routine is a class method. Hybrid languages (both non-OOP and OOP) combine both.

Corel Paradox:   method, procedure

ObjectPAL is a non-OOP language (an object-based language) that offers custom methods and custom procedures. When you create a custom method, you associate it with an existing object like a button, form, or library.

When calling a custom method or procedure that has a by reference parameter (uses var), then you cannot use a literal value. this is different than in many other languages which do allow you to pass literals by reference.

Syntax Example:
method sayHello(var pName String)
 msgInfo("", "Hello " + pName)
endMethod

method add(p1 Number, p2 Number) Number
 Return p1 + p2
endMethod
Java: 

Because java is an OOP language, all custom routines belong to a specific class and are therefore referred to as methods.

All methods in Java must return something so even with procedures, you return a "void".

Syntax Example:
public void sayHello(String pName) {
  System.out.println("Hello" + pName);
}
 

public int add(int p1, int p2) {
  return p1 + p2;
}




Inline Code

[Other Languages] 

Languages Focus

Also known as embedded code where you embed another syntax language within the native code of the development environment you are using. The inline code can be compiled by the current development's compiler or by an external compiler.

Do not confuse with inlining which is a coding technique where custom routines are moved inline where the code is executed either by you, by a compiler directive, or automatically by the compiler.

Corel Paradox:   Not Supported
Java:   Not Supported

You cannot embed assembly in a java program but you can get system information via jni.





Inlining

[Other Languages] 

General Info: Inline Routines

Instead of calling a routine, you move the code from the routine itself and expand it in place of the call. In addition to manual inlining, some languages support automatic inlining where the compiler or some other pre-compiler decides when to inline a code routine. Also, some languages allow for developer defined inlining where the developer can suggest and/or force the inlining of a code routine. Inlining can optimize your code for speed by saving a call and return, and parameter management.

Languages Focus

Does it support inlining? If so, does it support developer defined inlining? Does it support automatic inlining? Both?

Corel Paradox:   Not Supported
Java:   Automatic

The Java compiler automatically inlines when it determines  a benefit. The use of final methods is considered a compiler hint to tell the compiler to inline the method if beneficial.

More Info / Comment




Overloading

[Other Languages] 

Types of overloading include method overloading and operator overloading.

Method Overloading is where different functions with the same name are invoked based on the data types of the parameters passed or the number of parameters. Method overloading is a type of polymorphism and is also known as Parametric Polymorphism.

Operater Overloading allows an operator to behave differently based on the types of values used. For example, in some languages the + operator is used both to add numbers and to concatenate strings. Custom operator overloading is sometimes referred to as ad-hoc polymorphism.

Corel Paradox: 

Paradox & Overloading

  • Operator - No.
  • Method - No.

However, you can have the same named method or procedure so long as they are in different libraries. This is important if you use libraries in a class-like OOP way and wish to implement some form of polymorphism (i.e. libMember.Open and libVendor.Open). This is an OOP-like technique for implementing a subtyping-like polymorphism which is also known as inclusion polymorphism.

Also, some developers like to pass an array and then handle the array for a pseudo technique. Although not overloading, it's useful.

Java: 

Java Overloading

  • Operator - No. Sun deliberately chose not include operator overloading in the Java language.
  • Method - Yes.




Parameters

[Other Languages] 
Corel Paradox:   var, const

By Reference or Value (and by constant)
The default for parameters is by value. For by reference, add var in front of the parameter. ObjectPAL also offers constant parameters where you add const in front of the parameter. A constant parameter is like a read-only parameter the compiler can optimize. You cannot assign a value to a constant parameter.

Syntax Example:  
method cmCode(s String) ;...s is by value.
endMethod
 
  
method pushButton(var eventInfo Event)
  ;...eventInfo is by reference.
endMethod
  
method cmCode(Const s String)
  ;...s is a constant read-only parameter.
endMethod
  
proc cpNever() String
  return "Never duplicate a line of code!"
endProc

[Not specified yet. Coming...]




Self Keyword

[Other Languages] 
Corel Paradox:   Self

A built-in object variable that represents the UIObject to which the currently executing code is attached.

Syntax Example:  
method pushButton(var eventInfo Event)
  msgInfo("", self.Name)
endMethod
Java:   this




 
Data Structures
 

Data structures allow you to store and work with data. Common data structures include arrays, associative arrays, etc.

Array

[Other Languages] 

Languages Focus

A data structure in which individual values (called elements or items) may be located by reference to one or more integer index variables, the number of such indices being the number of dimensions in the array.

Arrays can start with an index value of 0 or 1, sometimes referred to as 0 based or 1 based.

Corel Paradox:   Array[] type

Arrays in ObjectPAL use a 1-based subscript (also known as an index). Use [] with a subscript to refer to an element (i.e. MyArray[1], MyArray[2]).

The number of elements for a given array in ObjectPAL are either fixed or resizeable. Specify the size when you declare it for fixed. Use size() to get the number of elements, size() returns 0 if the array has no elements. Use setSize(), grow(), addLast(), etc. to add elements to an array.

Syntax Example:

var
  MyArray Array[4] String ;Fixed size array.
  i LongInt
endVar

MyArray[1] = "Mike"
MyArray[2] = "Lisa"
MyArray[3] = "Felicia"
MyArray[4] = "Nathan"

if MyArray.size() > 0 then
  for i from 1 to MyArray.size()
    msgInfo("", MyArray[i])
  endFor
endIf

[Not specified yet. Coming...]




Associative Array

[Other Languages] 
A set of unique keys linked to a set of values. Each unique key is associated with a value. Think of it as a two column table. MyArray['CA'] = 'California' MyArray['AR'] = 'Arizona'

Languages Focus

Associative arrays are also known as a dictionary or a hash table in other languages.

Corel Paradox:   DynArray

In ObjectPAL associative arrays are known as dynamic arrays.

Syntax Example:
var
myDynArray   DynArray[] String
endVar

 
myDynArray["Last_Name"] = "Spitz"
myDynArray["First_Name"] = "Randy"
myDynArray.view()
Java:   HashMap()

An associative array links a set of keys to a set of values. In Java, associative arrays are implemented as Maps.

This will print "Arizona."

Syntax Example:
import java.util.*;

public class Maps
{
    public static void main(String[] args)
    {
        Map states = new HashMap();
       
        states.put("CA", "California");
        states.put("FL", "Florida");
        states.put("AZ", "Arizona");

        System.out.println(states.get("AZ"));
    }
}




Pointers

[Other Languages] 

General Info: Pointers / References

A pointer is a variable type that allows you to refer indirectly to another object. Instead of holding data, a pointer holds the address to data -- the address of another variable or object. You can change the address value a pointer points to thus changing the variable or object the pointer is pointing to.

A reference is a type of pointer that cannot change and it must always point to a valid storage (no nulls).

Corel Paradox: 

ObjectPAL doesn't have a developer defined pointer type except for use with DLLs where you use a special CPTR uses keyword to refer to a DLL string pointer data type.

Syntax Example:  
Uses Tapi32
  tapiRequestMakeCall(sNumber CPTR, sAppName CPTR, 
    sLogName CPTR, sComment CPTR) CLONG
endUses
Java:   Not Supported

Java does not offer developer defined pointers.





 
Statements
 

Common statements such as if statements, loops, etc.

Exception Trapping

[Other Languages] 

Languages Focus

A common usage of exception handling is to obtain and use resources in a "try-it" block, deal with any exceptions in an "exceptions" block, and release the resources in some kind of "final" block which executes whether or not any exceptions are trapped.

Corel Paradox:   try...onFail

ObjectPAL has a try...onFail statement but does not have a finally-type component. However, the code afer endTry will execute.

try
onFail
endTry
Syntax Example:
var
i SmallInt
endVar
try
i = 0
i = 1/i
onFail
msgInfo("", "You cannot divide by zero.")
endTry
Java:   try/catch/finally
Syntax Example:
try {
  /* Risky code here. */
}
catch (SomeException) {        //one or more.
  /* Recovery here. */
}
finally {                      //0 or one.
  /* Do something. */
}




If Statement

[Other Languages] 
Corel Paradox:   If..Else..EndIf, or switch

ObjectPAL supports a simple If...Else...EndIf statement.

Notice ObjectPAL does not support an ElseIf feature as part of an if statement. Instead use a switch statement

Syntax Example:  
'Does ObjectPAL evaluate the math correctly? No!
If (.1 + .1 + .1) = .3 Then
  msgInfo("", "Correct")
Else
  msgInfo("", "Not correct")
EndIf
 
'Switch statement example.
switch
case x = "Nate": MsgInfo("", "Hi Nate")
case x = "Felicia": MsgInfo("", "Hi Felly")
  otherwise: MsgInfo("", "Who are you?")
endSwitch
Java:   if..else if..else

Syntax template:

if (expression) {
  expression1_true_code;
} else if (expression2) {
  expression2_true_code;
} else {
  otherwise_code;
}
Syntax Example:
if ((.1 + .1 + .1) == 0.3) {
  System.out.println("Correct");
} else {
  System.out.println("Not correct");
}




 
Operators
 

A language symbol used for assignment, comparison, computational, or as a logical.

Assignment

[Other Languages] 

Languages Focus

Common assignment operators for languages include =, ==, and :=. An assignment operator allows you to assign a value to a variable. The value can be a literal value like "Mike" or 42 or the value stored in another variable or returned by a function.

Corel Paradox:   =

ObjectPAL uses = for it's assignment operator.

Syntax Example:  
var
 FullName String
   Age SmallInt
endVar
  
FullName = "Randy Spitz"
Age = 42
Java:   =

Java uses = for it's assignment operator.





Comparison Operators

[Other Languages] 

General Info: Round Floating Point Numbers

When comparing floating point numbers, make sure you round to an acceptable level of rounding for the type of application you are using.

Languages Focus

A comparison operator compares two values either literals as in "Hello" and 3 or variables as in X and Counter. Most languages use the same operators for comparing both numbers and strings. Perl, for example, uses separate sets of comparison operators for numbers and strings.

Corel Paradox:   =, <>

Common comparison operators:

= equal
<> not equal
< less than
> greater than
<= less than or equal
>= greater than or equal

Syntax Example:
'Does ObjectPAL evaluate the math correctly? No!
If .1 + .1 + .1 = .3 Then
msgInfo("", "correct")
Else
msgInfo("", "not correct")
endIf
Java:   ==, !=

The Java comparison operators are:

== equal
!= not equal
< less than
> greater than
<= less than or equal
>= greater than or equal

More Info / Comment




Empty String Check

[Other Languages] 

Languages Focus

An empty string is a zero length string, a string that is equal to null (""), or not assigned. In some languages, you can check if a string is empty by comparing it to an empty string (""). Some languages distinguish between nil and null ("") so checking if the length is 0 is easier.

Corel Paradox:   isBlank() or not isAssigned()

In ObjectPAL, an empty variable can be unassigned (essentially null) or blank (equivalent to ""). You have to use both isBlank and isAssigned to check for an empty string.

Syntax Example:
var
 s String
endVar
  
;s = ""  ;Uncomment to test 2nd case.
 
if isBlank(s) or not isAssigned(s) Then
 msgInfo("", "empty string")
endIf
Java:   IsEmpty




Logical Operators

[Other Languages] 

Languages Focus

Logical operators perform conditional and, or, and not operations. Some languages support both binary logical operators that link two and unary logical operators negate (make opposite) the truth value of its argument. Finally, some languages short circuit logic. For example, with this or that, if this is an expression returning true, then that is never executed.

Corel Paradox: 

ObjectPAL logical operators:

and and, as in this and that
or or, as in this or that
Not Not, as in Not This

Like VBA, ObjectPAL never short circuits. Given the expression this or that as well as this and that, if this evaluates to false, then that is still executed.

Syntax Example:
;Given expressions a, b, c, and d:
if Not (a and b) and (c or d) then
  ;Do something.
endIf
Java: 

Java logical operators:

&& and, as in this and that
|| or, as in this or that
! Not, as in Not This
& boolean logical OR (not short circuited)
| boolean logical OR (not short circuited)
?: Ternary (short for if-then-else)
~ Unary bitwise complement
<< Signed left shift
>> Signed right shift
>>> Unsigned right shift
^ Bitwise exclusiv OR

Syntax Example:
//Given expressions a, b, c, and d:
if !((a && b) && (c || d)) {
  //Do something.
}




String Concatenation

[Other Languages] 
Corel Paradox:  "String Concatenation" +

String literals s are limited to 255 characters but you can simply add two strings together as in:

s = "A long string." + "Another long string."
Syntax Example:
var
FirstName  String
  LastName  String
endVar
 
FirstName  = "Mike"
LastName  = "Prestwood"
msgInfo("", "Full name: " + FirstName + " " + LastName)
Java:  "String Concatenation" + or append

In Java, you use either the String concatenation + operator or StringBulder class methods such as append. Since Java compilers frequently create intermediate objects when the + operator is used and don't when StringBuilder.append is used, the append method is faster than the + operator.

In general, use the convenience of a + operator when speed is not an issue. For example, when concatenating a small number of items and when code isn't executed very frequently. A decent rule of thumb is to use the + operator for general purpose programming and then optimize the + operator with StringBuilder.append as needed.

Syntax Example:

Simple + operator example:

System.out.println("Hello" + " " + "Mike.");

 

Using StringBuilder example:

StringBuilder myMsg = new StringBuilder();

myMsg.append("Hello ");
myMsg.append("Mike.");
 
System.out.println(myMsg);




Unary Operators

[Other Languages] 

General Info: Unary Operator

An operation with only one operand (a single input). Common unary operators include + plus, - minus, and bitwise not. Some operators can function as both unary and binary operators. For example, + and - operators can serve as either.

Languages Focus

What unary operators are supported in additoin to the standard plus, minus, and bitwise not.

Corel Paradox: 

The ObjectPAL unary operators are:

+
-
Not

More Info / Comment
Java: 

An operation with only one operand (a single input). The Java unary operators are ++, --, +, -, ~, and !.

  • + Indicates positive value (numbers are positive without this)
  • - Negates an expression
  • ++ Increment operator by 1
  • -- Decrement operator by 1
  • ! Logical complement operator (inverts the value of a boolean)
  • ~ Bitwise inversion operator (works on integral data types)
More Info / Comment




 
Commands
 

Common commands (procedures and functions). A function returns a value. Optionally, it may also perform an action prior to returning a value. A procedure does not return a value or it returns void or null.

Left of String

[Other Languages] 
Corel Paradox:   subStr

substr ( const startIndex LongInt [ , const numberOfChars LongInt ] ) String

Alternative syntax:

LeftString = subStr(NameVar, 1, 3)
Syntax Example:
var
�LeftString String;
  NameVar String;
endVar
NameVar = "Prestwood"
LeftString = NameVar.subStr(1, 3)
msgInfo("", LeftString)
[Not specified yet. Coming...]




 
Database
 

This category documents connecting and using data including database commands, and common technologies used.

Edit Record

[Other Languages] 

Languages Focus

This common syntax name documents editing a record as a whole: add/insert, edit, post data, and delete.

Corel Paradox:   insertRecord, postRecord, edit

In ObjectPAL, you use Cursor.InsertRecord to add a new record, Cursor.postRecord to post the record, and Cursor.deleteRecord() to delete it. To edit a record, you must put the cursor into edit mode, Cursor.Edit(). (A cursor applies to both a TCursor and UIObject.)

ObjectPAL gives you tremendous flexibility with editing data and includes many additional commands such as insertAfterRecord and isEdit. For dBASE tables, you can also use unDeleteRecord() to un-delete a record. See the ObjectPAL help for more commands.

Syntax Example:

The following code snippet adds a record to a given TCursor with FullName and Created fields:

tc.edit()
tc.InsertRecord()
tc.FullName = "Barack Obama"
tc.Created  = today()
tc.postRecord
[Not specified yet. Coming...]




Filter Records

[Other Languages] 
Corel Paradox:   setRanger, setGenFilter

In ObjectPAL, you can filter set a TCursor, UIObject, and Table objects using setRange() and setGenFilter().

Syntax Example:

The following example loads, filters, and runs a report.

var
 r Report
 dyn DynArray[] String
endVar
  
dyn["Name"] = "SCUBA Heaven"
Customer.setGenFilter(dyn)
  
r.load(":Sample:customer")
r.Customer.setGenFilter(dyn)
r.run()

You can also drop a flter with:

r.Customer.dropGenFilter()
[Not specified yet. Coming...]




Find Record

[Other Languages] 

Languages Focus

Finding a record is about moving a cursor to a specific record within a set of records (documented here). In addition to finding a record, you can sort, filter, and loop a set of records (documented in their topics).

Corel Paradox:   locate, qLocate

ObjectPAL provides a rich set of commands for finding a record with a TCursor or UIObject including:

  • locate() -  Seach for a value based on a criteria. Uses indexes as appropriate.
  • locatePattern() - Search for a pattern within a value.
  • moveToRecord() - Moves to a specific record number.
  • qLocate() - Search using currently set index.

Each of these basic find record commands has supporting commands such as locateNext() and recNo().

Syntax Example:
var
  tc TCursor
endVar
   
tc.open("Customer.db") 
if tc.locate("Name", "Proffessional Divers, Ltd.") then 
  tc.edit()
  tc.Name = "Professional Divers, Ltd."
  msgInfo("Success", "Corrected spelling error.")
endIf
tc.endEdit()
[Not specified yet. Coming...]




Record Movement

[Other Languages] 

Languages Focus

Top, bottom, next, and previous.

Corel Paradox:   home, end, nextRecord

ObjectPAL uses home(), end(), nextRecord(), priorRecord() to move a database cursor (works with either a TCursor or UIObject).

TCursor.nextRecord()

These commands send a message to the object. Specifically, they send an action constant using the action command. The above snippet is equivalent to:

TCursor.action(DataNextRecord)

It is handy to  with familiar with action constants because not all action constants have an ObjectPAL equivalent comment.

Syntax Example:

The following snippet uses the active keyword to move to the second to last record of the table attached to the UIObject that currently has focus:

active.end()
active.priorRecord()

You can also use the self keyword to refer to the UIObject your code is attached to.

[Not specified yet. Coming...]




Sort Records

[Other Languages] 
Corel Paradox:   switchIndex, sortTo, setGenFilter

In Paradox, you add an index for each sort your wish to perform on a table then use switchIndex(). Alternatively, you can use sortTo() to sort a table into a new table.

More Info / Comment
[Not specified yet. Coming...]




 
OOP Basics
 

Some languages support object-based concepts such as Paradox, Access, and VB Classic. Other languages have OO extensions and fully support object orientation in a hybrid fashion (such as C++ and Dephi for Win32). Finally, some lanages such as C#, VB.Net, Prism, and Java are entirely written in OO. Meaning, every line of code written must occur within a class).

Base Class

[Other Languages] 

Languages Focus

When you create a class, it is either a base class or inherits from another class. Some languages require all classes to inherit from a common base class and some do not.

Corel Paradox:   Not Supported
Java:   Object

The Object class is Java's single base class all classes ultimately inherit from.

Syntax Example:
public class Cyborg {
}

or you can specify the base class (or any other class):

public class Cyborg extends Object {
}




Class..Object

[Other Languages] 

Languages Focus

In short, a class is a data type, and an object is an instance of a class type. A class has methods (routines), properties (member variables), and a constructor. The current values of the properties is the current state of the object. The UML is one of the diagraming disciplines that allows you to document the various changing states of a series of objects.

Corel Paradox:   Not Supported
Java:   class..new

Unlike languages such as C++ and Object Pascal, every line of code written in Java must occur within a class.

Syntax Example:
//Declare class.
public class Cyborg {
  //Fields.
  private String cyborgName;
  private int age;
 
  //Constructor.
  public Person() {
  cyborgName = "unknown";
  age = 0;
  }
}
//Create object from class.
Cyborg p = new Cyborg();
p.getClass(); //From the Object base class.




Inheritance

[Other Languages] 

The concept of a class makes it possible to define subclasses that share some or all of the main class characteristics. This is called inheritance. Inheritance also allows you to reuse code more efficiently. In a class tree, inheritance is used to design classes vertically. (You can use Interfaces to design classes horizontally within a class tree.) With inheritance, you are defining an "is-a" relationship (i.e. a chow is-a dog). Analysts using UML call this generalization where you generalize specific classes into general parent classes.

Corel Paradox:   Not Supported

ObjectPAL does not support class creation nor sub-classing (inheritance).

Java:   extends ParentClass

Simple syntax example of class inheritance.

Syntax Example:

In the following example, a terminator T-600 is-an android. 

public class Android {
}
 
public class T-600 extends Android {
}




Member Field

[Other Languages] 

Also known as a Class Field.

A class variable defined with a specific class visibility, usually private visibility. A member property is different than a member field. A member property uses a member field to store values through accessor methods (getters and setters). For example, it is common to use a private member field to store the current value of a property. The current values of all the class member fields is the current state of the object.

Languages Focus

What modifiers apply to member fields, if any? Typical member field modifiers include scope modifiers (private, protected, etc.) and read-only. Can you initialize the value of a member field when declared ensuring a default value?

Corel Paradox:   Not Supported
Java: 

In Java, you can set the scope of a field member to public, protected, or private. Additional modifiers are static, abstract, final (assign only once), strictfp (strict floating point values) transient (do not save to persistent storage), and volatile (all threads see same value).

You can initialize member fields as in:

int age = 0;
More Info / Comment




Member Method

[Other Languages] 

Also known as a Class Method.

A code routine that belongs to the class or an object instance (an instance of the class). Methods that belong to the class are called class methods or static methods. Methods that belong to an object instance are called instance methods, or simply methods.

When a method returns a value, it is a function method. When no value is returned (or void), it is a procedure method.

Methods frequently use method parameters to transfer data. When one object instance calls another object instance using a method with parameters, you call that messaging.

Corel Paradox:   Not Supported
[Not specified yet. Coming...]




Member Modifier

[Other Languages] 

Languages Focus

Traditional private, protected, public, etc. member modifiers are documented under the member visibility topic of the Cross Reference Encyclopedia. With member modifiers here, we address additional member modifiers such as method and field modifiers.

Corel Paradox:  "Member Modifiers" Not Supported
[Not specified yet. Coming...]




Member Property

[Other Languages] 
Corel Paradox:   Not Supported
[Not specified yet. Coming...]




Member Visibility

[Other Languages] 

General Info: Class Visibility Specifiers

In OOP languages, members of a class have a specific scope that indicates visibility. Standard visibility includes private, protected, and public. Private members are usable by the defining class only (fully encapsulated). They are invisible outside of the class except by friendly classes. Protected members are usable by the defining class and descendant classes only (plus friendly classes). Public members are usable wherever its class can be referenced.

Languages Focus

Traditional member visibility specifiers for fully OOP languages are private, protected, and public. Many modern OOP languages implement additional member visibilities.

Additional member modifiers are documented under the Member Modifiers topic.

Corel Paradox:   Not Supported
[Not specified yet. Coming...]




 
OOP Details
 

More object oriented (OO) stuff.

Abstraction

[Other Languages] 

General Info: Abstract Class / Abstract Member

An abstract class member is a member that is specified in a class but not implemented. Classes that inherit from the class will have to implement the abstract member. Abstract members are a technique for ensuring a common interface with descendant classes. An abstract class is a class you cannot instantiate. A pure abstract class is a class with only abstract members.

Languages Focus

Abstraction is supported at various levels with each language. A language could enforce abstraction at the class level (either enforcing a no-instantiation rule or a only abstract members rule), and with class members (member methods and/or properties).

Corel Paradox:   Not Supported
Java:   abstract

Java supports marking a full class as abstract as well as class members. A subclass must either implement the abstract members or you must declare the subclass abstract (which delays the implementation to it's subclass).

Syntax Example:
public abstract class Dog {
  abstract void Bark();
}




Class Helper

[Other Languages] 

A. In Dephi, class helpers allow you to extend a class without using inheritance. With a class helper, you do not have to create and use a new class descending from a class but instead you enhance the class directly and continue using it as you always have (even just with the DCU).

B. In general terms, developers sometimes use the term to refer to any class that helps out another class.

Corel Paradox:  "Class Helpers" Not Supported
Java:  "Class Helpers" Not Supported

However, developers sometimes use the term "class helper" to refer to code that helps out a class. Not truly the meaning we are using here, but you should be aware of the term's general usage.





Code Contract

[Other Languages] 

A.k.a. Class Contract and Design by Contracts.

A contract with a method that must be true upon calling (pre) or exiting (post). A pre-condition contract must be true when the method is called. A post-condition contract must be true when exiting. If either are not true, an error is raised. For example, you can use code contracts to check for the validity of input parameters, and results

An invariant is also a code contract which validates the state of the object required by the method.

Corel Paradox:  "Code Contracts" Not Supported
[Not specified yet. Coming...]




Constructor

[Other Languages] 

General Info: Class Constructor

Constructors are called when you instantiate an object from a class. This is where you can initialize variables and put code you wish executed each time the class is created. When you initially set the member fields and properties of an object, you are initializing the state of the object. The state of an object is the values of all it's member fields and properties at a given time.

Languages Focus

What is the syntax? Can you overload constructors? Is a special method name reserved for constructors?

Corel Paradox:  "Constructors" Not Supported
Java:  "Constructors" Use class name

A method with the same name as the class.

Syntax Example:  
public class Cyborg{
  //Constructors have the same name as the class.
  public Cyborg() {
  }
}




Destructor

[Other Languages] 

General Info: Class Destructor

A special class method called when an object instance of a class is destroyed. With some languages they are called when the object instance goes out of scope, with some languages you specifically have to call the destructor in code to destroy the object, and others use a garbage collector to dispose of object instances at specific times.

Desctructors are commonly used to free the object instance but with languages that have a garbage collector object instances are disposed of when appropriate. Either way, destructors or their equivalent are commonly used to free up resources allocated in the class constructor.

Languages Focus

Are object instances freed with a garbage collector? Or, do you have to destroy object instances.

Corel Paradox:   Not Supported
Java:  "finalize" finalize()

Java has a garbage collection algorythm that runs as a background task so it has no destructors. You can use the finalize() method to close additonal resources such as file handles.

Syntax Example:
protected void finalize() throws Throwable {
try {
close(); // close open files
} finally {
super.finalize();
}
}




Inheritance-Multiple

[Other Languages] 
Corel Paradox:   Not Supported
Java:   Interfaces Only

Java does not support multiple implementation inheritance. Each class can have only one parent class (a single inheritance path). In Java, you can use multiple interface usage to design in a multiple class way horizontally in a class hierarchy.

More Info / Comment




Interface

[Other Languages] 

An element of coding where you define a common set of properties and methods for use with the design of two or more classes.

Both interfaces and abstract classes are types of abstraction. With interfaces, like abstract classes, you cannot provide any implementation. However, unlike abstract classes, interfaces are not based on inheritance. You can apply an Interface to any class in your class tree. In a real sense, interfaces are a technique for designing horizontally in a class hierarchy (as opposed to inheritance where you design vertically). Using interfaces in your class design allows your system to evolve without breaking existing code.

Corel Paradox:  "Interfaces" Not Supported
Java:  "Interfaces" Yes




Overriding

[Other Languages] 

General Info: Method Overriding

Where you define or implement a virtual method in a parent class and then replace it in a descendant class.

When you decide to declare a method as virtual, you are giving permission to derived classes to extend and override the method with their own implementation. You can have the extended method call the parent method's code too.

In most OO languages you can also choose to hide a parent method. When you introduce a new implementation of the same named method with the same signature without overriding, you are hiding the parent method.

Corel Paradox:   Not Supported
[Not specified yet. Coming...]




Partial Class

[Other Languages] 

A partial class, or partial type, is a class that can be split into two or more source code files and/or two or more locations within the same source file. Each partial class is known as a class part or just a part. Logically, partial classes do not make any difference to the compiler. The compiler puts the class together at compile time and treats the final class or type as a single entity exactly the same as if all the source code was in a single location.

Languages Focus

For languages that have implemented partial classes, you need to know usage details and restrictions. Can you split a class into two or more files? Can you split a class within a source code file into two or more locations? What are the details of inheritance? Does it apply to interfaces as well?

Corel Paradox:  "Partial Classes" Not Supported
Java:  "Partial Classes" Not Supported




Polymorphism

[Other Languages] 

A coding technique where the same named function, operator, or object behaves differently depending on outside input or influences. Usually implemented as parameter overloading where the same named function is overloaded with other versions that are called either with a different type or number of parameters. Polymorphism is a general coding technique and other specific implementations are common such as inheritance, operator overloading, and interfaces.

Languages Focus

Many languages support built-in polymorphism such as a "+" operator that can add both integers and decimals. The following documents the ability to implement developer defined polymorphism.

Corel Paradox:   Not Supported

Built-in: In ObjectPAL, polymorphism is the capability of the built-in objects to act differently depending on the context in which they are being used. For example, Table.Open and TCursor.Open. The Open method works differently depending on the object type used.

Custom: No. However, you can have the same named method or procedure so long as they are in different libraries. This is important if you use libraries in a class-like OOP way and wish to implement some form of interfaces-like polymorphism (i.e. libMember.GetName and libVendor.GetName).

More Info / Comment
[Not specified yet. Coming...]




Prevent Derivation

[Other Languages] 

Languages Focus

How do you prevent another class from inheriting and/or prevent a class from overriding a member.

Corel Paradox:   Not Supported
Java:  "final class" Final

In Java, there is the concept of a final class.

More Info / Comment




Static Member

[Other Languages] 

General Info: Static Class / Static Member

A static member is a member you can have access to without instantiating the class into an object. For example, you can read and write static properties and call static methods without ever creating the class. Static members are also called class members (class methods, class properties, etc.) since they belong to the class and not to a specific object. A static class is a class that contains only static members. In the UML, these classes are described as utility classes.

Languages Focus

Languages that support static members usually at least support static member fields (the data). Some languages also support static methods, properties, etc. in which case the class member is held in memory at one location and shared with all objects. Finally, some languages support static classes which usually means the compiler will make sure a static class contains only static members.

Corel Paradox:  "Static Members" Not Supported
Java:  "Static Members" static

When calling a static method from within the same class, you don't need to specify the class name.

Syntax Example:
class MyUtils {
//Static method.
  public static void MyStaticMethod() {
}
}




Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]