Start 30 Day Free Trial

Simplifying application development through API-first design methodology

Podcast
Coding Over Cocktails Logo
  1. Home
  2. Podcast
  3. Simplifying application development through API-first design methodology

In our day-to-day lives and in our conversations, we would often hear the terms ladies-first, design-first, mobile-first, security-first, head-first, feet-first, and all the other -firsts in the world that you know.

But have you ever heard of API-FIRST?

According to tech blog API Evangelist, “API-First is a philosophy and way of life that involves beginning every software capability as an API before you ever begin to develop any user interface, or any other element.”

He further says that achieving an API-first state right now is more of a myth than it is reality, but it is something that companies strive for.

Nowadays, organizations are not only consuming APIs, but also publishing them for purposes such as system automation, integration, creating new digital products, or connecting devices in the world of Internet of Things – such as your smartwatch to your car, and your car to your garage doors – and so on.

Thus, developing APIs first becomes a more thoughtful, more customer-orientated approach.

Our company, TORO Cloud, also advocates strongly for an API-first methodology towards development, especially when it comes to the adoption, and consumption of APIs.

And that's what we'll talk about in this round of cocktails.

Transcript

Kevin Montalbo: Hello, internet friends. My name is Kevin Montalbo, and I'd like to welcome you all to another episode of Coding over Cocktails.

In this episode, we will talk about the API-first design approach and its advantages, such as how it helps achieve a more efficient method of software design and how it helps developers quickly and easily understand how your API works and how it integrates with other applications. After listening to this podcast, make sure to visit our website at www.torocloud.com for after discussion notes and blog posts related to this topic.

Joining us today is TORO Cloud CEO and founder David Brown. Hey David, good to have you on.

David Brown: Hi Kevin.

KM: Hello. And also with us in this episode is Vivien Jovet, a Product Architect for TORO Cloud, Martini Desktop, and Martini Workspaces. Hello, Vivien. Good to have you with us today.

Vivien Jovet: Hi Kevin.

KM: All right. So first things first. Vivien, before we talk about the API-first design approach, let's describe the traditional process of software design. How does it typically go? You've been developing software for how many years now, so you probably have more background on this. So can you describe it to us?

VJ: Yeah, usually to design, to develop an API is, you can have, like a global goal for the API, like what the API does. So for example, you're doing, let's say an API for contacts, so you're going to say, “Are we going to have contacts?” You can add them, remove them, modify them, query them, et cetera. And so you're going to hand that over that task to a backend developer, and the backend developers are going to start working on it. So it's going to start coding. It's going to start writing the classes, it’s going to start working on the, maybe the database schema.

Then he's going to start writing the service layer. How does it communicate with the database? Then it's going to expose that on the server with the IRS controller. And then once it's done with that, maybe it's going to write some unit tests, some integration tests that are going to present the final output. And then, they're going to do some more tests maybe by QA, and then if they're not happy with it, they're going to restart that process. And then basically do that until they get, they actually have something that they are satisfied with.

KM: So, this is before the API first design approach, right?

VJ: Yeah, that's right.

KM: So, what were the problems that you were usually encountering? What would you say were the problems that you would usually encounter when you're following this process?

VJ: Well, I would say that the main issue is the length of the iteration process, to get to the perfect API that you want, because every time you have to do changes, even just small changes, it's cascading until you have basically too many changes. Like you just want to change a field in your contact model, for example, you’re going to have to update the database schema, you’re going to have to update your code, update your request, update your tests, et cetera. So every time you want to make small changes, it's involving a lot of side effects.

KM: The traditional process has its benefits, sure, but it has some flaws as well. It prolongs the iteration process in making changes with the software and it takes a lot of time in going through each phase.

And for you, David, for someone who heads an organization, how does this affect the productivity of your entire organization? How does not having an API-first design approach affect your productivity?

DB: Well look, it's a totally different approach to not only API design, but services design as well. So, the transition towards services-orientated architecture and application design has meant that you break down applications into the components and each component performs a specific function or service. And like Vivien was explaining, the traditional way of building those services has been from that application layer up. This turns all of that on its head, and instead thinks about the user experience first. And when I say the user experience, I'm talking about the user who's going to consume this service, and then they use it maybe a person, or it may be another process and another piece of software and another system. Alright?

But we now can think about, how does that user want to consume that service first? And you start working on that design philosophy first, before you do any implementation of the service, you then end up with a contract, a contract between you and the consumer of that service. And so you're bound by that contract and you both parties agree to how that contract should look, feel, and operate. And once you've got that contract, the implementation team can go away and build to their heart's content, using any system, methodology, programming, language, whatever they like. They know, so long as they're compliant with the contract, their implementation is entirely up to them, and they have the freedom to implement it according to their best practice, to their best knowledge, to the best of their ability, to what they're familiar with, whatever it might be.

