1 / 58

Beyond RPG

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

Rita
Download Presentation

Beyond RPG

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Don Denoncourt dondenoncourt@gmail.com Beyond RPG

  2. 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

  3. 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

  4. RPG is Not Popular • Job sites: • 10X more Java than RPG jobs • 5X more PHP that RPG jobs

  5. Language Adoption • Spurred by revolutionary changes in IT

  6. 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

  7. CBD Works Well with RPG • But CBD and ILE RPG • not widely embraced

  8. 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

  9. 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?

  10. "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

  11. 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

  12. Beyond RPG III

  13. 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.

  14. 18th on Tiobe Index Tiobe Index www.tiobe.com

  15. RPG is the Sybil of Programming Languages RPG RPG II RPG III RPG IV ILE RPG /free

  16. 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

  17. 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

  18. 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

  19. 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

  20. Comparing RPGwith Younger Languages

  21. 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

  22. 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

  23. Some General Complaints • Inconsistent syntax • Platform specific • Static linking • Consumption of SQL result sets • Prototypes klunky and C-like

  24. Modern Development Practices • Modern IDE • Modular Programming • Take Control of Your Source • Test First, Code Later • Use Multiple Test Environments • Development, Test, and Production • Log, Don’t Debug

  25. Modern IDE

  26. Modular Programming • Separation of Concerns • Model-view-controller (MVC)‏ • Service programs • No global variables • No subroutines • No *ENTRY PLIST

  27. 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

  28. 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

  29. 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

  30. Multiple Test Environments • Development, Test, & Production • Younger languages provide flexibility • Local database • Off-line development and testing

  31. 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.

  32. Web Front-End Languages

  33. 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

  34. 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.

  35. Java Recommendations • Frameworks • Spring • Hibernate • Utilities • Log4j • JUnit

  36. 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

  37. Eclipse PDT Plugin

  38. 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

  39. .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

  40. 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

  41. 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

  42. 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

  43. 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”

  44. RPG-Java-Grails Comparison • Read a customer record by key • RPG: chain 23 custrec; • Grails: def cust = Customer.get(23);

  45. Java Version Connection 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(); }

  46. Build and process a list of Virginia customers • RPG dou %eof(custrec); reade 'VA' custrec; if not %eof(custrec); // process a customer endif; enddo; • Grails Customer.findAllByState('VA').each { // process a customer }

  47. Build and process a list of Virginia customers • RPG dou %eof(custrec); reade 'VA' custrec; if not %eof(custrec); // process a customer endif; enddo; • Grails Customer.findAllByState('VA').each { // process a customer }

  48. 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 }

  49. DDS versus Grails Validation R 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

  50. 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

More Related