Coding Best Practices – Part 2

This lesson is part of the course Automation Anywhere Bot Development Best Practices . Use navigation on the left.

Following is a list of best practices that one could consider to create bots that are clean, easier to read, test, maintain and are stable.

1. Hard delays

Avoid using hard delays. The trouble with delays is that they are heavily dependent on the specific computer and its virtual desktop infrastructure (VDI) that the bot runs on. It is better to use commands. For example, use the Wait For Window command if the delay is meant to wait for a window to appear. This removes any dependency on the speed of the VDI.

2. Mouse clicks and movement

Avoid mouse movements, scrolling, and clicks in bot development and design. Bots are highly dependent on the display and VDI on which they run. Errors can occur if the screen size is different from the one on which the bot was created.

3. Screen resolution

Use the default resolution when developing bots. Using nondefault screen resolutions forces users to change their screen resolution to run their TaskBots. No specific default resolution is required, if the resolution of the Bot Creator and the Bot Runner match.

4. Wild cards 

Do not develop bots to work with specific editions of the target application. Instead, use wild cards so that it is applicable to all editions of the application, for example, when using Object Cloning, to identify a window object:

Use wildcards, for example:

Salesforce -* Edition - Internet Explorer

Do not use specific versions or editions, for example:

Salesforce - Professional Edition - Internet Explorer

5. Prompts, pauses, and message box commands

Avoid things that require bots to wait for user input. Prompts, pauses, and message box commands stop the bots and MetaBots from running when waiting for user input. Unless user input is required, and a user will definitely be present to provide the input, design the bots without using prompt statements.

6. Folder structure

Keep related files together. This assists others in understanding which files are related to which bots. This is particularly important with MetaBots.

7. Keep code clean

Do not over complicate the bot with unusable code for future development. Remove unusable code and tasks for ease of use by customers.

8. Robustness and flexibility

Always expect the unexpected. Files change. Web pages change. Try not to hard code solutions if flexible programming methods accommodate change.

You might be interested in the following courses:

Course Category

  • UiPath Automation Coding Standards

    by Ajay Kumar Konda

    Coding standards are a collection of rules, guidelines, and best practices. Coding standards are important for safety, security, and reliability. In this course, we learn the most important and UiPath recommended coding standards. Starting from naming conventions to maintaining your code in the code repository, we cover all the best practices.

  • Automation Anywhere Bot Development Best Practices

    by Ajay Kumar Konda

    This is an advanced guide to best practices that need to be followed in developing bots using Automation Anywhere. This course provides an introduction to common bot design guidelines and standards. Avoiding common mistakes and including these processes and considerations in your bot design standards, creates bots that are clean, easier to read, test, maintain, and are stable. Most of […]

  • All You Need To Know About Robotic Process Automation

    by Ajay Kumar Konda

    Robotic Process Automation(RPA) is a kind of automation where a bot performs human’s task in completing rules based jobs. Robotic Process Automation refers to a style of automation where a machine, or computer, mimics a human’s action in completing rules-based tasks. In traditional workflow automation tools, a software developer produces a list of actions to automate a task and interface to […]

Back to: Automation Anywhere Bot Development Best Practices > Lessons