So, it totally reverses the traditional psychology around application development and API development. So, you know, from an organizational perspective, it's completely different and fundamentally different. And there are obviously major benefits to this approach.

KM: Okay. So this approach, the API-first design approach, how does it make software design more efficient? What are its advantages?

VJ: So, the interesting thing in API-first design approach is you're gonna put a lot of thoughts on how you shape your data. So, the first step would be to define your domain models, and that sounds easy, but that's actually very important to define well from the beginning. And then after that, you're going to be designing how you interact with the API. So, how the user retrieves the data and updates it. And during that step, you're going to basically be defining what part of the data you're gonna expose, what operations you want, maybe what security you're going to use, things like that. And so you're going to be iterating over how your models are, maybe you will add operations, remove some, add some limitation to it, et cetera. And that's very efficient because that doesn't require any coding and that doesn't even need to involve a programmer. It can be done by a product owner and things like that. And it's very efficient because everyone can participate in that process, not only the developer.

KM: All right. So, I've been reading a lot about this API-first, and it’s saying that it's prioritizing the API first by making it a first-class citizen. Yeah. So what are your thoughts on that, or how does it become that first-class citizen?

VJ: I would say that the API itself is what's going to be used by your customers, by your users. So, by making it a first class citizen, basically you, you make sure that the user experience is going to be great because that's going to be the first and most important thing that you're going to design. Because, the way it is designed behind the API, other than the performance, doesn't really matter to your users. But what really matters is the API and how great and easy it is to use.

KM: APIs as first-class citizens allow enterprises to build APIs that serve all the applications for which stakeholders have intended for the API. Developers will be better placed to create and maintain applications efficiently for all devices, platforms, and operating systems.

So, since we're looking at this at an API-first approach, an API as a first-class citizen, what are the characteristics of a good API?

VJ: All right. So for me, first an API, you need to be intuitive, meaning that when you're looking at the specs of the API, you can look at an operation and you understand instantly okay, that operation is going to create a contact record, and there should be no surprise meaning that the operation does what it does. If you are creating a contact record with an operation, it should not update anything or have side effects. It should be very intuitive. The second thing that I think is important is for your API to be familiar, meaning don't try to innovate too much with it, follow the standards, for example, RESTful standards. So when developers are using your API, they’re already familiar with the way it works and the way it’s organized so it makes it easier for everyone.

Also it should be testable, so you should provide a way to be able to test the API in different stages other than production. As much as possible it should be stateless, meaning that if you do request to the API, the same request to the API should get you the same answer. You should have good error reporting, meaning that when things went wrong, you should have an easy way to, to know why, so it should have a clear error report with it. And the last thing that's also very important for people to discover your API is that it should have really good documentation. So the entire spec of the API should be well-documented.

KM: All right. So David, now that we know these characteristics of what a good API means or what a good API is, we can probably implement a good API strategy. So how does an API strategy or a good API strategy improve application integration?

DB: Well, application integration can take many forms. So you know, these days with the proliferation of RESTful API, as it is often consuming APIs themselves in application integration, but often it's not. Often you're integrating data files, which are written to disk, or it might be databases, or it could be a content sent through an email, or a different form of transport; FTP, or even chat.

So application integration takes many forms. The API contract is a nice way to facilitate application integration, because once you've done an integration, if you can wrap that integration up in an API, then you now have a contract on how to initiate that integration. So it becomes reusable and it becomes discoverable, and it becomes something which you can embed in other integrations or services or workflows. And so, whereas integration itself can become part of a monolithic application design, or, you know, integration itself or workflow, and it can just grow and grow and grow and become a monster in itself if it's allowed to. By wrapping it up in an API, you've actually created a service out of that integration. And that service is isolated. You know how to talk to it, you know, what response you're going to get from it, and you can embed it in other integrations.

It also means that you can change those other integrations, knowing what impact it's going to have on his dependencies, because they're all contracts or APIs. So that integration itself can change. And you know, what impact you're going to have on other services consuming it, if you change the API. So, so long as you don't change the API, then you know, you're not going to have any impact on it, but you might change to a different database behind that integration. For example, you migrate from a small database to a large clustered solution, different vendor, different brand. You might incorporate message queues, and the like, because your system requirements have grown significantly.

You can do all of that behind your integration when you've exposed it as an API, because you're not changing the API - people interacting with the integration are still doing it the same way. Just your implementation of it has changed.

KM: All right. So we have listeners in this podcast who are all handling the business side of the organization. How does the API first design approach benefit their enterprise or operations in the long run?

DB: How does it benefit the organization taking an API-first approach?

