19
Fri, Apr
5 New Articles

Essential Skills for System i Web Development, Part II

Web Languages
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

In Part I of this two-part series, we looked at essential skills for client-side Web development. In this installment, we'll look at server-side programming.

Server-side programming involves writing business logic, database access logic, validations, and interfaces to the client (usually a browser of some sort, although with Web services applications, it could be another Web server). Server-side programming can be done using a variety of development environments and languages, depending on a number of factors, such as the choice of Web server middleware, hardware, operating system, and development language. For example, on the System i, some of the choices are CGI programs that run in the Apache Web server, PHP running in the Apache Web server with the PHP module installed, Java servlets, or JavaServer Pages (JSPs) running in WebSphere WAS.

Note that CGI is a protocol, not a language or development tool. Several tools use CGI as the basis for delivering Web apps, with varying approaches to implementation of the protocol. These include open-source tools such as CGIDEV2, commercial "kits" (suites of APIs to make programming in the CGI protocol easier), and commercial development environments. Most of these exploit RPG as the primary development/generation language, but it is possible to write CGI-protocol-based code in most any ILE language, such as Cobol, C, or C++. On platforms other than the System i, besides PHP and Java-based solutions, you may encounter CGI scripts, usually written in Perl or early versions of PHP or ASP .NET, Microsoft's equivalent to JavaServer Pages (JSP), running on IIS, Microsoft's proprietary Web server.

Another popular server-side Web technology is Adobe's ColdFusion, originally produced by Allaire. ColdFusion consists of both a development tool and a deployment environment. It uses its own server, which sits on top of other Web servers. ColdFusion had a strong presence in the early days of database-driven Web programming (circa 1999–2000), but its popularity is declining due to the success of PHP, Microsoft's inroads into the marketplace, and the adoption of Java-based solutions.

A Comparison

Let's look at the advantages and disadvantages of some of these approaches.

CGI on System i

Advantages

  • CGI is a widely used protocol (on other platforms besides System i).
  • CGI programs written in native ILE languages run extremely efficiently.
  • CGI is very easy to deploy.
  • CGI programs can be written using familiar languages, such as RPG.
  • Many operating system APIs allow extension of RPG capabilities for rich Web applications.
  • Applications can be tightly integrated with operating system functionality (such as user ID authentication, object-level authority, etc.).
  • Free open-source code libraries are available for writing CGI programs (such as CGIDEV2).
  • Several good commercial development tools are available for writing CGI applications.

Disadvantages

  • CGI is not easily ported to other platforms.
  • CGIDEV2 and other free libraries are limited in functionality.
  • RPG is not a native Web-development language, so it has limited native Web functionality.
  • RPG is proprietary (not used on any other platform than System i), C is not ANSI-standard, and CL is proprietary (these are probably the most common languages used to construct System i–centric Web applications).

PHP

Advantages

  • It's easy to install, configure, and deploy.
  • There are no license fees to run open-source versions.
  • PHP is easy to start coding in (procedurally written or object-oriented).
  • PHP runs efficiently, even though it's interpreted rather than compiled (some pseudo-compilation can be done, also).
  • It's a widely used language, with lots of Web resources available for learning it.
  • Lots of open-source applications written in PHP are available.
  • Many editors are available for writing PHP.
  • PHP has cross-platform capability; if you write PHP using MySQL as your database, for example, it is easy to run it on other servers with no or minimal code changes.

Disadvantages

  • PHP is relatively new on System i.
  • It's interpreted, not compiled. This may mean it doesn't scale as well as compiled ILE code on the System i.
  • Because it's a loosely typed language, it's easy to learn, but that also makes it more prone to buggy code than strongly typed languages such as Java or C++.
  • It's open source, so there's loose control over the quality of the product, with many volunteer contributors, compared to commercial software.

JavaServer Pages (JSP)

Advantages

  • JSP has a well-designed, formal language specification.
  • It offers cross-platform capabilities.
  • Several development tools are available for developing Java-centric Web apps, including the open-source project Eclipse and IBM's WDSc.
  • JSP is similar in concept to PHP and ASP.NET, so it's relatively simple conceptually to work with.

