beyond rpg

Post on 18-Feb-2016

59 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

Don Denoncourt dondenoncourt@gmail.com. Beyond RPG. RPG a Half-Century Old. Time to consider what comes after RPG. Maybe beyond RPG might be A better RPG We need to move beyond RPG status quo. Perception of RPG as Antiquated. Whether right or wrong… RPG does have issues - PowerPoint PPT Presentation

TRANSCRIPT

Don Denoncourt

dondenoncourt@gmail.com

Beyond RPG

RPG a Half-Century Old

• Time to consider what comes after RPG.• Maybe beyond RPG might be

– A better RPG

• We need to move beyond RPG status quo

Perception of RPG as Antiquated

• Whether right or wrong…• RPG does have issues

– But the biggest are:• Old code• Old programmers

• Antiquated coders – Don't get or use modern concepts

• Modules and Component-based Design (CBD)• Variable scoping

RPG is Not Popular

• Job sites:– 10X more Java than RPG jobs– 5X more PHP that RPG jobs

Language Adoption• Spurred by revolutionary changes in IT

But no revolutionary change driving CBD, OOP, or Declarative Programming

• Component-based Design– Black box process that is able to communicate

with other components with well defined arguments and return value

• Object-oriented Programming– Components built with encapsulation,

modularity, polymorphism, and inheritance• Declarative Programming

CBD Works Well with RPG

• But CBD and ILE RPG – not widely embraced

Why Haven't RPGers Embraced Java?

• Green-screen apps work so darn well• Dot-com failure put off app-starts

indefinitely• "IBM has fostered GUI inertia"

– Chris Maxcer in his Maxed Out blog

IBM's Roadmap to the Web

• First IBM said the solution was Java• Then WebFacing• Then Host Access Transformation Services

(HATS)• Now it seems to be EGL

– Or is it PHP?

"It's Not Easy Being Green"

• Quote by Randall Munson and Kermit the Frog

• "The green screen makes the system look old and creates a visual barrier to the acceptance of the System i."

• Even if you believe beyond RPG is a better RPG– Still need a web enablement solution

Ask the Experts

• Mike Otey and Craig Pelkie– Microsoft .Net

• Scott Klement, Susan Gantner, and John Paris– ILE RPG and CGI

• Joe Pluta and Dan Darnell– EGL

• Scott Steinacher and Paul Conte– Application Generators (such as Lansa)

• Trevor Perry, Susan Gantner, and John Paris– PHP

• Don Denoncourt– Groovy and Grails

Beyond RPG III

Great Things About RPG

• It works, it has always worked, and it will continue to work.

• ILE RPG has integrated modular API support• Existing staff knows RPG. • Wealth of 3rd party and in-house RPG apps.• Ancient code works in new OS releases without

recompilation. • Deep integration with DB and OS.• It has arguably the best job log in the industry.

Tiobe Index18th on Tiobe Index

www.tiobe.com

RPG is the Sybil of Programming Languages

RPG

RPG IIIRPG IV

RPG II

ILE RPG

/free

Dissociative Identity Disorder

• A side-effect of a 50-year old language– Adapt syntax to support new technologies

• Older languages often morph past their original purpose

• RPG is more complex than younger languages

Becomes a problem of"What Not to Use?"

• Propagate use of out-dated syntax– Subroutines– Entry parameter lists– Non-named indicators– Global variables

• Even highly paid RPG developers – Often don't use the language well

RPG is Difficult to Refactor

• Few common facilities for formalizing the refactoring process.

• Refactoring definition– Modify code without changing its behavior.

• Refactoring requirements include:– Unit and integration testing frameworks– Source control– Automated builds

• Lack of tooling caused the proliferation of duplicate code

Field Name Collision Bug

• RPG uses the same memory location for file fields with the same name– Standard 2-digit file id prefix

• Which left 4 significant digits

• RPG now supports 10 char field names– And qualified fields

• But tables have those 4-char field names– Causing a negative perception of DB2/400

Comparing RPGwith Younger Languages

RPG C-API

• ASCII I/O, XML manipulation, e-mail, Web Services, and TCP/IP processing– Requires C-API

• And you pretty much have to be a C programmer

• RPG C-APIs more complex than integrating Java/PHP/.NET

• Hats off to Scott Klement (and others)– For providing open-source RPG utilities to make this

easier• HTTP API

WDSc and RDi

• WDSc/RDi is much better than a few years ago

