EGL (programming language)

EGL (Enterprise Generation Language), originally developed by IBM and now available as the EDT (EGL Development Tools)[1] Open Source project under the Eclipse Public License (EPL), is a programming technology designed to meet the challenges of modern, multi-platform application development by providing a common language and programming model across languages, frameworks, and runtime platforms. The language borrows concepts familiar to anyone using statically typed languages like Java, COBOL, C, etc. However, it borrows the concept of stereotype from Unified Modeling Language (UML) that is not typically found in statically typed programming languages.

In a nutshell, EGL is a higher-level, universal application development language.

EGL is similar in syntax to other common languages so it can be learned by application developers with similar previous programming background. EGL application development abstractions shield programmers from the technical interfaces of systems and middleware allowing them to focus on building business functionality. EGL applications and services are written, tested and debugged at the EGL source level, and once they are satisfactorily functionally tested they can be compiled into COBOL, Java, or JavaScript code to support deployment of business applications that can run in any of the following environments:

Code examples

Program

An EGL Program part is a generatable logic part with one entry point. Each Program part contains a main() function, which represents the logic that runs at program start up. A program can include other functions and can access functions that are outside of the program. The function main() can invoke those other functions. Program functions are composed of a set of EGL statements, variables, and constants.

 1 Program HelloWorld
 2 
 3 	const GREETING string = "Hello, ";
 4     
 5 	function main()
 6 		myName string = "John";
 7 		sayHello(myName);
 8 	end
 9 
10 	function sayHello(name String in)
11 		SysLib.writeStdOut(GREETING + name + "!");
12 	end
13 
14 end

Record

An EGL Record part defines a set of data elements. In this example, a record with the name CustomerRecord is defined with 6 fields.

Record CustomerRecord type BasicRecord
	customerNumber INT;            
	customerName STRING;
	customerAddr1 STRING;
	customerAddr2 STRING;
	customerAddr3 STRING;
	customerBalance MONEY;
end

EGL has a specialized type of record called SQLRecord that is used to exchange data with a relational database.

record Employee type sqlRecord { tableNames =[["Employee"]], keyItems =[EMPNO]}
    EMPNUMBER string{ column = "EMPNO", maxLen = 6};
    FIRSTNME string{ sqlVariableLen = yes, maxLen = 12};
    MIDINIT string{ isSqlNullable = yes, maxLen = 1};
    LASTNAME string{ sqlVariableLen = yes, maxLen = 15};
    DEPT string{ column = "WORKDEPT", isSqlNullable = yes, maxLen = 3};
    PHONENO string{ isSqlNullable = yes, maxLen = 4};
    HIREDATE date{ isSqlNullable = yes};
end

Service

An EGL Service part contains public functions meant to be accessed from other applications or systems. In this example, a service with two functions is defined.

 1 package com.mycompany.services;
 2 
 3 service EmployeeService
 4 
 5     function getEmployees() returns(Employee[])
 6         records Employee[0]; // define an empty array of records
 7         get records; // retrieve records from the database
 8         return (records); // return the records       
 9     end
10     
11     function addEmployee(emp Employee in) returns (boolean)
12     	try
13     		add remp;
14     		return (true);
15     	onException (ex AnyException)
16     		return (false);
17     	end
18     end
19 
20 end

RUIHandler

The main component of a Rich UI application is a Rich UI handler part. These parts are generated into JavaScript.

 1 package com.mycompany.ui;
 2 
 3 import com.mycompany.services.Employee;
 4 import com.mycompany.services.EmployeeService;
 5 import dojo.widgets.DojoGrid;
 6 import dojo.widgets.DojoGridColumn;
 7 
 8 handler EmployeeView type RUIhandler { initialUI = [ grid ], 
 9                                        onConstructionFunction = start, 
10                                        cssFile = "main.css" }
11 
12     grid DojoGrid { behaviors = [ ], headerBehaviors = [ ], columns = [
13                     new DojoGridColumn { displayName = "First Name", name = "FIRSTNAME" },
14                     new DojoGridColumn { displayName = "Last Name", name = "LASTNAME" },
15                     new DojoGridColumn { displayName = "Salary", name = "SALARY" }
16             ] };
17 
18     function start()
19         svc EmployeeService { };
20         call svc.getEmployees () returning to displayEmployees;
21     end
22 
23     function displayEmployees(retResult Employee [ ] in)
24         grid.data = retResult as any [ ];
25     end
26     
27 end

Web 2.0 with EGL

In December 2008, IBM introduced new technology, EGL Rich UI, to simplify the creation of Web 2.0-style Rich Internet Applications. This technology simplifies development by hiding the complexities of Ajax, JavaScript, REST, and SOAP from the developer, which enables them to focus on the business requirement and not on the underlying technologies.

Commercial Products

EGL programming tools are available as an Eclipse-based[2] commercial product, the Rational Business Developer and also in the EGL edition of Rational Developer for System z.

EGL is a target language for modernization of legacy applications because of the language semantics affinity with procedural languages and legacy 4th generation languages:

Tools for searching large EGL code bases, comparing individual EGL files for changes, and detecting duplicated code are available from Semantic Designs[3]

References

Books on EGL

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.