With Robotic Process Automation (RPA) now a common business process for a number of industries, developing automation software and programming bots is a rapidly growing sphere of software development.
For developers working in the burgeoning field of automation coding, the relative novelty of the discipline means there are some conflicting opinions over what constitutes best practice. We’ve put together some basic tips for software developers looking to hone their coding skills for the brave new world of automation.
#01. Employ the Best RPA tools
There’s no shame in using whatever tools are available to help you design the best bots in the most efficient way. Just because you could write every line of code yourself doesn’t mean you should. A video editor might be perfectly capable of editing their work using any number of professional techniques, but that doesn’t mean they shouldn’t also make use of a YouTube video maker when appropriate.
In the world of automation software, there are several tools that have proven themselves to be very handy when it comes to streamlining the development process. Platforms like Automation Anywhere have pioneered the way in engineering low code solutions to the task of automating business processes and is one of the leading RPA tools.
When using traditional workflow management software as an automation tool, a software developer produces a list of actions needed to automate a task and an internal application programming interface (API) or dedicated scripting language to interface with a given system’s back end.
In contrast, RPA systems develop the action list by observing a user perform a task in the application’s graphical user interface (GUI) and then perform the automation by repeating those tasks directly in the GUI.
This lowers the barrier to use of automation and enables the deployment of automated solutions in the form of bots that boost the productivity of human workforces by removing the need to carry out routine tasks. It’s thanks to RPA frameworks that we have seen such huge growth in the automation of customer service, for example.
Other essential RPA tools for automation developers include preconfigured bots that can be incorporated into your own automation products.
Tasks that you might want to include in an automated process, such as text extraction and sorting, can be delegated to a number of powerful RPA tools. For example, Data scrapers and Optical Character Recognition (OCR) agents can be included as modules within a larger process of robotic automation.
#02. Know When to Avoid Hardcoding
Put simply, hardcoding is the practice of embedding functions and values in the code itself, while softcoding refers to the use of configuration and parameters to refer to external resources.
In any form of coding, an overreliance on softcoding can lead to bloated code that shifts errors from compile time to run time, making them harder to detect. Nevertheless, it is best practice to avoid hardcoding commonly altered values. This rings especially true for cloud-based applications and automation programming, which often needs to be configured by an end-user without access to the source code.
Of course, who your end-user is will inevitably depend on the nature of the software being developed. If you are developing automation for cybersecurity, you can assume a certain degree of technical know-how.
But when writing code for automation software, you can’t always assume a high level of code literacy. If your software product helps facilitate onboarding automation, for example, your end-user is more likely to be HR team members with little background in software engineering.
Avoiding unnecessary hardcode with end-users in mind is also important if your end-user is a developer, such as when writing testing automation scripts. Because hardcoded values have a tendency to break in the case of any application changes, it is best to rely on variable driven components for automated software testing.
Components like locators can be kept out of your code by storing the respective values in a spreadsheet. This makes for easier modification of that component by your end-user without them having to change the source code at all.
#03. Follow a Strict Naming Convention
Following a proper naming convention is a good idea no matter what type of programming you are doing. For automation developers, it is recommended by every automation centre of excellence.
Which convention you refer to will depend on the type of coding your project demands and the technologies it implements.
For example, when it comes to designing bots, Automation Anywhere has a recommended variable naming convention:
- Variables start with “v”
- Lists start with “lst”
- Arrays start with “arr”
- Randoms start with “rdm”
Some developers prefer to add variable “type” prefixes to the front of their variables, for example:
- “int” for variables expected to hold whole numbers (integers)
- “str” for variables expected to hold a string of characters
Keeping to proper naming conventions makes code easier to read and maintain. Variables, methods, classes, and packages should be named in a way that doesn’t lead to confusion. Avoid generic, or non-descriptive names like a, b, c, etc. These give no indication to the end-user as to what a given element actually does.
#04. Write Clean Code
The art of writing clean code is all about keeping your scripts simple and legible. When reviewing your code, ask yourself if there is a more elegant way of reaching the same outcome.
Simplicity is not just about making your codebase as short as possible. When coding methods, it’s important to break them down into the smallest units of user scenarios. Do not overcomplicate your methods by assembling multiple functionalities into a single method.
It is also useful to reuse your methods wherever required, do not copy and paste the same code into different methods. This will lead to unnecessary duplication. Instead, refactoring and optimizing your code is key to writing better, more concise automation code.
No matter whether you are programming attended or unattended bots, or how you define the front office back office distinction, it is always best not to assume that your end-user will share your technical background. Only you will know who you are writing for, but there are two things you can do to improve interpretability regardless:
- Comment your code so that other developers can understand your reasoning and syntax
- Be consistent with your naming conventions and make sure these are the same as those used by the rest of your team. If you are creating automation testing for software developers, follow their conventions
Generous commentary can also help you keep track of your own scripts. What might seem obvious while in the process of writing code may not make so much sense when you return to the same script several months later.
Coding for the Low Code Future of Automation
As hyper-automation technologies such as RPA- and GUI-driven automation frameworks are rolled out across an increasing number of industries, we are entering a future where knowledge of programming languages is less central to the automation programming skillset.
Or rather, the new language of automation has come to look like its own ultra-high-level language –one that closely resembles natural language and is more accessible to business analysts, project managers, and other professions at the vanguard of the automation revolution.
Following these four best practice tips will help you to code for the low- or no-code future and be part of the changes to come.
Driving in the Cloud: How Creative Programming is Reshaping Transportation
Understanding the Bom of Low-Code and No-Code