Shift Happens: 1 - Foundations, Toolboxes, and Cutting Code by Mike Moegling
Shift Happens: 1 - Foundations, Toolboxes, and Cutting Code
If you are a RPG programmer, I hope at the time of reading this blog post you are working and doing well. Change surrounds us. As an Information Technology professional a cardinal rule that should be front and foremost as one of the truths of this business is “Change happens either for you or to you”. Change or as I will call it in this piece, shift, happens all around us daily. We are in a tsunami of new ideas, paradigm shifts, changed thinking, and a global technology blitz. Shift Happens (Fisch & McLeod, 2016).
Recently I have been listening to several podcasts discussing the investments Google, IBM, Apple, and Microsoft have been placing in the emerging technologies of Artificial Intelligence and Virtual Reality. Although directly these investments have very little bearing on the RPG code you are working with, shift happens. The information technology that you exist in is a world found living in and around the worlds of business, revenue, ideas, thought, and opinion.
How does this shift affect us, as if the butterfly effect (Wikipedia - Sourced , 2016) of the larger Information Technology world has bearing on if you are using subroutines verses procedures or not? Because shift happens, and secretly (well not secretly but certainly not widely spoken about) RPG has morphed from its inception, to a language of business, to a platform specific language, to a full blown programming language with unlimited power and ability. You might know this and you might not. Shift happens but there is a problem. The language has grown and shifted, but not the complete true source of the language, its programmers.
But shift happens, and today that is a good thing because we are shifting back.
There are some basic foundations which if grasped and put into action, can transform your development and provide extreme value to your business, code base, and future development. Often when talking about modernization of RPG programming it is often the foundations that need to change, and the code changes will start to take change immediately.
The following list is not an all-inclusive list, but a start to consider and build upon. I plan to write about these in detail later on.
Codebase: Stop thinking as source as files and members, but as a codebase. A codebase is gold and the wealth generated from all the work you and others have put into place within your organization. This is the start to understanding true change management, modularity, reusability, and eventually open source possibilities. Guard your codebase and protect it.
Create, don’t copy: Know your RPG and know how to create from scratch. In the business programming world, we do modify and maintain existing programs, and this is something we do often. But, with this said, when there is an opportunity to create something new, don’t copy, create. Start with a new fresh RPGLE or SQLRPGLE source file and create. Learning to create from scratch exercises all the muscles and teaches the core elements of “real” programming and development. It also points out your weaknesses and gives you a to-do list of modules you should have in your environment, code methods you should be able to work with from scratch, and lastly point toward the tools you should have in place now to develop more later.
Standards and Style: Programming is technical, but it is also art. Craft it as such. Develop or adopt in-house standards and programming styles to get yourself and your team working toward a sustainable development environment which grows in productivity and declines in technical debt and redundancy.
Pay attention: ILE RPG is not the big boy on the block anymore. While the web and browser based world has taken off like a wildfire on a dry field using a plethora of technologies, the RPG world has not been paying much attention to what this growth has done for these technologies. But this is changing, so pay attention. Watch, learn, try, and participate.
The toolbox of the contemporary ILE RPG programmer has changed. With every company I have worked at, I generally have sat down to an underpowered PC, with the usual install of “just give him Outlook, Word, Excel, and green screen”. My first mission has usually been to flip this mindset and view of RPG developers with requiring Visio, WDSc (now RDi), IBM CODE studio, PowerPoint, NetBeans, and for heaven’s sake, more ram please!
Develop your toolbox and the toolbox for your team mates. Your toolbox is important and crucial to your productivity as a software developer. That’s right! If you are a RPG programmer you are a software developer, be proud of it. Outside of the office and work at home I am someone who enjoys working with tools and building and fixing things. With this pastime comes lots of tools and jigs acquired over time and projects. I have lots of toolboxes and some roller chests of tools. Power tools, measuring tools, construction tools, small tools, large tools, and even some useless tools. The point I am making is that in the development world every experience adds should add to your toolbox. If all you have is a hammer, then everything looks like a nail. Shift happens. Don’t be this type of RPG programmer.
You should love code. I mean really love code. Code is where it is at for a modern software developer. RPG is modern, agile, and ready to perform no matter how much shift happens. Code has a personality, tells of the person writing it, explains the thoughts and thinking of the time it was written, and gives a glimpse into the stage the development and developer is in. It also tells of the design time and thought prior to the code being cut.
I love the term cutting code. It speaks of new ideas and attempts at an improved method and growth in an application because of shift. And if you are not aware, shift happens.
Cut good code. Get better at it every day. Put your 10,000 hours in (Wikipedia - Wiki Sourced, 2016). If you love what you do it shows.
The code sample below is not ground breaking, may be a little forward or backward depending on your place in the RPG world, but it has the strength of true RPG but also has the attributes of the shift that is occurring in our namesake language. It requires some comments, but not too many, is clear in its naming, takes advantage of procedures (internal and external), is able to be bound into an ILE application, and is easy to read and understand. Cut good code. Learn, Improve. Repeat
$rc = exeCreateSalesEntry($company : $customer : $order);
If $rc = true;
// new sales entry
$result = processNewOrder($company : $order);
$result = costNewOrder($company : $order);
$result = priceNewOrder($company : $order);
$result = confirmNewOrder($company : $order);
// test result return code, if error post to exceptions and notify user
If $result = $error;
postErrorNotification($company : $customer : $order);
postSuccessNotification($company : $order);
printSuccessConfirmation($company : $order);
postErrorNotification($company : $customer : $order);
Why share this code snippet? Because code is where it is at, and the better the code, the better the application, the better the code base, the better the programmers, and the better deliverables we can produce. Remember what I stated earlier, change either happens to you or for you. Your code and the quality and productivity returned on your investment in true RPG coding will speak loudly to management and leadership. Make change happen for you, with your code.
We are not living or working in the decline of a technology but in the defining and building of the true strength of the language and what it can do for both the developer and the businesses we work with. This language has shifted, and is forward moving and progressive. There is a revolution within the RPG development community to be relevant, up to date, able to integrate, and welcomes the tools of the modern age.
ILE RPG is the best OLTP (online transaction processing) language ever developed and is certainly not done and buried. It is growing and is shifting. Our job is to work together to make it shift faster and more focused. This is a working together thing. Shift happens to us too.
Shift Happens: Original Version – Stunning and thought provoking. https://www.youtube.com/watch?v=FdTOFkhaplo
Podcasts to note and recommend if they apply to you. You can find them on iTunes, Sound Cloud, or Stitcher.
• Tim Ferriss
• James Altucher
• Inc Uncensored
• Coding Blocks
• Programming Throw Down
• Ideo Futures
Max Harris: Metamorphosis-The Story of RPG – While I strongly disagree with the section of the “Post Modern Period” section as the story is changing right now, the story of RPG is told and is a great fill in the blanks for us who could use a little more history of this tremendous language.
Fisch, K., & McLeod, S. (2016). Shift Happens. Retrieved from Shift Happens Wiki Spaces: https://shifthappens.wikispaces.com/
Wikipedia - Sourced . (2016). Butterfly Effect. Retrieved from Wikipedia: https://en.wikipedia.org/wiki/Butterfly_effect
Wikipedia - Sourced. (2016). Outliers. Retrieved from Wikipedia: https://en.wikipedia.org/wiki/Outliers_(book )