By: Katie Rose Hester, Content Writer
Robert Gilmour, Back End Web Developer
Engineering Workshops are interactive, collaborative articles that address a variety of web development topics, from big questions about how the Internet works, to more specific issues like web page processing. Our in-house subject matter experts work hard to bring these technical, nuanced subjects to life in an engaging way, because we want to share our knowledge with anyone who’s interested in learning more about us or the services we provide. These workshops are a part of our ongoing commitment to demystifying the outsourcing process - we share what we know so that everyone we work with feels comfortable and confident at every turn.
Functions that enhance functionality
In mathematics, a function is defined as a process, expression, or law that relates inputs to outputs; in web development, it means largely the same thing. In fact, when a developer chooses a serverless computing service, part of what they’re doing is making a decision about how they will break their code down into small, isolated functions, so that it can be executed efficiently. And in web development, as in mathematics, it’s critical to select the right processes, in order to drive the most meaningful results.
Different serverless computing services lend themselves to different tasks: some are best for operating serverless websites, and some are used for managing insular tasks and processes. While Azure functions can be used for managing a serverless website, some typical use cases for Azure functions include sending emails, messages, or notifications at certain pre-set times, task scheduling, and order processing, all of which can be done without affecting main application processing - meaning a website won’t slow down or crash when any of these tasks are being executed. Azure functions is an important building block of an event-driven architecture, which is a design approach focused on responding to changes of states, or ‘events’ in a wider system, like the swiping of a credit card, or the completion of a purchase.
In addition to supporting and enhancing the functionality of a website by managing certain tasks in the background, Azure functions offers other benefits of serverless computing, as well, including reduced cost, increased simplicity, improved scalability, and minimal waste. But, like most Functions-as-a-Service (FaaS) offerings, it has its own distinctive set of benefits that set it apart and make it uniquely valuable: in the case of Azure functions, these benefits include its compatibility with a range programming languages, and, notably, its use of triggers and bindings.
Triggers: inputs as a catalyst for connection
Triggers and bindings are part of Azure function’s programming model (how a program is actually executed), and are, essentially, mechanisms for facilitating connections through the retrieving, transferring, and storing of information. Triggers are what cause a function to run: a trigger defines how and when a function is invoked, and a function can only have one trigger.
As back end web developer, Robert Gilmour explains below, there are many triggers available for use in Azure functions. Each one - for example time triggers and blob storage triggers - serves a different purpose, making them easy to identify and utilise.
Bindings: the ‘x’ factor for enhancing data flow
Bindings, unlike triggers, are optional, and non-exclusive. Said otherwise: they’re an ‘x’ factor for enhancing a function. Bindings may or may not be assigned to a function, and a function can have more than one binding. So, in sum: every function has a trigger, and may also have optional bindings. Bindings are connections to data sources within a function, and there are two types: input bindings, and output bindings. To put it simply: an input binding is the data that your function receives, while an output binding is the data that your function sends. In the example where Azure functions is being used to schedule an email, a certain input binding would be used to retrieve the content or images meant to populate the email, and a certain output binding would distribute the email to the intended recipients.
When a developer uses a binding, they can interact with data without thinking about how it flows to and from a function, which is meant to make processes run smoother, and more efficiently. Gilmour explains more about bindings and their function, below:
And in the next clip, Gilmour demonstrates how to utilise a specific type of binding, the cosmos DB binding:
Durable functions: simple solutions for complex workflow
Triggers and bindings are useful because they’re a more seamless way to facilitate the execution of important, dynamic functions. To support an even broader range of use cases and orchestrate more complex workflows, Azure Functions offers an extension, Durable Functions, which Gilmour discusses in detail, below:
A formula for success
Ultimately, how you approach serverless computing, and whether you utilise Azure Functions, will depend on the size, scale, and goals of your project. Azure functions, like other serverless computing services, will promote cost effectiveness, and reduce waste. Azure functions, specifically, should also help to create a more productive app development experience, because of the way it seamlessly, straightforwardly facilitates and supports information access, and data flow.
Ultimately, much like some of the processes it supports - such as sending emails and messages - Azure functions helps to facilitate the transfer and processing of information from one place to another. Expressed mathematically, Azure functions is the product of simplicity and versatility. To state it plainly: it’s a formula for success.