Using Fourth-Generation Languages

 <  Day Day Up  >  

Using Fourth-Generation Languages

Several fourth-generation languages (4GLs) are available at most IT shops . FOCUS, RAMIS, and NOMAD are examples of popular 4GLs. 4GLs, which operate at a higher level of abstraction than the standard 3GLs, can usually read, modify, process, and update data a set or a row at a time. For example, a 4GL can often issue a single command to list and display the contents of data stores. A 3GL program, in contrast, must read the data, test for the end of the file, move the data to an output format, and issue commands to control the display of a screen of data (for example, backward and forward scrolling, or counting the items per screen).

Consider using 4GLs for two reasons. First, a single 4GL statement usually corresponds to many 3GL statements. Because this capability provides a quicker programming cycle, production applications are online faster than traditional 3GL-developed applications. Second, 4GLs have a greatly reduced instruction set, which makes them easier to learn and master than 3GLs.

Be careful, though, because applications based on 4GLs rarely deliver the same level of performance as applications based on traditional languages. As with using pure SQL, writing entire applications using 4GL is uncommon but possible. More often, you will use 4GL to develop only certain components , such as

  • Quick, one-time requests that are not run repeatedly in production.

  • Specialized reports .

  • Important portions of an application. (When critical components of an application are not delivered with the first release of the application, you can use a 4GL to deliver the most important portions of those components, thereby satisfying the users until you can fully develop the components using a traditional language.)

4GL Application Guidelines

Apply the following guidelines to optimize your DB2-based 4GL development efforts.

Avoid 4GLs When Performance Is Crucial

Avoid coding performance-oriented DB2 systems using fourth-generation languages. You can usually achieve a greater level of performance using traditional, third-generation languages.

Provide In-Depth 4GL Training

If you decide to use a 4GL, be sure that proper training is available. Although 4GLs can achieve results similar to 3GLs, they do not use the same techniques or methods . Developers unfamiliar with 4GLs usually do not produce the most efficient applications because of their tendency to use 3GL techniques or poorly developed 4GL techniques.

Avoid Proprietary Storage Formats

When you're using 4GLs, try to query data directly from DB2 tables instead of extracts. Extracting the data into the (sometimes proprietary) format of the 4GL can cause data consistency problems. By avoiding extracts , you ensure that the data queried using the 4GL is consistent with the data queried using conventional DB2 and SQL methods.

Extract Data As a Last Resort

Consider moving the data from DB2 tables to the 4GL format only if the performance of the 4GL program is unacceptable. (You should consider this approach only as a last resort.) If data will be extracted from DB2, you must run a regularly scheduled extraction procedure to keep the 4GL data current.

Use Embedded SQL If Possible

To retrieve DB2 data, try to use SQL embedded in the 4GL rather than use the language of the 4GL. The reasons for doing so follow:

  • SQL is a universally accepted standard. Many 4GL products are on the market, and none are standard.

  • Hiring SQL programmers who understand the SQL embedded in the 4GL is easier than hiring programmers who understand the syntax of the 4GL.

  • Embedding SQL in a host language is a common and well- understood practice. Therefore, embedding SQL in a 4GL should, for the most part, correlate to embedding SQL in COBOL or another traditional language.

Join Tables Using SQL Instead of 4GL

If the 4GL provides a technique of relating or joining data from two physical data sources, avoid using it when accessing data from DB2 tables. Instead, create a DB2 view that joins the required tables, and query that view using the 4GL. This approach almost always provides better performance. For example, I converted one application using a 4GL "join" into a 4GL query of a view that joined tables. The application reduced elapsed time by more than 250 percent after the conversion.

Understand the Weaknesses of Your Particular 4GL

Some 4GL products interface to DB2 in unusual ways. Be sure that you understand the interface between the 4GL and DB2, as well as any potential "features" that could cause performance problems or management difficulties. For example, one 4GL I have worked with creates a DB2 view for every query issued via the 4GL. The management of these views can become troublesome as the number of queries issued using the 4GL grows.

Understand the Strengths of 4GL

Use the strong points of the 4GL and DB2. You should use DB2 to control the integrity of the data, the modification of the data, and the access to the data. You should use the 4GL to generate reports, perform complex processes on the data after it has been retrieved, and mix non-DB2 data with DB2 data.

 <  Day Day Up  >  


DB2 Developers Guide
DB2 Developers Guide (5th Edition)
ISBN: 0672326132
EAN: 2147483647
Year: 2004
Pages: 388

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net