It is a significant understatement to say the RPA industry growth has been significant over the last couple of years. As more and more organizations are looking into introduce RPA and reap business benefits, it is safe to say that the question will no longer be what RPA is but how best can ensure we are scaling our program with speed and quality. To achieve both velocity and consistency, following best practices and maintaining the code quality is of the upmost importance.
Every Developer has their own style of automating. Irrespective of the platform, there is no right or wrong way of doing it as long as everyone in the program is following the same standards. Let us look at how we at Ashling Partners collectively work together to make sure the code is developed and maintained to ensure we are delivering a quality solution with speed and scale in mind. Please note my thoughts are based on the UiPath platform.
Firstly, a developer must make sure they are following a standard template across all the Automation Projects. For example, ReFramework provided by UiPath can be leveraged for any automation, irrespective of the complexity and the number of steps involved. Having a standard template ensures all the automations, be it an excel automation or an ERP/Web application, are following the standard exception handling protocol for logging and reporting and enabling a smoother transition to another developer.
Naming Conventions and Descriptions
One of the most talked aspects (and rightfully so) in maintaining code quality is naming conventions. Meaningful names should be assigned to variables, arguments, workflows and activities. On top of this, having a good naming approach for queues, assets and process names in Orchestrator ensures good readability and understanding of each process:
- Variables should be upper Camel Case with the variable type at the prefix e.g. str_FirstName, dt_ExcelReport, bool_FileExists
- Arguments can be declared in Camel Case with a prefix describing the argument type. E.g. in_dt_ExcelReport, out_Config, io_RetryNumber
- A very short description of each activity name is recommended for efficient debugging purposes e.g. click ‘Login’ button, type into ‘First Name’ instead of a generic name. In case of an exception in an unattended automation, the log message will contain the activity name where it failed. Similarly, renaming a sequence, If Condition, Assign activities should also be manually renamed on what its purpose is.
- UiPath Orchestrator
- Assets, Queues and Process Names must follow a similar naming convention if there are multiple processes running on same Orchestrator tenant. For example, the naming convention can be as [Department]_[Process]_[AssetName] e.g HR_ResumeScreening_ReportingEmail, AP_InvoiceProcessing_SAPCredentials
A developer often uses same steps/workflow in more than one project. It should be a common practice to componentize workflows that can be reused across the automations and add them to a library/repository.
An example of a reusable component can be logging into an application e.g SAP_Login.xaml. This can be added to a library within UiPath Studio that can just be dragged and dropped into the Project. There is no universal approach of storing reusable components as long as they are well structured. They can be stored in a Network Shared Drive, DevOps Repository or within UiPath Studio Library. Most organizations are moving towards a uniformed standard for code repositories such as Azure DevOps Git.
In order to easily maintain the project versions and sharing the work with other Developers, using a Source Version Control capability that is directly integrated within UiPath Studio is recommended as well.
Workflow Analyzer/Code Reviews
A Code Review is essential to make sure a Project is following all the best practices. Having a third eye on the code is something that should be incorporated before moving the code to Production and open to constructive feedback.
Workflow Analyzer: UiPath has recently integrated a native Workflow Analyzer platform that enables us to create a set of rules that can be run through to make sure if the Code is following the pre-defined naming convention rules, if the activities are named appropriately and such. We at Ashling have developed our own Workflow Analyzer with custom rules that is ran during the Code Reviews. Typically, we are analyzing the code to ensure it is following 3 key aspects:
- Scalability – The Code should not use any hard-coded values within the script but use of a Config File or Assets should be leveraged to minimize any script changes later. A Developer should always look to build the code so that it is multi-bot capable and minimal script changes are necessary for smaller enhancements e.g. the business wants to change a file path or reporting email at the end of day.
- Readability – Meaningful names and a standardized approach across all the automations is the focus here. The automations should be consistent and easy to follow the flow of the process.
- Maintainability – The emphasize here is around the ability to provide minimal production support and maintenance. Debugging and appropriate logging enables easier maintenance and easier transition to other developers.
To ensure a smoother transition, proper Documentation is essential as it serves as a user guide and troubleshooting steps. For example, information like if the Process can be run on an ad hoc basis vital for business continuity. A list of assets, queues, and scheduling is additional information that can be useful and should be included in the documentation allowing for better maintenance. There are many different forms of documentation derived from an organization’s COE standards and governance (e.g. business impact analysis, development specifications), but the universal document across automation progress that encapsulates all important development and technical design details is the Solution Design Document.
This high-level overview should give a pretty good understanding of how code can be maintained and ensure we are following the best practices from onset for those who are getting started on the RPA space. There is a lot more detail into maintaining code quality, especially as a program scales in size and speed. To simplify advice on development standards, you should ensure you have standards, communicate them early and often, and conduct quality checks to ensure your execution of those standards are progressing.