Clarion (programming language)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Clarion
Developer(s) JPI, Clarion International, SoftVelocity
Stable release 9.1 / July 29, 2014; 4 months ago (2014-07-29)
Operating system Microsoft Windows
Type Integrated development environment
Website www.softvelocity.com

Clarion is a commercial, 4GL, multi-paradigm, programming language and Integrated Development Environment from SoftVelocity used to program database applications. It is compatible with ISAM, SQL and ADO data access methods, reads and writes several flat file desktop database formats including ASCII, CSV, DOS (Binary), FoxPro, Clipper, dBase, and some relational databases via ODBC, MS SQL Server, Sybase SQL Anywhere and Oracle through the use of accelerated native database drivers, and XML, Clarion can be used to output to HTML, XML, plaintext, and PDF, among others.

One of the Clarion Development Environment's primary features is its use of templates which are used in conjunction with a code generator to produce much of the repetitive, time consuming code that is typically required when producing an application. An "embeditor" shows the developer the code that will be generated and embed points where the developer can enter their own hand-code in the context of the template generated code. Clarion programmers can create their own templates, or edit the existing ones.

History[edit]

The first release of the Clarion language was a DOS product called Clarion 1.0 and was first released in April 1986. Clarion was created by Bruce Barrington, one of the founders of healthcare firm "HBO & Company" (later acquired by McKesson Corporation[1]), and a small team of developers. Barrington's goal was to create a language that would be compact and expressive, and would maximize the use of the memory-mapped screen of the IBM PC by creating a screen designer. Version 1 produced pseudocode; the initial release included a screen designer, an interpreter, an editor, and a debugger. Initially it supported databases composed of DAT files and Clarion’s proprietary ISAM file format. Bruce Barrington formed Barrington Systems and released version 1.0.

Clarion 1.0 required the use of a dongle, at a time when industry sentiment was turning against dongles, which was offset by the ability to create royalty-free applications. However the dongle was removed with the release of 1.1.

At the same time, an even more basic version was sold. Called Personal Developer, it was very limited in what the user could do, but was adequate for very basic database applications. And it was a fraction of the cost of Professional Developer 1.x.

Version 2.0, released in May 1988, was known as Clarion Professional Developer, or CPD, and included a component called Designer, which incorporated a data dictionary. CPD generated Clarion code based on the contents of that dictionary and a template called a "model file." Because the model file was a text file, it could be modified (in limited ways) to create custom code. The model file was implemented with the "browse and form" paradigm, where data is initially displayed to the user in list box, and updating is done via a form called via buttons associated with the list. Designer created all the essential of the CRUD (create, read, update, delete) code, and developers could enhance functionality by inserting code at specified points in the generated code, or by hand-coding new procedures. Clarion Professional Developer also introduced Language Extension Modules (LEMs), that could extend the Clarion language using modules compiled in other languages that were built to the LEM format. Clarion Software and many third-party tool developers created LEMs for all purposes, including an extension for connecting to other databases such as dBase, Clipper and Paradox.

CPD 2.x was a database solution with everything required for screens, reports, databases and help files. A version of Clarion 2.x for end-users, Clarion Personal Developer, was also released just for the business user creating his own personal applications. Around the same time period, Clarion released Clarion Report Writer. This was created as both a stand-alone product for end-users of Clarion Personal Developer and users of programs written by developers with CPD, and as a built-in program bundled with Clarion Professional Developer version 2.1 released in 1989.

In 1991 Barrington licensed compiler technology from a company called Jensen & Partners International (JPI).

JPI was founded in 1987 by Niels Jensen, who had earlier (1979 or 1981) been one of the founders of Borland. Philippe Kahn was the marketing personnel who built Borland around the $99 Turbo Pascal compiler. Niels and his team were working on a new compiler technology at Borland when Philippe Kahn decided to buy Wizard C, and call it Turbo C. Niels and several other developers left Borland and started JPI, where they continued to work on their compiler technology, christened TopSpeed, which they bought from Borland for $1.7 million.

Clarion Database Developer 3.0 (CDD) was released in 1993. It was a revolutionary product adding many features and technology that could create programs with a “Windows like” CUA (Common User Access) user interface. Much of the CDD changes fit well into the Windows programming paradigm and laid the groundwork for the future Clarion for Windows product.

