It’s always a good idea to stop and plan before doing any task. This is particularly helpful when preparing to automate a task. Especially when it’s your first time.
You will be thankful for this planning when you are learning the nuts and bolts of how to build your app
Planning is important but I’m sure you want to get started actually building your app as soon as you can. So I’ll keep this brief and to the point. You will be done in 10 minutes for most tasks.
1) Break the task down into steps
List the steps you take when you do the task manually. With many things in life – and particularly coding – the simpler you can make something the better. Never try to automate an entire task in 1 big step. You will find it much easier to just automate each step one at a time.
To start with you may end up writing a method (more on what methods are later) for each step. So you’ll appreciate being able to just glance at your list and have an idea of what you want to achieve for this step.
An example of your list might be:
- Open up spreadsheet
- Filter to show data for a certain range
- Copy these rows to a new spreadsheet
- Run some formulas on the data to produce a report
- Email the report to someone
Even if you don’t finish automating the full task in one go, you may still save yourself some work by having the app automate the first few steps. When you get more time you can return to finish automating the full task.
2) Identify inputs, processes, outputs and delivery
Inputs are the information you need to start. From the example above this would be a spreadsheet. It could also be data from a database/email/website. Or anywhere else.
Processes are what you have to do with your input to get your result. Using our example, the processes would be filtering the data down to specific rows, copying these to a new sheet and then running the formulas/calculations. This is typically where you can save yourself the most time over doing it manually.
Outputs are what you expect to produce at the end. Using the example this would be the report spreadsheet. It could be any other kind of file or text or number or whatever.
Delivery is how you want to get your outputs. In our example the report is emailed to someone, say your manager or a client. It could just as easy just be some text or numbers appearing on your screen. Or a file uploaded to FTP or network drive.
Your app will take in your inputs > run your processes > produce your output > and deliver it for you
Identifying these now will help you plan for automating each step.
It’ll also mean you can ask for help eloquently. You won’t need to ask for how to make a company X report from the period Y sales data. You’ll be able to ask “How do I import data into C# from an Excel file?”. This will be very useful to anyone trying to help you.
3) Who will use the app?
This boils down to does the app need to be used by anyone else? If not, you may be able to get away with a very basic UI. Or no UI at all.
Visual Studio (the program you will use to create your automation apps) has a debugger. A debugger lets you run your app from inside the program. If it hits an error then it will pause on the problem line and give you a reason why it happened. Rather than just crash with no explanation.
After spending an hour or so in Visual Studio you will find you are as comfortable running an app in the debugger as you are clicking on an app icon from your start menu or task bar. You may even be more comfortable doing this as you get the insight into any errors as mentioned above.
The beauty of just using the debugger is you that don’t need to spend time on a good UI and it is quicker to recover should you find a bug
If you expect to pass your app onto someone else to do the job (or you are making it for a team or department to use) you will need to make sure it has a good UI.
You will need to make it simple enough that someone can understand how to use your app. Someone who didn’t make it themselves and so doesn’t know what each button does.
You will need to make sure it doesn’t crash if someone does something silly. Like try to import a picture of their cat instead of an Excel file.
You will want to put time into polishing the UI enough that most people can use it without issue
When you have a few automated tasks under your belt you will have a better idea of what to plan for. You may consider the following:
- With your knowledge of programming techniques could you combine a few steps into 1?
- Is there a more effective way to perform the task in code than the existing manual process? Do you need to create a new list of steps?
- Can you add extra features to the task that weren’t possible when doing the task by hand? Are these useful enough to add to the app?
- Can you re-use code you have already written? Methods like importing an Excel sheet can be re-used again and again. No need to re-invent the wheel.
How do you prepare for automating tasks?
Do you have anything to add to the steps above? I tend to favour a simple, abbreviated planning stage to get the essentials clear in my mind. This is mostly because I get very impatient while making preparations. I get itchy feet and want to get started building the app.
Do you find you benefit from spending a little longer in planning and creating a more thorough plan? How do you prepare yourself? Tell us about it.