Today, there’s a prevailing philosophy on distributed systems design (and more and more, on all software development) that goes as follows: Everything must be Write Once, Run Anywhere (WORA). Therefore, all database access must be through SQL. So native AS/400 I/O is forbidden.
On the surface, this philosophy has merit. It indicates a trend toward simplification; everything is written in a common language with a common style, maybe even a common toolset—sort of a Grand Unified Theory of Development. However, looks can be deceiving. Forcing commonality can bring forth the deadly specter of the lowest common denominator, in which the natural advantages of a given approach are lost in the struggle to achieve sameness.
Still, you might argue, regardless of the AS/400’s incredibly robust and powerful native I/O mechanisms, the conclusions speak for themselves. Well, conclusions stem from proper assumptions; if one assumption falls, the entire theory falls with it. In this case, the first assumption is the one that falls. Let me explain.
WORA as a purely academic goal is a wonderful ideal. The fewer programming models your staff needs to learn, the better. The easier it is to move from platform to platform, the better. So, by itself, WORA is a good thing. But, like other decisions, the decision to move to WORA must be balanced against other factors.
One of those factors is performance. On the AS/400, SQL cannot match native I/O in performance. In some cases—most notably in online transaction processing, the AS/400’s backbone—it’s not even close. SQL’s set-based design does not lend itself to the test-and-decide style of navigation that is basic to most transaction processing. When data can come from different files based on the contents of a field in a third file or, even worse, on the setting of some global system flag (facility-based planning in ERP, for example), SQL is not up to the task. Even SQL’s designers have recognized this; the next release (SQL3) will support a Java-like embedded language in its stored procedures. However, that means in order to use SQL3 (at least the advanced features), programmers will have to learn object-oriented programming (OOP)! Even then, I doubt that SQL’s performance will measure up.
So there’s platform independence on the one hand and performance on the other. How do you balance these opposing forces? Well, rather than make a blanket statement that one is better than the other, you need to look at the business issues for each situation. I can easily break the discussion into two completely separate cases: clients and servers.
In these days of Internet (or intranet) accessibility, programs that run on any client are almost required. Because the server has no idea what type of client might connect, the client program needs platform independence. Windows, Macintosh, even Linux machines may be attaching; clearly WORA is important. And because today’s workstations are limited more by bandwidth than by CPU cycles, a little performance penalty is probably a reasonable tradeoff. Besides, SQL works well for queries, and servers, not workstations, should be doing transactional I/O anyway.
And it’s not so bad if your server software is platform-specific. Unless you are considering moving your server-side applications to a different platform, there’s probably no need for platform independence. However, your server probably is where performance bottlenecks are most pronounced and most noticeable. Unless your server software is intended to run on multiple platforms, native I/O on the AS/400 makes good business sense.
One more argument against a blind move to SQL: By using OOP techniques, it is possible to have the best of both worlds. Your business entities can be designed so that they recognize where they are deployed and take advantage of the unique characteristics of the server platform. This requires some additional programming (and some parallel development), but in multiple-platform server environments, the performance enhancement may be worth the development costs.
As with most things, there is no universal panacea when it comes to distributed program design. The surest route to a successful business solution requires making tough business decisions. I hope this article makes those decisions a little easier.
LATEST COMMENTS
MC Press Online