• But not as good as developing with other languages– Slow to open and save files– Edit/compilation cycle is slow– Still visualize punch cards when prompting for

F- and D-specs

Some General Complaints

• Inconsistent syntax• Platform specific• Static linking• Consumption of SQL result sets• Prototypes klunky and C-like

Modern Development Practices

1. Modern IDE2. Modular Programming3. Take Control of Your Source4. Test First, Code Later5. Use Multiple Test Environments

• Development, Test, and Production

6. Log, Don’t Debug

Modern IDE

Modular Programming

• Separation of Concerns– Model-view-controller (MVC)

• Service programs• No global variables • No subroutines• No *ENTRY PLIST

Take Control of Your Source

• Start using source control software– Commercial or otherwise

• Free source control tools– CVS or Subversion– Host on any system

• Hosting sites available– For RPG use iSeries Projects

Test First, Code Later

• Manual testing– Time-consuming and expensive– Not always possible to visually prove code worked as

expected– Not repeatable

• Automated testing– Unit tests

• Which become regression tests

• Utilities:– jUnit, jsUnit, PHPUnit, iUnit

Test Infected Programmers• Create the skeleton of your service program

– the API• Write unit tests for each sub-procedure. • Run the unit tests

– which will all fail • because you haven’t yet fleshed out the skeleton of

that code.

• Flesh out the sub-procedures– Iteratively run tests

• Revising the code until all tests pass

Multiple Test Environments

• Development, Test, & Production• Younger languages provide flexibility

– Local database– Off-line development and testing

Log, Don’t Debug

• Set up time for visual debugging– Lost when you complete the session

• Log statements stay in the code– Globally set logging level determines if a

statement is logged• EMERG, ALERT, CRIT, ERR, WARN, NOTICE,

INFO, DEBUG

• Log4i, Log4j, Log4js, etc.

Web Front-End Languages

Java• The Most Obvious Pick

– Pushed by IBM for 10 years– Top on TIOBE index

• Huge amount of APIs, Frameworks, and utilities• Revolutionized application development• Incomparable thread architecture

• "Java for multiple reasons has failed to deliver." – Paul Touhy

Java• "The answer to why java is failing: It is a

systems programming language, just like C++. It is not a good choice for business application programming." – Carson Soule

• Regardless…– Java is a powerful, flexible, cross-platform systems

programming language • that has been proven to work well • in the development of highly scalable web applications.

Java Recommendations

• Frameworks– Spring– Hibernate

• Utilities– Log4j– JUnit

PHP• Java written as a better C++

– PHP written to solve the problem of web development

• Personal Home Page– Hacked to getter Perl scripts– Rewritten and recast as PHP: Hypertext

Processor• Most approachable Web language• Issues:

– Requires selection of frameworks– Scaling, performance, and use in no-web apps

Eclipse PDT Plugin

PHP Recommendations• Zend Frameworks

– framework.zend.com• IDE

– Eclipse PDT– Zend

• Utilities– PHPDoc (www.phpdoc.org)– PHPUnit

• Dev/Test/Prod Environments– Dev should have a local DB

.NET

• Platform hosts a variety of languages. – Microsoft's answer J2EE.

• Maybe a better J2EE.

• C# and Visual Basic high on TIOBE index – C# is very similar to Java

• but with features that I wish Java had.

• Vendor and platform-specific solution

EGL

• Well-crafted language with a straightforward syntax– Easy for RPG coders to learn

• Record structures similar to Cobol– Use structs to communicate with DB and RPG

• EGL code generated in to Java• EGL is a platform, not just a language

– IDE with the EGL compiler

EGL Issues• Vendor specific, commercial IBM product

– Consider Lansa and BCD• Documentation and training

– Java/.NET/PHP has books, articles, seminars, conferences, blog and so forth

– "If you can't Google a solution to a technology, you shouldn't use that technology"

• Tied to Java Server Faces (JSF)– Over-engineered solution to HTML development– EGL easy to learn but JSF, once you get past what

drag-and-drop can do, is complex

Groovy and Ruby• Declarative languages

– Like PHP, Perl, Prolog, Python, and JavaScript– "Imperative programs explicitly specify an

algorithm to achieve a goal, while declarative programs explicitly specify the goal and leave the implementation of the algorithm to the support software."

• Ruby on Rails and Groovy's Grails– Amazing how quickly you can develop an

application with Rails or Grails• I've experienced productivity improvements of 200 to

