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)(Learn how and when to remove this template message)
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.
The Clarion Development Environment (IDE) sits on top of the Clarion Programming 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 actual 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.
|Developer(s)||JPI, Clarion International, SoftVelocity|
Clarion 10 / September 2015
|Operating system||Microsoft Windows|
|Type||Integrated development environment|
The generation layer is not required. It is possible to create programs completely at the code level (the so-called 3GL layer), bypassing all the 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 functionality 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 the 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. A large collection of templates have been written by various developers some of which are offered as commercial add-ons and some of which are free.
There are several Clarion products available; Clarion Professional Edition, Clarion Enterprise Edition and Clarion.Net.
- 1 History
- 2 Notability
- 3 Criticisms
- 4 Language Properties
- 5 Use of Templates
- 6 Wide Variety of 3rd Party Extensions / Inter-Language Support
- 7 Database Flexibility
- 8 Learning Clarion
- 9 Dictionary Abilities
- 10 Hello World
- 11 Programming for Non-Programmers
- 12 The Global Map
- 13 Interop with .NET Libraries
- 14 References
- 15 External links
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), 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 (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 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 (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 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 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 (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 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 (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.0 (a.k.a. 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 (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 functionality. 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).
In August 2014 C9.1 Gold was release.
The actual running version (November 2015) is C10 Gold +
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 Edition of Clarion, at the time of this writing. It is thus not possible to produce a simple "Hello World" program in Clarion, without purchasing a license first.
Clarion's documentation is of a varying standard with the mixture of "Enterprise Level" and ".NET" capabilities being intertwined into a single, one-serves-all Help Source.
This can result in some functionality being described in the help (together with code snippets) where that functionality 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 as well.
Clarion is an imperative programming language which supports an Object Orientated Programming syntax. The Clarion programming 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 indentation is optional.) The code syntax most resembles BASIC and PASCAL in structure, although the language itself is quite different to 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 in place of the END statement.
If x = 5 y = z * 3 .
Code can be concatenated onto a single 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 capable of generating any text based file, and are not limited to Clarion Language statements.
Wide Variety of 3rd Party Extensions / Inter-Language Support
The Clarion language is capable of interacting with DLL's produced by other languages. It is compatible with libraries using the PASCAL method or C method of parameter passing. Windows 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 around the data.
This focus on the data 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 itself.
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 what 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 (known as 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 itself.
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 Pervasive SQL SQLLite MySQL Oracle ADO
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 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.
Clarion is a simple language, resembling BASIC or PASCAL, but with the addition of Objects and Classes.
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.
A demonstration of a Hello World program in Clarion.
PROGRAM MAP END CODE MESSAGE('Hello World!','Clarion') RETURN
Programming for Non-Programmers
The sample code shown in the "Hello World" example is an example of "hand-written" code, which the Clarion compiler will gladly compile. 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 non-programmers and programmers with limited skills or abilities. It is possible for non-programmers to generate sophisticated "data based" programs while at the same time either writing no language code at all or by adding only minimal amounts of their own code.
The Global Map
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
Using Clarion# it allow the developer to use any .NET code because Clarion# is a .NET language, its last version is based in .NET 4 same as the IDE of Clarion 10.
The advantage of using Clarion# directly is that the compiler at the end of the compilation of the Clarion# DLL will generate a LIB file compatible with Clarion for Windows and allow a Clarion for windows program to call the .NET functionality in the Clarion# DLL in the same way of any other Win32 DLL.
If the Clarion developers want to use any other code in other languages then they can use 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.
- "Health Care Services Leader McKesson’s History | Our History". McKesson. Retrieved 2012-03-14.
- 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
- 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
- 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