The CDD IDE was completely new and based on the JPI IDE. It included many professional programmer quality tools: editor, project system, compiler, linker, visual debugger. Gone was the p-code of CPD. The JPI compiler for the Clarion language produced true machine code EXEs, LIBs and DLLs. Binaries could be compiled for Protected Mode allowing DOS programs to use extended memory breaking the 640KB barrier.

The Clarion 3.0 language was enhanced in many ways, e.g.: new data types (CSTRING, PSTRING, DATE, TIME, USHORT, ULONG), file driver system (e.g. Btrieve, Clarion, Dbase, FoxPro, Paradox), queues (tables) were enhanced, screen processing was enhanced for CUA. Code generation by Models was replaced by “templates” that had more features and were extensible. This allowed generation of much more robust and complex code.

With all this new power came complexity. Many existing users found the transition to CDD difficult. CPD was simple and easy to use which attracted many non-programmers that could build programs by answering questions. CDD was more suited to professional programmers. Programs could still be developed as easily, but the size and vast features of the IDE made it appear complex.

The first 5 patch releases of CDD were buggy to the point of being unusable, which caused so many users to abandon the product that it was nearly a complete disaster for the company. Clarion kept working on CDD and by version 3.007 it was usable.

Version 3.1 named Clarion for DOS (CFD) was released in 1995. This proved much more stable, but by this time there was little interest in DOS development tools. A significant feature was the TopSpeed file driver, an ISAM file format allowing all indexes and multiple data files to be contained in one disk file.

During this time the relationship between Clarion Software and JPI grew closer, and on April 30, 1992, Clarion merged with JPI to form an entity which would eventually be called TopSpeed Corporation. The employees at the TopSpeed Development Centre in London went to work on CDD and ironed out many of the bugs.

TopSpeed released Clarion for Windows version 1.0 (aka CW 1.0) in January 1995. The final 1.003 release was June 1995. The IDE was completely written as a Windows GUI and could produce Win16 EXE and DLL binaries to run under Windows 3.x. The language featured many enhancements required to support the event driven Windows user interface. A Clarion developer could easily create a multithreaded MDI application. CW 1.0 continued the database flexibility added in CDD as well as adding an ODBC driver allowing connection to SQL databases, or any source supported by ODBC.

The DOS monolithic template model was significantly enhanced in CW 1.0 and replaced by a model that allowed a window to use multiple templates (Extension, Control or Procedure templates). For example, in DOS a screen procedure could support browsing a single data table. Under CW 1.0 a Window could use multiple Browse Control Templates each one displaying a different table. This design change was a major improvement in the power of Clarion code generation.

Clarion for Windows version 1.5 (aka CW 1.5) was released September 1995, with the final 1.502 release January 1996. This version added support for creating native Win32 binaries for Windows 95 and Windows NT 4. The same source could target Win16 or Win32. The IDE remained 16-bit but added 32-bit compilers, linker and debugger.

Clarion for Windows version 2 (aka CW20) was released in June 1996, with the final 2.003 release March 1997. CW20 added classic object orientation to the language, including inheritance, encapsulation, virtual methods and overloading. CW20 enhanced 32-bit support, added ActiveX support and enhanced SQL support.

Clarion 4 (aka C4) was released December 1997, with the final 4.002 release May 1998. TopSpeed elected to skip the dreaded version number three (the official explanation was that CW 1.5 "should have been CW 2.0," so CW 2.0 "should have been CW 3.0", so let’s just call the next one version 4). Due to DOS development being dead the name dropped the "for Windows" title.

C4 came with a new template set and class library called "Application Builder Classes" or “ABC”. The original template set generated procedural code, which was becoming increasingly complex. The ABC template set generated far less code, and leveraged the class library, which contained most of the actual logic for windows, browses, forms, etc. C4 enhanced OOP by adding Constructors and Destructors (without parameters).

Clarion 5 (aka C5) was released May 1998, with the final 5.0B release June 1999. The product was split into Professional and Enterprise editions.

Clarion 5.5 (aka C55) was released August 2000, with the final 5.507 release January 2002. C55 added Interfaces to OOP.

Clarion 6.0 (aka C6) was released November 2003, and added direct support for pre-emptive multi-threading.