KM: Yeah. Yeah.

DB: Well, I guess it benefits your organization because with an API-first approach, you're going to get stakeholders involved early in the process. So that is the consumers of the API going to get involved from the outset of the project. So you get them all in a room, literally around a whiteboard, and you start mocking up the requirements of the consumers of these APIs and how they wanna interact with it. You know, what sort of request do they want to make from it and what sort of response do they expect from it.

And those consumers, those stakeholders often have different requirements. So the consumer who wants to build a say, for example, a web application and API may have very different requirements to a mobile developer who has to deal with a smaller payload, for example, than a web application.

So by getting them in the room and getting them involved in the design process early, it means that you're going to promote the awareness and use of the API. So once that API is completed, then first of all, the stakeholders are aware it exists, because they are involved. Now that may sound overly obvious, but in an organization of tens of thousand employees with offices all around the world, you might have a great number of APIs, which can be discovered throughout the organization.

So by having the stakeholders involved early in the process, at least they know they exist. They understand how it works because they are involved in the design process.

KM: And the developers love that.

DB: Yeah. The developers love it because it gives them a contract which they are bound, that contract we're talking about before. They know that their service is going to be used. It has been, it's going to be used in the way the consumer wants to use it, and they can just go and build it. And then the consumer of the API will have some form of feeling of ownership as well, because they are involved in the design process.

So they're much more likely to use something where they feel some level of ownership as opposed to something that was imposed on them. “Now you've created this, it's going to do wonders for your department or organization here it is, use it.” As opposed to getting them involved early in the process, giving them some stake in the design process on ownership, much more likely to adopt.

KM: Yeah. So I want to hear Vivien’s side about this cause he's in more of the, in the development side. How does it feel if an organization or how would you feel personally if an organization would prioritize using API first and recognizing that, “Hey, APIs are actually important to the operations of our business.” So how do you feel about that?

VJ: Yeah, so I agree with David, especially when you have multiple teams working on the same project. We've experienced this at TORO as well. We've done some traditional API development in the past and most of the time, you'd have the backend team doing the API. And then later on my team would be consuming it. And then we realized that it's not quite right, it doesn't do what we wanted it to do, doesn't work exactly the way we expected it or “Can you update it?”

So the backend team will update it again and then it might be wrong again. And then it's just going to go on and on and on, and we'd spend three sprints on it instead of having done it in one meeting where we would sit at the table, decide how the API should be, what the model should be, how it should work and get it done, agree on it and then implement it. So the productivity with API first design is just much better.

KM: With APIs as the building blocks of an application, adding services and technologies to applications is now possible without having to re-architect the whole system. This method improves productivity and allows more flexibility as developers can work with different APIs, all at the same time.

So how can developers use the API-first design approach with TORO Cloud’s products? So we now have our ecosystem. I think we're about to launch a new one very, very soon. So David, how can developers take advantage of this API-first design approach with our products?

DB: Yeah, well in fact TORO Cloud’s products are entirely API centric. Everything we do revolves around APIs. And so from day one, everything we've built revolves around services exposed as APIs and consuming APIs and publishing APIs. So, APIs are, obviously as a company, very important to us. And so the concept of designing APIs first as part of that design methodology or application design methodology, was obvious to us the benefits associated with it. So we incorporated API-first design abilities within our product suite, specifically Martini enables you to design an API, iterate through that design, create those services, contracts, supply security, mock responses so that stakeholders can play with the API and make sure that it's operating the way they expect. And you can do all of that without writing a single line of code.

So it's a very visual environment. It's a very, I guess business user-friendly development environment. We still expect a developer to be doing this kind of stuff, but it's the kind of thing you can iterate through visually and quickly, which is the idea in this kind of process when you're dealing with stakeholders to be able to iterate over the design quickly. You don't want to be building, for example, you don't need building services for example, to provide responses so that you know, that mobile developer, which is consuming the API can get a sample data set back from it.

You don't want to be building services to feed that data set. So to be, have a simple way to be able to give them those contact records or some dummy data, something that they can play with. It's important to be able to do that quickly, easily, and without writing any code. So, we've got some nice tool sets to create APIs visually with no code and a playground for developers to both create it and for consumers to consume the API. So everything you need for API-first design is available within Martini.

KM: All right. Thank you very much to my guests for today. David Brown, thank you very much as always. Vivien, we hope to see you again soon.

On the next episode of cocktails, we'll talk about the effects of the COVID-19 pandemic to businesses, remote working, how companies can transition to the new normal and digital transformation. Again, please check out our blog on our website at www.torocloud.com and make sure to subscribe or follow us on whatever podcast platform you're listening to. This has been Kevin Montalbo for Coding over Cocktails.

Latest Content: