Home > AS/400 Tips > iSeries programmer tips > Groovy programming on IBM i
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

Groovy programming on IBM i


Andrew Borts, Contributor
06.08.2009
Rating: -4.33- (out of 5)


iSeries news and advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



Andrew Borts

Some people keep telling me that the IBM i is falling behind with development technologies – but honestly, that's far from the truth. There's an emerging base of languages that allow the users to keep their existing skills, and merge them into a new fusion of language and technologies that are compatible with the iSeries through the built-in AIX support in the operating system (PASE environment). Whether you know it as "Q-Shell" or PASE -- either way, you're already using a platform capable of far more then you may realize (we're running our PHP suite through this environment).

Groovy has a short but sweet history, using the Java language as a superset, the language actually merges many technologies and syntaxes that people are familiar with. With this familiarity, people can become proficient rather quickly in these new "fusion" languages: Ruby, Ruby on Rails, and now Groovy (based on the Java language and bytecodes).

Groovy has the advantage of being based on Java, whereas Ruby is based on Perl, and small talk languages. One of the advantages of Groovy is that it compiles directly into Java bytecode, instead of being an interpreted language. Groovy on Rails (or "Grails") is a Web application framework that utilizes the Ajax methodology of using asynchronous Javascript to give Web applications a more "PC" application feel to them.

Groovy gives the ability to make programming far more compact then Java, simplifying the syntax to describe things. Five to seven lines of application could exist as one line of application – for example (from the Groovy Wiki page)

public class StdJava
{
 public static void main(String argv[])
 {
 for (String it : new String [] {"Rod", "Carlos", "Chris"})
  if (it.length() <= 4)
  System.out.println(it);
 }
}

The above code is rather compact – but compare it to the Groovy code for the same thing:

["Rod", "Carlos", "Chris"].findAll{it.size() <= 4}.each{println it}

While it complicates things to learn a new language, I argue that for the programmer on the go, one line is great!

The reasons Groovy should be in your programming language arsenal include

  • Dynamic typing – meaning that the syntax checking is looser allowing for faster functioning code. It is dynamic because a majority of the checking happens at run time, not compile time.
  • Overloading – the ability to make subroutines/functions do more then one task, simply by adding a field to the called parameters.
  • Native support for regular expressions – giving a powerful search and replace capability within strings. One line of code could do what would take arrays and special string handling in the "old days." Regular expressions have been found in languages such as Pearl, PHP, and Ruby.
  • 100% Java compatible – as a matter of trivia, you can change the extension of your .java programs to .groovy and they will compile into java bytecode – same as before!

The Grails Framework – in addition to the above aspects, Grails gives the following advantages:

  • Supports CRUD scaffolding – so you get immediate access to create, read, update and delete by programming "def scaffold = true" – imagine deploying an application to modify a database within three lines of code.
  • Provides a high productivity web framework for the Java platform
  • Re-use open Java technologies within a consistent interface.
  • Sample applications are provided, and are readily available over the internet.
  • No XML configuration required! (which while externalizing your static information, can slow ya down. Note: Don't stop externalizing static information! (Please.)

Groovy has another distinct advantage of also making people think of the 59th Street Bridge song by Simon & Garfunkel.

I don't know about you, but I'm now "feeling Groovy" about our Java future!

ABOUT THE AUTHOR: Andrew Borts is Webmaster at United Auto Insurance Group in North Miami, Fla. He is a frequent speaker at COMMON and is past president of The Southern National Users Group, an iSeries-AS/400 user group based in Deerfield Beach, Fla.

Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Web Development
Implementing a browser interface in COBOL: Creating your graphic Web page
Implementing a browser interface in COBOL: Getting started
IBM i shop boosts online sales with RPG-based Web platform
Migrating from RPG to EGL on IBM i
Running PHP open source applications: NOBODY needs authority
Zend Web software teams up with IBM System i
The best technologies and tools for System i programmers in 2009
Seven IBM i project lessons learned in 2008
AS/400 lessons from the past, present, and future: A holiday tale
Application modernization strategies for System i

iSeries Java programming
EGL Rich UI on IBM i: Do you Dojo?
Programming for the Web on the IBM i, what is possible
Database performance comparisons on IBM i
Database drivers on the i: MySQL vs. IBM Toolbox
How to: Output SQL script to a text file from an AS/400
Application modernization for the iSeries: Why bother?
JDBCODBC functionality -- Java to Excel for complex workbooks
Necessity leads to iSeries Watchdog development
Accessing AS/400 data using Excel ODBC drivers
Top 10 System i white papers
iSeries Java programming Research

iSeries programmer tips
Enhancing RPG with external SQL stored procedures
Tracking data changes on IBM i with triggers
Introduction to SQLRPGLE on IBM i: Making a report
Implementing a browser interface in COBOL: Displaying database fields
Taking advantage of CL advancements, starting with V5R3
TAATOOL: Useful tools for programmers on IBM i
Implementing a browser interface in COBOL: Creating your graphic Web page
Implementing a browser interface in COBOL: Getting started
Making the most of RPG data handling on IBM i
EGL Rich UI on IBM i: Do you Dojo?

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
WebSphere Development Studio Client (WDSC)  (Search400.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts