Have you ever been to a supermarket where only one checkout is open? Of course, you have. While standing there you will have had the thought “Why on earth aren’t they opening a second one?”. Well probably short on staff, but that’s not the point here. By having the thought about a second line, you’ve already used the very simple idea behind asynchronous programming, because in short, it’s about doing things faster.
Before explaining what exactly asynchronous development means let’s start with the standard practice in development and actually the very opposite: synchronous development. Synchronous development follows a strict route. It’s a step-by-step algorithm, where the second step needs the first to be finished before it can be started. Also, in order for everything to work, the operations must be done in the correct order. So, in our supermarket context: Before the veggies from Person B can be scanned, Person A must have paid their groceries and put them away. Synchronous development means following a path, which is great when it’s a simple one. If there are many tasks that need to be done, a synchronous route can be very frustrating, since it will take forever. We’ve all gone to the supermarket to grab a quick drink and all of sudden everyone in front of you decides to pay in pennies.
Asynchronous development lets you run many different operations simultaneously. Many different processes can run at the same time and after they finished their job, put the outcome through the program. Basically, you have many registers where you can buy your groceries. This doesn’t make the food taste better or the whole thing cheaper, but it does work a lot faster. In a software context, the user doesn’t have to wait for one function to finish loading, before moving on to another. After posting a picture on Instagram, the user doesn’t need to wait until it’s completely uploaded but can continue to scroll through his feed.
In the front end an application benefits from the use of asynchronous programs because it enhances the flow and makes it smoother. In the backend asynchronous programming lets the computer do more things at once and do them faster all together.
Commonly asynchronous programs are used when data needs to be fetched from a source. Since the needed time for this process is unknown, the program basically sends out the data request and moves on right away. When the data arrives it’s simply inserted into the script.
As always, asynchronous development is not the golden cow. So now to the next question: When should asynchronous development not be used?
In software development two situations are never the same, so providing an answer to this question proves to be a bit difficult. However, there is a general rule of thumb that can be followed: First, don’t use asynchronous when you want simplicity. You don’t need an oven that can also be used as a TV, when all you want is to make a pie. Don’t overcomplicate this task. Second if your operation is rather short, asynchronous programming might not be necessary. To put this in an example, you don’t need to buy a car for something that is walking distance.
But development isn’t the only aspect where asynchronous processes can be useful. Let’s take communication for example. In a normal conversation the communication is always synchronous, you ask a question and get an immediate response. Even the online communication is nowadays almost instantaneous, so it’s not a real surprise, that the average response time for an email is around two minutes. Slack and other chat options made it even easier to cut the response time. At first glance this might seem like a good thing but there are some downsides to synchronous communication.
Being connected to the other employees is important, but when collaboration takes up to much space there is no longer time to do your own critical tasks. If one eye is always focused on what’s happening in the slack channel, the work flow will be interrupted by every new message. Without focus tasks will take a lot longer and valuable productivity is wasted. To top it off, this leaves the employee to feel more stressed, since the problems they are trying to solve take so much longer than they have anticipated. Another down side is the lower quality of the responses. We have all been there, sitting at home and finally come up with the perfect witty come back to an argument we’ve had earlier that day. Now hopefully there aren’t too many arguments in your workplace, but taking time to think before responding will improve the quality of an answer to almost every question. Now of course there are some mails that need the immediate attention, but for everything else asynchronous communication can benefit everyone.
Another aspect of work where asynchronous processes can be very useful is working hours. Instead of having everyone start working at the same time, let the employees choose their hours themselves. Since everyone has a different rhythm, it doesn’t really make sense to have everyone start at 8 o’clock sharp. For some the more productive time is in the evening and others work best in the night. This will not only lead to more productive employees, but will also give them back a feeling of control over their life, lowering their stress level and improving their overall well being. Of course a little bit of synchronization is needed here as well. Some core hours could be implemented where everyone needs to be online in order to have direct meetings.