Disadvantages

  • Java does not run well or scale well on System i. Although advocates will tell you otherwise, there are countless stories of companies having to upgrade their hardware to run Web applications in WebSphere.
  • Some developers maintain that WebSphere is difficult to install, configure, and tune.
  • Java often presents a big learning curve for RPG programmers.
  • Java does not fulfill the promise of "write once, run anywhere." It's more like "write once, test everywhere," which reduces the benefit of being able to deploy cross-platform.

If you are interested in learning about J2EE, which is the umbrella technology for Java servlets and JSP (and a lot of other Java-based technologies), Sun Microsystems has a great Web site for that.

ASP.NET

Advantages

  • ASP.NET has a rich set of controls for creating Web applications.
  • The robust development workbench from Microsoft (Visual Studio) helps to create ASP.NET applications.
  • It's a comprehensive language.
  • It's highly scaleable.
  • ASP.NET runs on IIS, Microsoft's popular Web server.
  • It uses the .NET framework, which supports other languages such as VB, C#, and J# (Microsoft's answer to Java). You can compare the .NET framework to ILE on the System i or to the Java Virtual Machine (JVM); each supported .NET language creates compiled code that runs in the .NET framework and can interact with programs built in other .NET languages.
  • It offers a rich set of tools for tight integration with other Microsoft products, such as Outlook for emails, calendaring, etc.

Disadvantages

  • It requires the Microsoft IIS Web server, which runs only on Microsoft operating systems.
  • The .NET framework has a learning curve associated with it.

Because ASP.NET runs on a Microsoft platform, why would you consider it for System i Web development? Well, there are ODBC drivers for connecting to the System i database, so you can write ASP.NET applications that access System i data. Organizations that are nervous about exposing their System i to the Internet sometimes take this approach, although I think this is an unnecessary concern, given System i's robust security features.

What IBM Could Learn from Microsoft

One area that Microsoft really excels in is its development tools. There is really no comparison between IBM's tools and Microsoft's Visual Studio and similar tools. For example, Microsoft's tools are easy to find on the Microsoft Web site, are easy to install, and are not PC resource hogs (compared to WDSc, which requires much more memory). And some developers consider IBM's developer tools to be less intuitive than Microsoft's tools.

http://www.mcpressonline.com/articles/images/2002/Essential%20Skills%20For%20System%20i%20Web%20Development%20II%20V4--08130700.png

Figure 1: Edit an HTML file with Microsoft's Visual Web Developer 2005 Express Edition.  (Click image to enlarge.)

Compared to IBM, Microsoft also does a great job of promoting its tools. For example, on the developer's Web site, you can easily download free Express versions of Microsoft software; just click the Downloads tab. From there, you can download Visual Web Developer 2005 Express in just three clicks—no forms to fill in, no email addresses required. Just click and install. Contrast this with IBM's WDSc page. IBM would do well to make it easier for developers to figure out how to get a free trial download.

In addition, Microsoft does a superb job of selling programming as a fun and exciting pursuit. For example, on that same developer's site, there's a "Facebook developers kit." Microsoft makes its products relevant and interesting to the younger crowd. The site is covered with great images, screenshots, video demos, and more. In contrast, IBM's is... well, dull. No pictures. No videos. Just the IBM logo and lots of text and links.

What These Approaches All Have in Common

All the solutions I've described use a common Web programming concept, to one degree or another. The idea of interleaving HTML with server-side code is quite different from traditional green-screen programming, where you clearly separate UI design (display file DDS) from programming logic (RPG code, for example).