500 percent with Grails

Groovy and Grails• Rails does not work well with legacy

databases• Groovy is a superset of Java

– RPGers: Simplifies Java syntax– Java coders: Provides powerful new options

• Grails uses industry-standard Java frameworks– Hibernate and Spring

• Philosophy:– “convention over configuration”

RPG-Java-Grails Comparison

• Read a customer record by key• RPG:

chain 23 custrec;• Grails:

def cust = Customer.get(23);

Java VersionConnection con = null;Customer cust = new Customer();try { Connection con=dataSource.getConnection(); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT * FROM CUSTDB"+ " WHERE CUSNUM = 23"); rs.next(); cust.setName(rs.getString("NAME")); cust.setAddress(rs.getString("ADDR"));} catch (SQLException e) { /*handle error*/} finally { con.close();}

Build and process a list of Virginia customers

RPGdou %eof(custrec);

reade 'VA' custrec;

if not %eof(custrec);

// process a customer

endif;

enddo;

GrailsCustomer.findAllByState('VA').each { // process a customer}

Build and process a list of Virginia customers

RPGdou %eof(custrec);

reade 'VA' custrec;

if not %eof(custrec);

// process a customer

endif;

enddo;

GrailsCustomer.findAllByState('VA').each { // process a customer}

Java

ResultSet rs = stmt.executeQuery( "SELECT * FROM CUSTDB WHERE STATE = 'VA');while (rs.next()) { Customer cust = new Customer(); cust.setName(rs.getString("NAM")); cust.setAddress(rs.getString("ADDR")); // and set all the other fields as well // process the customer}

DDS versus Grails ValidationR CUSTREC NAME 40A I 4 10 ADDR 50A I 5 10 STATE 2A I 6 20VALUES('VA' 'CO' 'AK') AGE 3S OI 6 25RANGE(21 65) COMP(NE 33)

class Customer { String name String addr String state String age static constraints = { name(length:2..40) addr(maxSize:50) state(inList:["VA", "CO", "AK"]) age(range:21..65, notEqual:33) }}

Constraints checked on

insert, update, or validate

Grails Recommendations

• Frameworks– All required are bundled– Others installable in seconds as plugins

• Use integrated testing facilities• Use logging heavily• Separate business logic into service classes• Consider DB refactoring before launch

Post-modern Language

• "RPG is what academics call a post-modern language: a classic with a lifeline that debunks the myth of obsolescence."– Tomas Stockwell

RPG Here to Stay• But keep looking beyond…

– A better RPG– Consider the future is about languages (plural)

• You already know several languages– CL, DDS, SQL

• Dave Thomas– "The Pragmatic Programmer: From Journeyman to

Master"– A journeyman programmer should learn one new

language a year.

Beyond RPG: ILE

• Use SQL– Embedded SQL– DDS to DDL

• Move RI and constraint logic to DDL– Stored Procedure Language (SPL)

• Follow Klement's "RPG Rules"– RPG has modern language capabilities

• But do you take advantage of them?

Not Sure What New Language to Learn?

• JavaScript, SQL, and CSS• JavaScript

– Browser-based, client-side language, that is the core of AJAX

• SQL – You should already be familiar with but ramp it up

• Cascading Style Sheets (CSS)– And browser user interface development in general

Look Beyond

• What your shop(s) have been doing for the last few decades

• Take advantage of new language features• Use CBD • Put on a Web front-end• Use the latest development tools

– WDSc/RDi• Learn a new language

Find Out More• "Exploiting RPG’s V5 Power Features"

– Jon Paris and Susan Gantner– www.asugcle.com/LUG/AMCUAIM/articles/

ExploitingV5_NoXML.pdf• "PHP May Be for i, but Is It for Me?"

– Don Denoncourt– SystemiNetwork.com, Article ID 20796

• "RPG: Anchoring Your Team"– Jon Paris and Susan Gantner– www.ibmsystemsmag.com/i5/april07/coverstory/

12342p1.aspx

Find Out More• "RPG Rules"

– Scott Klement– SystemiNetwork.com, Article ID 21050

• "The Search for the Holy Web Dev Grail(s)"– Don Denoncourt– SystemiNetwork.com, Article ID 21061

• "What Gems Does Ruby on Rails Offer?"– Tim Massaro– SystemiNetwork, Article ID 21076

• "Go Beyond RPG -- With Modern RPG"– SystemiNetwork.com, Article ID 60198

top related