Clarion (programming language)
From Wikipedia, the free encyclopedia
Clarion | |
Latest release: | 6.3 / 2006-01-18 |
---|---|
OS: | Microsoft Windows |
Use: | Integrated development environment |
Website: | www.softvelocity.com |
Clarion is a 4GL 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 popular flat file desktop database formats including ASCII, CSV, DOS (Binary), FoxPro, Clipper, dBase, or all SQL RDBMS databases via ODBC, MS SQL Server, Sybase SQLAnywhere 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. As of the time of writing (2006), Clarion is on version 6.3.
Database access is simple to implement, and list box formatting can be handled with easy to use WYSIWYG (What you see is what you get) formatting windows.
One of Clarion's strong points is its use of "templates" which are used in conjunction with a code generator (named AppGen) to produce much of the repetitive, yet 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 his/her own hand-code in the context of the template generated code.
Templates are open for developers to modify to suit their needs, and the template language, though very robust, is simple to learn. This makes the possibilities of what can be done in Clarion endless. Many companies sell third party templates to extend the functionality that comes "out of the box" with the Clarion product, as does SoftVelocity itself.
Development of templates that generate Microsoft .NET code from Clarion applications is underway at SoftVelocity, which will give Clarion developers the best of both worlds: Clarion developers will be able to program with the ease and speed they're accustomed to, and will be able to provide .NET code to clients who just have to have projects developed in Microsoft technology.
Contents |
[edit] History
The first release of the Clarion language was a DOS product called Clarion 1.0 and was first released in April of 1986. Clarion was created by Bruce Barrington, the founder of healthcare giant HBO and Company (now McKesson), and a small team of developers. Barrington's goal was to create a language that was both 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, Clarion’s proprietary, and quite flexible, 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. But Clarion also let you create royalty-free applications, which was a big plus, particularly for small, independent developers. And the dongle was gone by 1.1.
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 also implemented Clarion's signature "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.
Clarion Professional Developer was wildly successful, and won PC Magazine's editors choice for best database development environment.
Clarion’s popularity grew, and a sizable number of non-programmers took to the product as well, simply because Designer made it possible to create useful database applications with very little work. CPD 2.x was an out of box 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. About the same time, 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.
During the 1980-1995 period, Clarion competed with dBase, R:Base, Data Ease, Clipper, FoxPro, Paradox, and other DOS products. Clarion has survived while many of these are gone.
Barrington had grand plans for Clarion, including a true, multi-platform version that would run on Unix as well as Windows. In 1989, Clarion Software began a complete rewrite of the Clarion programming language. Realizing he needed outside help, Barrington licensed compiler technology from a small 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 wizard who built the Borland empire around the $99 Turbo Pascal compiler. Niels and his team were hard at work on some terrific 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. All the TopSpeed compilers, including Pascal, C, C++ and Modula 2, created compatible binary code, so you could mix and match languages within a single application (a capability .NET would make mainstream a few decades later).
The next release of Clarion was Clarion Database Developer 3.0 (CDD). CDD had much more sophisticated template technology, and a common database grammar combined with various database drivers which made it much easier to plug and play different databases. But CDD was, at least initially a complex and buggy product, delivered at a time when few developers were choosing new DOS tools. CDD 3.0 was nearly a complete disaster for the company.
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 bright minds at the TopSpeed Development Centre in London went to work on CDD and ironed out many of the bugs. And they went to work on the first release of Clarion for Windows, more commonly known as CW (although later releases would drop the "for Windows" part of the name).
Clarion for Windows version 2 added object orientation to the language, including inheritance and interfaces. Not so mysteriously, 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). Clarion 4 (no longer “Clarion for Windows”) also came with a new template set and class library called “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.
Clarion’s current release is 6.3. The IDE is still mainly a 16 bit tool. This 16 bit history 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 bits exes and/or dlls). Previous versions produced both 16 bits and 32 bits executables, the 16 bit support was dropped from the end-user product with version 6.0 of Clarion.
The next major releases of Clarion will be Clarion 7 (which is promised to have a 32 bit IDE) and Clarion.NET. Both products will share a new .NET-based IDE, which incorporates significant parts of a licensed version of the SharpDevelop environment.
[edit] Properties
The language is somewhat like a mix of Basic, Pascal, and Cobol that is compact yet expressive. It avoids annoying requirements like Pascal's requirement that every code block is contained in a begin-end block.
[edit] Code sample (Clarion for Windows)
Absmax PROCEDURE(LONG[,] a, *LONG OutMaxX, *LONG OutMaxY),LONG ! The absolute greatest element of the matrix is returned to caller as are its positions ! Call by address is done with the * similar to C x LONG,AUTO ! Loop variable y LONG,AUTO ! Loop variable m LONG(0) ! Maximum return value CODE OutMaxX = 1 OutMaxY = 1 LOOP x = 1 TO MAXIMUM(a[],1) BY 1 LOOP y = 1 TO MAXIMUM(a[],2) BY 1 IF ABS(a[x, y]) > m m = ABS(a[x, y]) OutMaxX = x OutMaxY = y END END END RETURN m
[edit] Hello World
The simplest way to achieve this is with the built in message function that is similar to the windows messageBox().
PROGRAM MAP END CODE MESSAGE('Hello World!','Clarion') RETURN
Here is another, requiring only a minimum of code. This example opens a window in the program and use ACCEPT to handle the events.
PROGRAM MAP END
Window WINDOW('Clarion'),AT(,,124,72),GRAY STRING('Hello World'),AT(21,26),USE(?String1) BUTTON('Close'),AT(76,53,45,14),USE(?Button1),STD(STD:Close) END
Code Open(Window) Accept End RETURN
A more real world example uses a Clarion structure to declare a window and the Clarion Accept loop to process events from that window.
PROGRAM ! Declares this is a main program procedure MAP ! Determines which procedures will be called HelloProcedure ! This is a procedure HelloFunction,STRING ! This is a function, that returns a string ArgumentFunction( LONG pArg ),STRING ! This is a function that receives an argument END CODE HelloProcedure ! Executes the procedure MESSAGE( HelloFunction() ) ! Executes the function, as an argument to the MESSAGE MESSAGE( ArgumentFunction( 4 ) ) ! The MESSAGE is an internal function, a message dialog RETURN ! Explicitly ends the program HelloFunction PROCEDURE ! The compiler spots the difference, based on the MAP CODE RETURN 'Hello, world!' ! This is how one returns a value ArgumentFunction PROCEDURE( LONG pArg ) CODE RETURN pArg * 2 ! Clarion does automatic type conversion HelloProcedure PROCEDURE Window WINDOW('Clarion for Windows'),AT(,,222,116), | FONT('Tahoma',8,,FONT:regular),ICON('Hey.ICO'),SYSTEM,GRAY STRING('Hello World!'),AT(91,22),USE(?String1) BUTTON('Close'),AT(92,78,37,14),USE(?CloseBtn) END CODE ! Marks the beginning of executable code OPEN( Window ) ! Opens the Window structure ACCEPT ! Main keyboard/mouse reading loop CASE EVENT() ! Any event was raised? OF EVENT:Accepted ! Was it a control being accepted? CASE FIELD() ! If so, which control generated the event? OF ?CloseBtn ! the Close button generated that BREAK ! We just need to break the accept loop END ! End the control test branch END ! End the event test branch END ! End of the accept loop ! In Clarion, when a procedure leaves, it automatically closes ! any opened windows, but we're closing it by hand here, for the ! sake of the example CLOSE(Window) ! In Clarion, there's implicit RETURN when a procedure reaches the end ! but we're returning by hand here, for the sake of the example RETURN