This can present a problem in terms of coding; it makes it difficult to design your screens separately from your programming logic. Each technology addresses this problem with different degrees of sophistication. For example, CGIDEV2 uses "sections," which let you write large chunks of HTML with server-side variables embedded. JSP supports the use of JavaBeans, which are self-contained objects consisting of both presentation layout and server-side code. For example, you can easily hook in an HTML calendar that is created as a bean. The bean draws the calendar on a designated place on the page. The programmer might set properties for the bean that control whether or not the current day is highlighted, for example. Microsoft's ASP.NET supports the same concept. Visual Studio .NET comes with a suite of pre-built server-side controls that you can easily plug in to your pages. One of the most powerful is the datagrid. This is like a subfile on steroids. It produces a scrollable table of values from any SQL select statement, with resizeable and sortable columns, plus many more features. As a programmer, you do not need to know the innards of the control—how the requisite HTML is produced, for example. You simply place the control on your page using Microsoft's design tool and then set properties for it. Zend also has something similar, called Zend Frameworks, which includes an object-oriented library of components written in PHP 5.

Which Approach Should You Choose to Learn Server-Side Technology?

With the advent of strong PHP support on the System i, it really makes sense to start with PHP:

  • It's easy to learn.
  • You can use any editing tool: Zend's, NuSphere, Notepad, TextEdit, HTML-Kit or one of the latest System i–centric rapid development tools from the System i ISV community.
  • You can find tons of code samples on the Web.
  • Zend has done a great job of providing functionality that makes it work with the System i database, using either record-level access or SQL statements.
  • The rich set of functions for writing PHP applications are simply not available in RPG toolsets such as CGIDEV2.
  • It's cross-platform capable.

PHP's Object-Oriented Capabilities

Although PHP is typically coded using procedural coding styles that employ function calls, etc., PHP 5, released in July 2004, also supports a robust object-oriented coding model. Zend Frameworks is a set of object-oriented components written in PHP 5 that provide a high degree of Web functionality that's easy to plug in to your own applications. Having the ability to write PHP in an object-oriented architecture gives you room to grow with the language. You can start out learning to code PHP procedurally, using concepts that are familiar to you, and then eventually move to using an object-oriented methodology to write more robust and reliable code.

Learning PHP

Literally hundreds of Web sites teach PHP. As I mentioned in my previous article, W3 Schools is one of my favorite sites, especially for basic introductions to Web technology. Other sites include PHP.net. A Google search for "PHP tutorials" returned 808,000 hits! Also, there are many good books on PHP. One Web site I have found particularly helpful is O'Reilly's Safari Books Online. This is a subscription-based site that gives you access to O'Reilly's library of publications, as well as technology books from other publishers. You get to read complete online versions of the books. You can also download sections, or buy hardcopy versions directly from the site. Compared to the comparable cost of the print versions, the subscription fees are very inexpensive.

Perhaps one of the major reasons to use PHP is that you can be comfortable knowing that PHP is a major technology that is here to stay. Investing in PHP training for yourself or your staff is a long-term value proposition. It's an investment that you will leverage for years. In addition, PHP is widely taught in colleges and universities, so finding new talent who can code in PHP is relatively easy compared to other languages, especially RPG.

Putting It All Together

You will need the skills from both of the articles in this series in order to write commercial-quality Web applications:

  • HTML for content and layout
  • CSS for advanced layout
  • JavaScript for client-side scripting
  • PHP (or other server-side language) for server-side database access, business rules, and presentation logic

While this sounds daunting, it doesn't have to be. Read a couple of books, grab some sample code, and get going! Web programming is tons of fun, and once you get started on it, you'll never want to see another green-screen again!

Duncan Kenzie is President and CTO of BCD Technical Support, the development and support group for WebSmart, a popular iSeries Web development tool, and Nexus Portal, a portal product specifically designed for System i, iSeries, and AS/400 servers. Duncan has 30 years of experience on the midrange systems platform creating software for both green-screen and native Web environments.

Duncan Kenzie
Duncan Kenzie is President and CTO of ExcelSystems Software Development Inc. Duncan’s company is responsible for product development and technical support for BCD International Inc.’s (www.bcdsoftware.com) product line. Duncan has a BA in English Literature from the University of Waterloo, Ontario, and enjoys writing on a variety of subjects. Duncan is a frequent public speaker and has been writing articles about the midrange platform since 1985. He has also been involved in producing programmer productivity and business intelligence tools for 25 years and is the technical lead on products such as WebSmart, WebSmart PHP, and Nexus, leading System i Web tools.  Duncan still enjoys programming, and studies in leadership and self-improvement. He can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: