Clarion (programming language)
Clarion is a commercial, proprietary, 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, 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 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.The generation layer is not required. It is possible to create programs completely at the code level, 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 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.
History
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", 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 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 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 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, 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 was founded in 1987 by Niels Jensen, who had earlier 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 was released in 1993. It was a revolutionary product adding many features and technology that could create programs with a “Windows like” 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 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, file driver system, queues 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 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 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. 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 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 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 was released December 1997, with the final 4.002 release May 1998. TopSpeed elected to skip the dreaded version number three. 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.
Clarion 5 was released May 1998, with the final 5.0B release June 1999. The product was split into Professional and Enterprise editions.
Clarion 5.5 was released August 2000, with the final 5.507 release January 2002. C55 added Interfaces to OOP.
Clarion 6.0 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 ; however, note that the series 6.x of Clarion produces native Win32 executables. 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. 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 include a build system based on MSBuild and backward compatibility with all releases of Clarion going back to Clarion for Windows 1.5.
Clarion is still a Win32 development environment, but a beta.NET version of the Clarion language, called , 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 a single 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 at best.
The new IDE 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.
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
Notability
Clarion is historically notable as being one of the first 4GL computer programming tools, first developed in the 1980s.Criticisms
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.Sub-standard documentation
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 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.
Language properties
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
Data and program Labels are always declared in column 1, code is always indented from column 2 onwards.
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 and either an explicit or implicit end.
For example;
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.
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.Database flexibility
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
Clarion supports both SQL databases and non-SQL data stores. Support for popular ISAM file types are built in and two proprietary ISAM file systems and Clarion ) are also provided.
In the program code Tables are a native data type. Table access is provided by a standard DLL interface 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
TopSpeed
Clipper
DBaseIII
DBaseIV
DOS
FoxPro/FoxBase
Ms-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.
Learning Clarion
Clarion is a simple language, resembling BASIC or PASCAL, but with the addition of Objects and Classes.Dictionary abilities
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 you ever drop that variable on a form in Clarion's IDE, it adopts those properties and they are reflected automatically. In other words, the data dictionary, 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.
The more time a Clarion developer spends 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 and automatic lookup from "child" tables.
Hello World
A demonstration of a Hello World program in Clarion.PROGRAM
MAP
END
CODE
MESSAGE
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
As Clarion# is based on.NET version 4, it allows the developer to use other.NET libraries.The advantage of using Clarion# directly is that the compilation of 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 functionality 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. Unmanaged Exports allows a developer to expose functions developed using.NET 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.