Clarion 6.1 was released May 2004.

Clarion 6.2 was released May 2005.

Clarion 6.3 as released Jan 2006. Excluding patches this is the final release of the 16 bit Clarion development environment. The use of a 16 bit IDE produced some problems using current Windows technologies (ActiveX, OCX, COM, DOC, ...); however, note that the series 6.x of Clarion produces native Win32 executables (32-bit exes and/or dlls). Previous versions produced both 16-bit and 32-bit executables, the 16-bit support was dropped from the end-user product with version 6.0 of Clarion.

On April 13, 2009 SoftVelocity released Clarion 7 (aka C7). The new IDE will look familiar to SharpDevelop users; SoftVelocity obtained a commercial license for the SharpDevelop code and integrated Clarion's code generation and application generation technology. Major new features (other than the standard modern IDE features lacking in C6) include a build system based on MSBuild and backward compatibility with all releases of Clarion going back to Clarion for Windows 1.5.

C7 is still a Win32 development environment, but a beta .NET version of the Clarion language, called Clarion#, is available. Both Clarion# and C7 share the same IDE, although at present they are shipped as separate products. Unlike C7, Clarion# does not yet have a dictionary editor or application generator. When Clarion# goes gold it is expected that a single IDE will support both Win32 and .NET development.

The new IDE (in Clarion# mode) retains the ability to build .NET applications with VB.NET and C#.

On September 12, 2011 SoftVelocity released Clarion 8. It continues the line of Clarion 7 (the latest release was C7.3).

The actual running version (August 2014) is C9.1.11139, which was released as GOLD -- meaning perceived by the development team as being ready to use as a stable release.

Notability[edit]

Clarion is historically notable as being one of the first 4GL computer languages, first developed in the 1980's.

To this day, it is used world-wide and remains among the most versatile 4GL ("writes the code for you") and concurrent application development environments available, rivaling many other 4GL environments, including "Magic", and most notably IBM's "Sign-On" 4GL language for their "iSeries", formally known as "AS/400" series of mid-range Computer Ranges.

It has a vibrant community, is used by 1/3rd of the Fortune 500's Top Companies, and has decades of dedicated systemic thought behind it. The SoftVelocity Compiler Team originates from the Borland Compiler Team, which had Niels Rymenams, currently Microsoft's lead Architect of the .NET Environment as part of it's early development team.

Historically, it was the first 4GL Development Environment available for MS-DOS. And it is current. Windows 7 x86 and x64 are fully supported, as are any O/S environments that are able to consume Web-Based content it can deliver.

Thanks to the developer community libraries written in .NET can be consumed in Clarion through the use of the Unmanaged Exports nuget package https://www.nuget.org/packages/UnmanagedExports.

Clarion is a data-centric language, meaning that its primary function is the management and manipulation of data. Thus the language has commands that deal directly with the reading and writing of databases.

Clarion is able to produce as a standalone application an "EXE" that embeds, natively, not only the DLL's or any libraries it might need, but also full database and reporting output requirements it may require. It is unique in that it can produce an EXE that can be sent with no 3rd party installs (like database servers) required.

The Clarion TopSpeed (.TPS) database format is capable of supporting up to 4 dimensions in a single column definition within any table. No version of SQL Server is capable of supporting this at present. This means that it is possible to define a single field, with multiple dimensions, as simply as (of any of the supported data types, which include ALL of the data types supported in most databases), as:

Dimension 5,2,100, 2000

So in ONE field (Column), in this example, you can reference up to 5 x 2 x 100 x 2000 elements, uniquely. In a single row, or record. A Clarion Developer can refer to for example:

Long I# = CUS:DescendantNamesAcrossTheUniverseIdNumber[1,2,51,1500]

A number of International Companies make use of this product as the core of their development, using Clarion's ability to tap into .NET's capabilities with ease, and call any .DLL's methods developed in VB, C#, C++, Delphi, C++ or C.

The Clarion 4GL Application Generator is currently able to produce .NET ASP.NET code as output as well as the other formats it supports, and still data types which have been "pushed under the radar" (un-documented at any level) by Microsoft AND SoftVelocity and are yet are still supported in .NET, for example, the "BSTR" or "BSTRING" data type native to the Windows API.

Criticisms[edit]

Clarion's biggest criticism is the close-knit community, and loyalty to the language, to the degree that knowledge is guarded, and unlike other development environments where individuals freely distribute 3rd Party Tools and installers, Clarion Developers tend to value the developmental advantage they have over 3GL developers (like those using C#, Delphi, C, C++, Visual Basic etc.), and, detrimentally, perpetuate the reputation language as a fringe language. Knowledge is power, and Clarion Developers tend to keep this edge over other developers to themselves, to the detriment of other Clarion Developers.

Clarion is 100% database agnostic. So the target Database is of little consequence to a typical Clarion Developer. While it does ship with a native "TPS" flat file (MIKSAM-Based) format database driver built in, it can equally as easily can address MSSQL, ORACLE. DB2, or literally almost ANY database server environment it likes. Making it as scalable as any other development environment, with the advantage of being able to transparently address any number of database platforms simultaneously --- using the same code base.

The suggested "limitations" of its native TPS flat file format are documented below, where this format has capabilities not currently matched by ANY other database driver -- most notably, multi-dimensioned fields, which still remain a thorn in the side of all non-Clarion Developers.

Being Proprietary, Clarion, like most other vendors, provides ODBC drivers to access their native TPS database format from other platforms. These drivers have not been revised for a number of years, and are no doubt not meant to be used in a production environment, but rather to port data from the TPS flat file format to ANY of the enormously scalable database systems it supports.

Properties[edit]

Clarion is very similar to current mainstream languages, in that it does require every code block to be contained in a begin-end block, except for Routine declarations which automatically terminate on the next declaration of one. So this, for example is required:

If A# = 5 then
  J# = A# * 3
end


or, as Clarion allows, the use of the "end", you can use the period "." character in place of the "end" keyword, as in the example below:

If A# = 5 then
  J# = A# * 3
.   ! < --- Note this period.  It is the equivalent of an "end".


You can drop the "then" keyword, so it now becomes...

If A# = 5 
  J# = A# * 3
.   ! < --- Note this period.  It is the equivalent of an "end".


Or place it one one line (DO NOT FORGET THE PERIOD! This a common error and can cause endless compiler-error problems...)

If A# = 5 then J# = A# * 3. ! NOTE -- the "." at the end of the line is the equivalent of an "end".

Use of Templates[edit]

Clarion generates its code by means of templates. Tried and tested over many years, rock-solid base code is produced as a result. Although the templates are editable, the template generated code is not. So this leaves Clarion Developers with the option of (a) modifying the templates (by means of a fully-documented Template Language Reference), or (b) Creating templates that produce code that is exactly as they want it to produce the code it generates.

Wide Variety of 3rd Party Extensions / Inter-Language Support[edit]

A number of 3rd Party Vendors, most notably "CapeSoft", based in South Africa, (http://www.capesoft.com), produces a wide variety of advanced "add-ins", that extend the capabilities of Clarion. It must be noted however, that most 3rd Party Vendors do "wrap" other language capabilities into their products, which is something that any Clarion Developer familiar with any of these other languages is quite capable of doing themselves.

An example of the combining the capabilities of Clarion with other languages and platforms, thereby extending Clarion's native capabilities can be found at http://www.chilkat.com , which has library offerings allowing for integration of Clarion projects with the following languages/platforms, which Clarion is easily able to integrate into any of its products:

Android™ Classic ASP C C++ C# Delphi ActiveX Delphi DLL Visual FoxPro Java MFC Objective-C Perl PHP ActiveX PHP Extension PowerShell Python Ruby SQL Server Unicode C Unicode C++ Visual Basic 6.0 VB.NET VBScript

Database Flexibility[edit]

Clarion is data-centric, meaning it is designed to be used among a wide variety of database vendors, and is focused around the data. This means a table which is targeted at for example a .TPS file can be fairly easily ported to a Microsoft-SQL table, by simply choosing the new database target (MSSQL), and providing the required Ms-SQL database accessibility criteria (eg. ServerName, DatabaseName, UserName, Password).

This is on of Clarion's most powerful capabilities -- the code it produces supports any of the database drivers it ships with -- most times without the need for code changes at all. The language "translates" into the relevant language required for the database transparently, allowing the Clarion Developer to not have to deal with low level issues.

Clarion natively supports the following database formats, including, but not limited to:

ASCII Basic BTrieve Clarion (.DAT) TopSpeed (.TPS) Clipper DBaseIII DBaseIV DOS FoxPro/FoxBase Ms-SQL (T-SQL) ODBC (here you can go DB/2 or any other database that supports ODBC -- so in reality, ANY database format that has an ODBC driver available for it) Pervasive SQL SQLLite MySQL Oracle

In addition, due to its ability to readily interact with any .NET Class Library, it is able to leverage off of any of the very latest technologies from a database perspective, including ASP.NET and any others that Microsoft makes available. Including Windows Communication Foundation, Windows Communication Foundation, and Windows Workflow Foundation. Of any version.

Learning Clarion[edit]

Clarion is a language that is very easy to learn. The "Learning Clarion" PDF can be read in a day or two. However, in order to begin programming in clarion, you must purchase the Clarion compiler/development platform, which has an entry level cost of over $1000.

Flexibility[edit]

Clarion supports strongly typed data types, implicit variables, and also "variants" (that is, data of any type that are interpreted by the compiler, and the required data conversions done automatically). Some Examples:

Implicit variables:

I# = 0

J# = 5

K# = 10

I# = J# + K#

Here, I# (which is a 32 bit integer), would equal 15.

Variants: "Mixed data types taken care of by the compiler"

So if you declared "MichaelsAge" as a STRING, it would be quite legal to write:

A# = 10

MichaelsAge = 'The age of Michael is ' & A#

Which would give the value of the STRING variable MichaelsAge as: "The age of Michael is 10"

Dictionary Abilities[edit]

In all of the areas of the "data dictionary data declaration sections", namely the "global data section", the "module-specific data declaration section", and the "local data data declaration sections", when you declare a (simple or complex data type or variable), you can also declare it's "prompt, or label", "mask", or "picture", whether it is read-only on not, to be skipped on the form or not, the foreground and background color, transparency, and a whole host of other attributes.

So that if you ever drop that variable on a form in Clarion's IDE (Designer), it adopts those properties automatically, and they are reflected automatically. In other words, the data dictionary (or 'database' in SQL terms), contains not only information about the data itself, but also information about how it should be represented in applications which make use of the "database" declaration itself.

Therefore, the more time a Clarion Developer spends time defining the data-dictionary, the more time they will save later on when the 4GL application generator produces output, typically lists of data with full CRUD capabilities, validation, automatic lookup from "child" table capabilities etc.

Hello World[edit]

A demonstration of a Hello World program in Clarion.

 PROGRAM
 
 CODE
 MESSAGE('Hello World!','Clarion')
 RETURN

Programing for Non-Programmers[edit]

The sample code shown in the "Hello World" example is an example of "hand-written" code, which the Clarion compiler will gladly compile.

Because Clarion, as a 4GL language, is template-based, and the code the templates produce are consistent and have been refined over decades. This allows programmers who choose to use clarion, to quickly throw together prebuilt application modules built by other developers.

The Global Map[edit]

One of the things Clarion includes is what is called "Global Map".

Inside here, procedure definitions are declared, including, if required, declarations to external DLL's or Libraries written in non-Clarion languages. For use by the Clarion application. Clarion also has the ability to generate DLL's that can be consumed by external non-Clarion applications, taking full advantage of all of Clarion's 4GL capabilities and simply "plugging in" to the procedures it has created.

Within this MAP, it is able to leverage of all of the Windows-API declarations, using, if required, the no-longer documented data types that are core to the Windows O/S. Easily.

Interop with .NET Libraries[edit]

Thanks to support from the developer community, Clarion is able to access some of the current .NET functionality. Unmanaged Exports, a nuget package developed by Robert Gieseck (https://www.nuget.org/packages/UnmanagedExports), allows you expose functions developed in a .NET library to native languages on Windows. This is helpful for those who are forced to maintain a Clarion product but have no way of upgrading third party tools due to lack of support. Most of the third party tools can be rewritten in .NET with ease.

References[edit]

  1. ^ "Health Care Services Leader McKesson’s History | Our History". McKesson. Retrieved 2012-03-14. 

External links[edit]