Clarion (programming language)
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
|Paradigms||Imperative, structured, object-oriented|
|Developer||Jensen & Partners International (JPI), Clarion International, SoftVelocity|
|First appeared||April 1986|
11 / October 2018
Clarion is a commercial, proprietary, fourth-generation programming language (4GL), multi-paradigm, programming language and integrated development environment (IDE) from SoftVelocity used to program database applications. It is compatible with indexed sequential access method (ISAM), Structured Query Language (SQL), and ActiveX Data Objects (ADO) data access methods, reads and writes several flat file desktop database formats including ASCII, comma-separated values (CSV), DOS (binary), FoxPro, Clipper, dBase, and some relational databases via ODBC, Microsoft SQL Server, Sybase SQL Anywhere, and Oracle Database through the use of accelerated native database drivers, and XML, Clarion can be used to output to HTML, XML, plain text, and Portable Document Format (PDF), among others.
The Clarion development environment (IDE) runs on the Clarion language. The IDE provides code generation facilities via a system of templates which allow programmers to describe the program from an abstract level higher than code statements. The generator then turns this higher level into code, which in turn is then compiled and linked using a normal compiler and linker. This generation layer is sometimes referred to as 4GL programming. Using the generation layer is optional. It is possible to create programs fully at the code level (the so-called 3GL layer), bypassing all code generation facilities.
If the templates are used to generate code, then programmers are able to inject their own code into the generated code to alter, or extend, the functions offered by the template layer. This process of embedding code can be done while viewing the surrounding generated code. This mixing of template code and generated code allows the template settings to be updated, and the code regenerated, without loss of the embedded code.
The templates (from which the code is generated) are provided in source form and developers are free to create their own templates. Many templates have been written by various developers: some are offered as commercial add-ons, and some are free.
Three main Clarion products exist: Professional Edition, Enterprise Edition, and .NET.
The first release of the Clarion language was a DOS product named 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,) 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 which was Clarion’s proprietary ISAM file format. Bruce Barrington formed Barrington Systems and released version 1.0.
Clarion 1.0 required use of a dongle, at a time when industry sentiment was turning against dongles. This was offset by the ability to create royalty-free applications. The dongle was omitted with release 1.1.
At that time, an even more basic version was sold. Named Personal Developer, it strictly limited what a user could do, but was adequate for very basic database applications. It cost far less than Professional Developer 1.x.
Version 2.0, released in May 1988, was named Clarion Professional Developer (CPD), and included a component named 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 functions 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 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 for the business user to create personal applications. Around then, 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 named 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 person who built Borland around the $49 Turbo Pascal compiler. Niels and his team were working on a new compiler technology at Borland when Kahn decided to buy Wizard C, and name it Turbo C. Niels and several other developers left Borland and started JPI, where they continued to work on their compiler technology, named 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" Common User Access (CUA) 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 programming 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 dynamic-link libraries (DLLs). Binaries could be compiled for protected mode allowing DOS programs to use extended memory, breaking the 640 KB 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 generating 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 nonprogrammers 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 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 named TopSpeed Corporation. Employees at the TopSpeed Development Centre in London went to work on CDD and resolved many of the bugs.
TopSpeed released Clarion for Windows version 1.0 (a.k.a. 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 on Windows 3.x. The language featured many enhancements needed 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 one data table. Under CW 1.0 a Window could use multiple Browse Control Templates, each displaying a different table. This design change was a major improvement in the ability of Clarion code generation.
Clarion for Windows version 1.5 (a.k.a. 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 code could target Win16 or Win32. The IDE remained 16-bit but added 32-bit compilers, linker, and debugger.
Clarion for Windows version 2 (a.k.a. CW20) was released in June 1996, with the final 2.003 release March 1997. CW20 added classic object-oriented programming features to the language, including inheritance, encapsulation, virtual methods, and overloading. CW20 enhanced 32-bit support, added ActiveX support and enhanced SQL support.
Clarion 4 (a.k.a. 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 named Application Builder Classes (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 logic for windows, browses, forms, etc. C4 enhanced OOP by adding constructors and destructors (without parameters).
Clarion 5 (a.k.a. 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 (a.k.a. C55) was released August 2000, with the final 5.507 release January 2002. C55 added Interfaces to OOP.
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 (a.k.a. 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, fixed and extended the basic functions. 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 back to Clarion for Windows 1.5.
Clarion is still a Win32 development environment, but a beta .NET Framework version of the language, named Clarion#, is available. Both Clarion# and C7 share the same IDE, although at present they are shipped as separate products. Unlike Clarion 7 and later releases, Clarion# does not yet have a dictionary editor or application generator. It was expected that one Clarion7+/Clarion.Net IDE would have supported both Win32 and .NET development. However, given that at least 14 years have passed since Clarion.Net was announced without a gold release, Clarion.Net's future is unclear.
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).
In August 2014 C9.1 Gold was released.
In November 2015, Clarion 10 was released.
In October 2018, Clarion 11 was released.
C10 was re-worked to build up on .NET 4
Clarion is historically notable as being one of the first 4GL computer programming tools, first developed in the 1980s.
No trial version available
There is no trial version of any Clarion edition, as of 2016. It is thus not possible to produce a simple "Hello World" program in Clarion, without buying a license first. A free Clarion Community Edition was announced at the Clarion International Developers Conference (CIDC) in 2019 but has not yet been made available. 
Clarion's documentation is of a varying standard with the mixture of "Enterprise Level" and ".NET" abilities being combined into one, for-all Help Source.
This can result in some functions being described in the help (together with code snippets) where that function is not in the specific product being used. For example, Clarion.Net documentation is included, even when the clarion.Net product is not installed. Documentation specific to one product though is clearly labelled as such.
The documentation has lagged behind the product and it is clear that it is not completely reviewed with every release. For example, there are numerous references to "Clarion 7" within the "Clarion 9" documentation. This problem is evidenced at the "Tutorial" and "Sample Application" level also.
Clarion is an imperative programming language which supports an object-orientated programming syntax. The language is case insensitive. Line Endings are treated as implicit statement terminators, unless an explicit line continuation character is used. Data and program labels are always declared in column 1, code is always indented from column 2 onwards. Further indenting is optional. The code syntax most resembles BASIC and Pascal in structure, although the language is quite different from those.
Code blocks typically have an implicit start (no BEGIN word is used) and either an explicit or implicit end.
If x = 5 y = z * 3 end
A period can be used instead of the END statement.
If x = 5 y = z * 3 .
Code can be concatenated onto one line using the ; separator (or in the case of IF a THEN statement).
If x = 5 then y = z * 3.
Note the period which is terminating the IF statement block.
Use of templates
Clarion generates its code by means of templates. Code generated by templates tends to be very reliable especially if the template has been in use for some time.
Templates are shipped in source form, and can be edited, however the editing of shipping templates is not recommended. The code generated by templates can be augmented, or altered by either creating additional custom templates or embedding specific code.
The templates are able to generate any text based file, and are not limited to Language statements.
Wide variety of 3rd-party extensions, interlanguage support
The Clarion language can interact with DLL's produced by other languages. It is compatible with libraries using the Pascal method or C method of parameter passing. Windows application programming interface (API) calls can be made directly from the language.
Clarion is data-centric, meaning it is designed to be used among a wide variety of database vendors and is focused on the data.
This data-focus starts with the Data Dictionary which is a method for formally declaring data tables. This dictionary is then used extensively by the templates when generating the program. Changes at the dictionary level can cascade into the program, causing automatic changes to the program.
The data dictionary provides a vendor independent method for declaring tables, which in turn means that changing a program from one database vendor to another is relatively straightforward, within the constraints of which features the chosen database provides.
Clarion supports both SQL databases and non-SQL data stores. Support for popular ISAM file types (dBase, Btrieve, etc.) are built in and two proprietary ISAM file systems (Topspeed (TPS) and Clarion (DAT)) are also provided.
In the program code Tables are a native data type. Table access is provided by a standard DLL interface (termed a database driver) which separates the program from the chosen data store. This abstraction allows the chosen backend to change with either no, or minimal, changes to the program.
Clarion natively supports many database formats, including, but not limited to:
- Clarion (.DAT)
- TopSpeed (.TPS)
- Ms-SQL (T-SQL)
- Pervasive SQL
- ADO (ActiveX Data Objects)
The ODBC driver allows access to any ODBC source. Firebird and Postgres are both popular options which are accessed via ODBC.
In addition, due to its ability to readily interact with any .NET class library, it is able to leverage any of the 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.
Clarion is a simple language, resembling BASIC or Pascal, but with objects and classes added.
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 its "prompt, or label", "mask", or "picture", whether it is read-only on not, whether or not it is to be skipped on the form, the foreground and background colors, transparency and a whole host of other attributes.
If that variable is entered on a form in Clarion's IDE, it adopts those properties and they are reflected automatically. The data dictionary (or 'database' in SQL terms), contains information about the data, and about how it should be represented in applications which make use of the "database" declaration.
The more time a Clarion developer spends defining the data-dictionary, the more time they will save later when the 4GL application generator produces output, typically lists of data with full CRUD abilities, validation, and automatic lookup from "child" tables.
An example "Hello World" program in Clarion:
PROGRAM MAP END CODE MESSAGE('Hello World!','Clarion') RETURN
Programming for nonprogrammers
The sample code shown in the "Hello World" example is an example of hand-written code, which the Clarion compiler will compile readily. However, most developers do not write whole programs at the code level, but make use of the templates to generate code.
Because of this ability to describe a program at a level higher than code, Clarion has been most popular with both nonprogrammers and programmers with limited skills or abilities. It is possible for nonprogrammers to generate sophisticated data based programs while writing no language code, or by adding only minimal amounts of their own code.
The Global Map
One Clarion feature is named Global Map.
Inside it, procedure definitions are declared, including, if needed, declarations to external DLL's or libraries written in non-Clarion languages. For use by the Clarion application. Clarion also can generate DLL's that can be consumed by external non-Clarion applications, taking full advantage of all of Clarion's 4GL abilities and simply plugging in to the procedures it has created.
Within this MAP, it is able to leverage all of the Windows-API declarations, using, if needed, the no-longer documented data types that are core to the Windows operating system (OS).
Interoperate with .NET libraries
As Clarion# is based on .NET version 4 (the same version used to develop the Clarion 10 IDE), it allows the developer to use other .NET libraries.
The advantage of using Clarion# directly is that compiling a Clarion# DLL generates a LIB file that is compatible with Clarion for Windows and allows a Clarion for Windows program to call the .NET functions in the Clarion# DLL in the same manner as for other Win32 DLLs.
If a Clarion developer wants to use code compiled using other languages, they can use Unmanaged Exports - a NuGet package developed by Robert Gieseck (https://www.nuget.org/packages/UnmanagedExports). Unmanaged Exports allows a developer to expose functions developed using .NET to native languages on Windows. This is helpful for those who must maintain a Clarion product but have no way to upgrade third party tools due to lack of support. Most of the third party tools can be rewritten in .NET with ease.
- "Health Care Services Leader McKesson's History: Our History". McKesson. Archived from the original on 2012-03-13. Retrieved 2012-03-14.
- "Clarion Community Edition". 30 September 2019.
- Topspeed and Wise Solutions Form Business Alliance
- Modeling Data and Designing Databases
- Topspeed Ships Clarion Internet Edition
- Clarion Versions
- InformationWeek Clarion Cuts Down On Coding
- Official website, SoftVelocity
- SoftVelocity Official Development Blog
- SoftVelocity Official Web Forums Archived 12 May 2008 at the Wayback Machine
- Online Magazine for Clarion software development
- ClarionLive! Weekly Clarion Webinar held by Clarion Developers
- Data Management Center : ANY format DataBases and tables (TPS-DAT-CSV-SQL-MDB-XLS etc...) for ALL (including Clarion) software users - no more...
- SetupBuilder Installation System for Clarion software developers
- Thin@ Thin Client for developing SaaS Business Internet Applications with Clarion
- Comp.Lang.Clarion UseNet Group
- Clarion Integrator .Net
- Clarion FreeImage, an Image control utilizing the FreeImage library
- Clarion Templates, some free and some paid for
- Need A Clarion Programmer?