You are viewing content from a past/completed QCon

Presentation: Developing Great Web APIs Architectures w/ ASP.NET Core 2.1

Track: Enterprise Languages

Location: Bayview AB

Duration: 1:40pm - 2:30pm

Day of week: Wednesday

Level: Intermediate

Persona: Architect, Backend Developer, Developer, .NET

Share this on:

This presentation is now available to view on InfoQ.com

Watch video with transcript

What You’ll Learn

  1. Learn about developing and integrating web APIs with ASP.NET Core.

  2. Find out how to avoid some of the possible mistakes that can be done when developing a web API.

  3. Understand best practices and approaches to testing, mocking, decoupling services.

Abstract

You know you have to have a great experience when you develop your apps, right? The greatest experience for your user's centers around their data. That's why developing a great set of Web APIs is so important. Using ASP.NET Core Web API is a modern cross-platform framework for the modern web. ASP.NET Core Web API can be run on Windows and Linux using all the modern web servers. The secret to it all is knowing how to architect your Web APIs for the best experience.
Using the architecture in this talk allows your APIs specifically to work better due to:
  • Allowing a clear decoupling of the API endpoints, Data Access (Synthetic or Production) and finally the Data Domain classes.
  • The API Endpoints (Controllers) have no knowledge or responsibility of Data Domain and behind it Data Access
  • Because of the decoupling and separation of responsibilities testing can be done easily and without issues.
  • Data Access segments of the architecture can easily be switched out without impacting the Domain or API Endpoints.
By using this architecture not only does the development story become easier but your end users get a much more stable API set to consume. The talk will explain and get you started on using these concepts with your ASP.NET Core 2.1 Web API solutions.
Question: 

What's the focus of the work that you do today?

Answer: 

Over the last five years, I've been busy getting solutions out to people. I work more on the backend doing API work, but that’s also meant I help mobile application and web application developers utilize the APIs I’m developing.

Question: 

What's the motivation for the talk?

Answer: 

The motivation came from my mistakes building APIs that I've done over the last four or five years using REST. I don't want other people to make these mistakes, because they cost time, money, energy, they add to frustration around projects. I try to teach people how to build these APIs well with good patterns that can be reproducible and you can do over and over again for all your API projects, especially around .NET Core.

A lot of these ideas can be used on any other platform but I'll give specific examples on using .NET Core and ASP.NET Core Web API.

Question: 

Can you give me an example of one of the anti-patterns that you might talk about?

Answer: 

A big one is coupling all of your different parts of your API so that you can't test well (both unit testing and integration testing). I try to architect my APIs down to a point where I can unit test very granular pieces to make sure that things work. And then also I can replace things. My big thing is I want to test and refactor quickly. I use dependency injection also to allow me to build out new areas of my architecture that I can swap in and out quite easily and without a lot of friction.

Question: 

What is the persona you want to address?

Answer: 

I'm gearing this towards tech leaders and architects (CTOs that are a little more hands-on and maybe even project managers might get something out of it). But really this talk hits on those technical people that need to think about architecture, build out, and then build that testing plan for the APIs. I'm really looking at the people that get their hands dirty. While everyone can get something out of it, I primarily look at senior tech leads and architects.

This is an advanced talk. You have to come in knowing something about web APIs and building those type of projects.

Question: 

.NET Core has been gaining a lot of traction over the last year or two. Why?

Answer: 

It's a total rewrite of .NET.

If I take a look at ASP.NET, we as developers have had a lot of legacy, a lot of baggage that we've had to pull around with ASP.NET. If you've ever done ASP.NET web development you know System.Web is huge, because it has everything going all the way back to ASP.NET 1.0. It has web forms and stuff that we wrote don't really need today. If you're not doing web forms why have a library around that supports it when you're not using it? There's many other things with ASP.NET. That’s the first thing. We're getting rid of a lot of old baggage that collected and deposited over the years.

The second is cross-platform, so .NET Core can be not only developed on Windows, Mac OS, and Linux, it can be run out on all 3 platforms. It can be run very well on containers, Docker and Kubernetes. That's another great advantage. I can write a .NET Core web API, throw it into a Linux container, and then throw it up on both Azure and AWS. As long as they can use it, I don't really care where it's being run.

The other thing is they've taken a look at what they should have done with .NET and ASP.NET, things like building dependency injection into the actual framework. Now we have dependency injection right out of the gate. It's built in, it's easy to use, you don't have to use third party tools, and do all the configuration / ceremony around those. You just get it and then you're flying, and you can inject things in where you want them. Those are the big areas that I see.

There's probably lots of other ones that other people like (for example, it also has the command line, so you can work with visual tools as well as a CLI now). But these are the things that come to mind for me.

Speaker: Chris Woodruff

Independent Consultant Specializing in .NET Core, REST APIs & Software Architecture

Chris Woodruff (or Woody as he is commonly known as) has a degree in Computer Science from Michigan State University’s College of Engineering. Woody has been developing and architecting software solutions for over 20 years and has worked in many different platforms and tools. He is a community leader, helping such events as GRDevNight, GRDevDay, West Michigan Day of .NET and Beer City Code. He was also instrumental in bringing the popular Give Camp event to Western Michigan where technology professionals lend their time and development expertise to assist local non-profits. As a speaker and podcaster, Woody has spoken and discussed a variety of topics, including database design and open source. He has been a Microsoft MVP in Visual C#, Data Platform, and SQL and was recognized in 2010 as one of the top 20 MVPs world-wide. Woody is an independent consultant specializing in .NET Core, REST APIs, and Software Architecture.

Find Chris Woodruff at

Tracks

Monday, 11 November

Tuesday, 12 November

Wednesday, 13 November