27
Wed, Nov
0 New Articles

I Do Declare!

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

If you know me, you might know that I spent a critical part of my career at System Software Associates. Yes, at one time, your humble narrator was the Manager of Architecture at the World's Largest AS/400 Software Company (®, ©, ™). It was often said that a year at SSA was like seven years anywhere else, and that had a lot to do with impossible deadlines against hopeless odds. That didn't stop us, though: We created project plans and Gantt charts and timelines and tasks lists in which things simply got compressed to the point of ridiculousness. On one particularly silly project, we even had a diagram: The left side was our current status, listing tasks completed (mostly "design" tasks) and so on, while the right side was a list of deliverables with dates handed down from management. In the middle was a big box with the caption "A Miracle Occurs!"

The First Black Boxes

That was the black box of project management, and it was one of the first black boxes I had to deal with. But I was OK with that one, because the project usually got delivered on time by lopping off a few features, working a few 120-hour weeks (true, and trust me, you don't want to know many of the details, especially the hygiene-related ones), and getting rid of certain unnecessary time-consuming stages like, say, testing. Honestly, at times we felt we were only half kidding when we would say, "It compiles. Ship it!"

But before that was my very first black box, the black box of sales. My first IT job was working for a small entrepreneurial company by the name of Sweeney Computing Corporation. There, I was introduced to one of the biggest black boxes in our industry (still to this day, I might add), the sales black box. Mike Sweeney, the president of the company, would go off to a meeting with the unlikeliest of prospects and would come back beaming from ear to ear. Then he'd tell us something like, "I just closed a deal to connect Omron cash registers to microprocessor-based computers (remember, this is pre-PC) and upload the data to the Series/1." Then he'd throw down a spec sheet for the Omron (translated very poorly from Japanese) and say, "How do we do it?" That was the sales black box: Mike had no fear of selling pure and unvarnished vaporware, because he knew we'd figure out how to do it. I look back fondly on that place; it was a fantastic way to begin my career, because I was never told that something couldn't be done. In fact, I was challenged on a regular basis to make the impossible occur.

Not All Black Boxes Are Alike

I generally don't have problems with black boxes in our industry, at least not the big ones that tend to center on sales and marketing and deadlines and deliverables. Those sorts of black boxes are the things that push the envelope to make us work harder and strive for ever-loftier goals as programmers.

However, the little black boxes that are starting to appear in programming itself bother me. Those are the little boxes that say things like, "Don't worry, this new hardware will work just like the old one." Or "Just use this API; it will do exactly what you want." Or "You have to do it this way; it's the standard." Nowhere is this more evident than in the current rush to SQL. It seems that a small but very vocal segment of the programming population wants to use SQL as a replacement for programming. And this really bothers me.

Declarative or Imperative, That Is the Question

Note the specific phrasing I used: "a replacement for programming." This will get some dander up, I'm sure, but I've taken a long time analyzing my position on this, and I believe I'm a lot more accurate than the SQL advocates might want to admit. Here's why: SQL is probably the only declarative language that is currently being used in business applications today. The term "declarative" has a specific meaning in the context of computer programming. The opposing term is "imperative," and the difference is easy to define: Declarative programming tells the computer what you want done, while imperative programming instructs the computer how to do it.

It seems like a simple, almost trivial distinction, doesn't it? But at the base of the matter is an issue so fundamental as to be almost intangible. It's sort of a "forest for the trees" situation (or maybe the elephant in the room that nobody wants to talk about). Let me try to explain it simply. In an imperative language—which includes pretty much every programming language you or I have ever programmed in—we write instructions that tell the computer what to do. The computer is completely under our control, and in fact we acknowledge that simple statement with the oft-used acronym GIGO, or Garbage In Garbage Out. Those four words very succinctly explain that the computer is doing exactly what we tell it to do and that when something bad happens, whether due to bad programming or bad data, the computer is not at fault; our own human hands have caused the breach. In a way, it's the ultimate Programmer's Creed of Responsibility.

Declarative languages, on the other hand, are not so designed. Instead, in a declarative language, one simply tells the computer what one wants, and it is up to the computer to figure out how that's done. SQL is the archetype for this concept: You tell the computer you want columns A, B, and C from table 1 and columns D and E from table 2; you tell it how the tables are related; you tell it which records you want and in what order; and then you hit the "Miracle Occurs" button. You don't know what indexes the engine will access, nor what order records will be read, nor which fields will be compared first and which last. You have basically handed off your database access decisions to the SQL engine.

Many fourth-generation languages and code generators operate much the same way. You sort of point and click and then magically code gets generated that users then use. No real programming is involved; these tools are really end-user application design tools.

Not That There's Anything Wrong With That...

So why does that bother me? Isn't it a good thing for the computer to do the work for me? At first glance, it seems like a positive, yet I was never comfortable with the concept. I thought about it for a long time until it finally hit me: The computer isn't doing the work for me. The computer can't do anything for me; it's still the same GIGO machine that I started with. I haven't enlisted some all-powerful Commander Data on a Chip to do my programming for me. What has happened is that I've turned my programming over to someone else.

Because at the end of the day, imperative code is still being executed. There are no magic declarative instructions in the Power5 machine code. The RUM (Read User's Mind) opcode still has not been implemented. So what I've really done by turning to a declarative language is to stop writing code and instead use someone else's programming. I have thrown up the white flag and stated in no uncertain terms that someone else is better qualified to write my code than I am.

And maybe it's just ego talking, but in many cases this simply isn't correct. No offense, but let's take the case of the guy writing the SQL engine code. We'll call him Bill, just to be friendly. Remember that when Bill writes his code, he has to write it for every possible case. While in some situations I'll save time using Bill's code, those are the simpler cases, the ones in which Bill can generalize and use some standard technique to get the data the fastest.

But Bill doesn't know how my database is laid out. Not really. Bill is like a really good contractor that you just hired. He knows the files and formats because he can look at the tables, but he doesn't know the contents of the data. He doesn't, for example, know that there are no records with a status of COMP and an active flag of Y, because that's a system design point that isn't encoded in the database. And while this knowledge may not affect the query he's working on, it's the kind of information that lets a programmer who knows the system write better code than one who doesn't.

It gets even worse when you talk about code generators. Database access for the most part boils down to mathematics, and as operating systems keep better track of the statistics of your database, Bill will be able to make better decisions. He won't always make the correct decisions, mind you, but he's got a much better chance than Jen. Jen is the person who wrote the code generator you are using. And while Jen is probably a very good programmer, try to remember the last time you sat down and looked at someone else's code and said, "Wow, that's exactly how I would have done it!" Again, it's obvious that I have an ego the size of Montana, but I still think that I'm a better programmer than Jen, especially if she hasn't been writing ERP applications for 25 years.

So, no offense to Bill and Jen. I love them dearly, and I respect their abilities. I'm just not quite ready to hang up the spikes yet. When Cal Ripken, Jr. broke Lou Gehrig's consecutive games streak in 1995, he decided he still had a few years left in him, and frankly so do I.

Joe Pluta

Joe Pluta is the founder and chief architect of Pluta Brothers Design, Inc. He has been extending the IBM midrange since the days of the IBM System/3. Joe uses WebSphere extensively, especially as the base for PSC/400, the only product that can move your legacy systems to the Web using simple green-screen commands. He has written several books, including Developing Web 2.0 Applications with EGL for IBM i, E-Deployment: The Fastest Path to the Web, Eclipse: Step by Step, and WDSC: Step by Step. Joe performs onsite mentoring and speaks at user groups around the country. You can reach him at This email address is being protected from spambots. You need JavaScript enabled to view it..


MC Press books written by Joe Pluta available now on the MC Press Bookstore.

Developing Web 2.0 Applications with EGL for IBM i Developing Web 2.0 Applications with EGL for IBM i
Joe Pluta introduces you to EGL Rich UI and IBM’s Rational Developer for the IBM i platform.
List Price $39.95

Now On Sale

WDSC: Step by Step WDSC: Step by Step
Discover incredibly powerful WDSC with this easy-to-understand yet thorough introduction.
List Price $74.95

Now On Sale

Eclipse: Step by Step Eclipse: Step by Step
Quickly get up to speed and productivity using Eclipse.
List Price $59.00

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

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: