S06E02 1h 16mSeason 6

Episode Summary
Irina Dominte, who has taught .NET to individuals transitioning careers or domains, emphasizes the importance of focusing on the basics and avoiding overwhelming beginners with too much information. Drawing an analogy to language learning, Irina highlights the need for a gradual approach that doesn’t discourage learners. Building a solid foundation is crucial, just like a house requiring strong foundations to stand tall.
One major challenge faced by junior developers is the fear of making mistakes or incurring high costs when experimenting with cloud providers. To address this, both Irina and Jamie propose the concept of a “playground” or safe learning environment where developers can freely explore different cloud services without any consequences. This approach would create a space for hands-on experience, thereby boosting confidence and encouraging learning.
The conversation shifts towards the evolution of technology, specifically the transition from .NET Framework to Modern .NET. We stress the importance of staying updated with modern technologies rather than focusing on outdated ones. We also aim to change the perception that .NET is solely for Windows by highlighting the cross-platform capabilities of Modern .NET.
Irina recently published a book on web development and API design, in which she covers essential topics ranging from setting up the development environment to advanced concepts such as model binding, API versioning, and testing. The book takes a simplified approach to make the content accessible and avoid overwhelming readers. It focuses on HTTP as the protocol for APIs, as many developers fail to leverage its full potential.
We stress the significance of guiding beginners towards a specific solution rather than overwhelming them with numerous options. They liken this approach to using Google Maps, where users prefer a clear route to their destination rather than being presented with multiple routes to choose from. Thus, the book focuses on presenting the author’s preferred methods and approaches, providing readers with a clear understanding and contextual knowledge of the concepts.
Episode Transcription
Welcome to The Modern .NET Show! Formerly known as The .NET Core Podcast, we are the go-to podcast for all .NET developers worldwide and I am your host Jamie “GaProgMan” Taylor.
In this episode, I spoke with Irina Dominte about web development and API design. Irina offers valuable insights for beginners, the conversation covers topics such as building a strong foundation, learning cloud technologies, adopting modern technologies, API design and development, the importance of testing, and choosing the right approach. With practical tips and a simplified approach, this episode provides a wealth of knowledge for those looking to excel in web development and API design.
Yeah, so I never done a fully Rest API in production. To be fair to me and to the book, a real Rest API is the API that actually respects the REST constraint - the four of them, not the six of them. So it has the first constraint as being the client server architecture. There is two entities involved, the client and the server that need to talk to each other. And then we have statelessness like we’re using HTTP we shouldn’t keep state as we used to do with older versions of .NET. So everything should be self contained in that specific request or response. Why not? Okay, so then we have the cache. Your resources should be able to be cached like the server marks the response as being cachable, the client understands and looks at the header and so on. So state machine-wise using the right verbs, right?
Plus, we discuss the recent release of Irina Dominte’s comprehensive book on the subject - Web Development for Absolute Beginners - and why it’s an essential purchase for anyone wanting to learn how to create web-based APIs with Modern .NET.
So let’s sit back, open up a terminal, type in dotnet new podcast and we’ll dive into the core of Modern .NET.
Jamie
But yeah. Thank you very much and welcome to the show.
Irina
Jamie
Irina
Jamie
I know the pain of getting a blog article finished and ready to release is real. It’s very much like software in that it’s never finished. My own experience is 2015 through to 2018: I used to write about .NET things, and then .NET core started to be a thing. So I pivoted started writing about that. And the main reason why this podcast started was because in the early months of 2018, I was like, staying up until three and four o’clock in the morning going, “should that be a comma or should it be a full stop? I don’t know.” And so I didn’t want to do that again. That’s what I’m saying.
Irina
Jamie
Irina
Jamie
Irina
Jamie
But before “the event when everyone was sent to their bedroom,” I found that there was a lot of, like, “oh, you must create loads of content, and it has to be out there because otherwise no one will know who you are.” And there was this big drive for “just create the stuff, create the stuff, create the stuff. I don’t care if you’re staying up till 03:00 in the morning, create it.” And it’s not for me.
Irina
Jamie
Irina
Jamie
But speaking of which, you’re saying that you have trouble with getting things published. I mean, you’ve just written a book, so you can’t have that much trouble.
Irina
So twice a year, five months, I’m doing these classes. And I said, “why wouldn’t I do something that is useful for these people or to people that are trying to, I don’t know, switch domains? They’re working in It, but they did mostly desktop apps. I don’t know mobile whatsoever, and they’re trying to learn Web.” So then is when I decided that, “okay, I’m going to write a book on this,” and I proposed it to my editor and they agreed that it’s a good idea.
So I’m looking forward to see if indeed it’s a good idea and if people are actually I’m looking forward for the feedback on that.
Jamie
Irina
But yes, I finished it because I don’t like to leave things unfinished. But it wasn’t an easy task since I underestimated everything.
Jamie
I have been told that it’s not something you do with I can’t even think of the word with a lack of respect for the amount of work that goes into it. Right.
Because unlike in software, there is an actual deadline, right. We can always sort of grumble about “oh well, maybe we need another few weeks to fix this and there’s a little bit of tech out there.” But when it goes to print and it will be printed onto dead trees, there is no software patch you can fire out there and release. So yeah, it’s a monumental task of getting stuff done.
Irina
Jamie
Irina
Jamie
So what is the book then? And what does it cover? Because we’ve talked a little bit about it and we’ve talked about how you do teaching in your own time and help people get started with .NET, is it .NET? Let’s start there.
Irina
So I’ve taken an approach that I’ve used previously with my students. I’m trying to keep it just bare minimum, not overwhelmed the reader in this case. And I tried and I hoped I actually managed to do that in the book. I tried to keep everything as simple as I could with simple examples easy to understand because switching careers or switching into web from other sides of the IT world, it’s not an easy task to do. And to be honest, whenever I’ve seen, I don’t know, 1000 pages books, IT books. It’s daunting to see them. I mean, it’s like a chunk of paper. Like, okay, go ahead and read that. Well, I might start, but I might not finish. So that’s what I’ve tried to avoid, basically - heavily written, I don’t know everything.
Jamie
Irina
And then slowly I’m speaking about what are the Web APIs building blocks. Then we’re moving into working with an ORM what it is, stuff like that. Then slowly organizing our code. We’re talking about routing middlewares. And then we’re slowly progressing to, let’s call them advanced concepts. But those concepts are not advanced. I don’t know. With 15 years experience in IT, those might not be advanced, but in the book there are advanced for people that are just trying to learn a thing. We’re talking about model binding API versioning, documenting your API and testing the API, which is a thing that I’ve seen it very often as being “not important” in the projects I’ve been through.
Jamie
I fully appreciate - sorry to interrupt you there. I fully appreciate the idea of “let’s not write a book that’s a million pages long and that is a foot thick,” right? Because it’s very daunting as a beginner of anything to be presented with this textbook and say, “read this from cover to cover and you’ll get it right.” We each have a whole bunch of experience with programming and programming languages and all sorts of stuff. So we were able to apply the knowledge from one framework and one language to another pretty easily.
But I remember at university I took Japanese language and the very first day, the teacher plonked down this massive textbook and said, “right by the end of the second year, we’ll have covered all of that.” And I’m like, “this is scary. This is a thing that I could hold open a door with this book. It could be a doorstop.” It’s not good to receive a huge amount of information all at once and say, “just work your way through it.” So what I’m trying to say is I really appreciate that you’re thinking about the reader, thinking about the amount of time and effort that someone can realistically put into this and saying, right, “how do I produce something that is the right amount of information, but in a format, I guess, that is accessible and easy to make their way through?”
So I just wanted to say that, right? Because that’s something that I feel like a lot of tech writers forget about. They’re like, “I’m going to brain dump all my stuff. It’s going to be 5000 pages and you’re going to love it.” And then people pick it up and read the first ten pages, then put it back down and never read it again.
Irina
So one thing I learned from my students is the amount of information that you give them so they feel overwhelmed whenever they’re finding, I don’t know. Some of them told me, “hey, I started uni. I didn’t want to continue with uni, but then I started to learn on my own and I started to find resources on the Internet. And I clicked around and clicked around and it seems like I would never stop. So I don’t know which information I have to keep and which information is like, I don’t have to know that and so on.”
One thing that I learned from my students is that you do not have to know everything. So if you’re focusing on learning Web API, in this case, you might as well just focus on that. Any other thing around that can be like a building block to use afterwards. So I don’t know. I do not need to know maybe about Blazor if I’m learning Web API right now, when I know about Web API, yes. Then I can choose another path and learn about Blazor or [.NET] MAUI or any other thing that is connected to it. But until then, let’s just keep it simple; focus on the minimum things that we really need to know.
And at the end of the course, my students have one goal: either to get a job in IT, either to manage very well into the IT world, like get a job, or switch jobs and stuff like that.
So some of them have told me, “hey, it has been very easy for me to learn all the things that you gave me when you taught me, because I know for sure, I don’t have to worry that you need to know about that. And that might be a good candidate for me to know because you know exactly what people will ask at interviews.”
So for C#, right? So you need to know the language, the basics. Okay. Any other syntactic sugar on top of it can be learned after, you know, the basics of C#. Basic instructions like, I don’t know, operator
if else, loops, stuff like that. If you want to know, I don’t know, pattern matching stuff. records. Yeah, you first need to know some object oriented programming, right? And then, I don’t know, sprinkle some sugar on top of it. But the basics needs to be there. And that’s what I tried to do in my book, just the basics.Jamie
And so you’re right, if I want to learn patent matching, I’ll need to learn some other stuff first because I need the background context to learn the other stuff, right? It’s like learning any language, right? Because effectively you’re learning the language that the computer speaks, right. Once you’ve learned the grammar, aka the syntax,
if else if switch that kind of thing. Once you’ve learned that, you can literally do anything. It’s just a matter of learning the vocabulary. And I feel like pattern matching is kind of like a vocabulary more than syntax. But what do I know? I think I’m stretching a metaphor a little bit too far here.Irina
this? So there is like, “my way is the best way and your way is the wrong way.” So I chose in this book to use my way and to not care about what different side of IT are saying, just because I realize there is method in my madness.So I’m trying to use this across the book and I keep using this pattern, for example, just because it gives the reader a context awareness that the underscore notation doesn’t: if you use this, so it’s a state that’s inside the class and that’s why I keep using it. So during the writing of this book, I kept having polls on Twitter, “hey, what do you prefer? This or that and this or that?” So I did a market study, but I chose my way in the end just because it helps people learn step by step. So if you’re using this, it’s very easy afterwards to use the underscore and so on.
Same with are you splitting your project into libraries or are you using just single project and you’re having folders? Well, what if we start from the basics, have plus libraries, each one of them on its own boundaries and stuff like that, and then knock yourself out, right? Have one project, folder and so on.
Jamie
I’ve recommended in the past a number of tutorials for people who want to get started in development. And then they’ve come back and said, “but it’s too complex,” because these tutorials that I’ve recommended have said “they’ve gone down a path and said, okay, let’s learn this. But now let’s take a step back and say, but actually, you could do it this way. And then take another step back and say, but actually you could do it this way. And then another step back and say but you could do it this way,” then another one and you could do it this way." And I’m like, it’s great to know that there are other ways to get there, but the important thing when you’re learning something is to get there, right?
If I pull up Google Maps, I don’t want it to tell me there are 450 different routes to the place I want to go to. I want it to help me to pick a route and help me get there. Because I feel like it’s very complex, our industry. And it can be complex to sort of learn it, especially if there are twelve different ways to achieve the same solution. And for some reason, the person teaching wants to teach you all twelve ways. Well, if you’re right at the beginning, you don’t have the knowledge and the experience to figure out, “well, why are there twelve ways and which one is the best?” Right? Because there isn’t a best.
Irina
So I recently got a question from a young developer, like junior developer, two years experience, and he asked me, “hey, could you host API, like a full API itself in Azure? Is it hard to do that?” And at first I was baffled. How could he ask me that? But then I realized that poor guy had worked only with Azure functions and he had no overview about how things work. So, like, the bare things, like have an API deployed somewhere, and then Azure function being a smaller API that, well, has different things. I don’t know, like consumption plan when it runs, stuff like that. So the bare thing, the minimum thing was, okay, you have an API, you developed it. How do you expose it to the outside world? So Azure or a virtual machine or whatsoever.
I was lucky enough to be able to, I don’t know, grow a bit with the industry in the last 15 years. And I hosted in Windows machines and I got into RDP on those and stuff like that. But the young people didn’t have that. So they might have an incomplete picture about how things work in a system, in a distributed one. It’s hard for them to understand, especially when the are given just small pieces of work. Like, you do this, you need to implement this to do that. Okay, cool. But the complete picture, they won’t ever have it because there will be no one to tell them, “hey, look how you do this, how you implement that, and how in the end, your code will be up and running in Azure or whatever, AWS.” that’s what I tried to follow in the book, step by step. This is how you do it. If you sprinkles on your code, yes, you’ll be able to do that.
Jamie
And I think that, like you said, I think that we are lucky in that we’ve been around for long enough that we’ve seen things evolve to the point where we know where things need to split off. And because of that, we’ve been to conferences, we’ve watched the training videos, we have the background knowledge that you’re trying to impart that will infer within the person: this needs to be an Azure function, this needs to be a web API, this needs to be X thing, all that kind of stuff. But that’s because we also have the experience of going, “well, let’s go to Azure, let’s go to GCP, let’s go to Linode or whatever and click around and let’s see what I can make.” Whereas I feel like perhaps, maybe and I might be casting aspersions here and making things up, but I feel like maybe when you’re at the beginning of the career and you’re still learning it and there’s so much to learn, there might be this fear of, “if I start clicking around in the cloud provider that we’re using, I could run up a huge bill and get into loads of trouble. Or I could get into a position where I break things.”
And I feel like that’s a little unfair to put that situation on our juniors and the people that we work with. And I feel like perhaps it’s a different discussion for a different time, but I feel like perhaps there should be, like, almost like a playground. Wrong word, but like a place that developers who are at the beginning of their career or who want to learn a new thing can actually log into it and just click around and just I want to push loads of buttons and there’s going to be zero consequences.
Irina
Jamie
Maybe I have a different learning style to the people that you are teaching. I don’t know. But I do know that with some of the cloud providers they do offer training systems. This is more to do with like Linode and things like that, where you can literally sign up. Linode isn’t one of them. I’ve said them about 15 times now. I do apologize, but you can sign up to it and they give you like a virtual machine to connect to and they say, “right, follow these instructions and learn the thing. And now that you’ve learnt it, let’s just play around and see if we can break the virtual machine. Don’t worry, we can’t break the virtual machine, but if you click over here, this will happen. If you click over there that will happen.” Which I think is really quite useful and I think perhaps that’s missing from the training stuff that is created for juniors.
Irina
Jamie
Irina
Jamie
Yeah, you’re right. I think there’s a difficult decision for people who are way smarter than me. And that needs to be a decision of, “how do we help these folks to do this?” Because things have gotten so easy. I remember the first time that I published anything to Azure, it was a case of, right, I need to do all these hundreds of steps and get permission from this person and drag this thing in and do that. And actually now inside of Visual Studio - I don’t use Visual Studio these days, but if I’m using Visual Studio, I can right click and push a button and then 30 seconds later, a minute later, my app is there, which is great for that first initial getting started. It’s not great for the whole DevOpsy pipeline stuff, but that’s stuff that you can learn later, being able to right click and get it running in front of you and be able to send a link to someone and say, “hey, check it out, I made this thing.” That’s the best feeling. Right?
Irina
Jamie
And you know what? Whilst it’s not brilliant compared to how we do things in more modern paradigms, if it still works, then and if you’re still happy to take the risk of what if someone deletes the wrong file and is unrecoverable, then that’s totally fine. You do you, it’s just not for me. Excellent.
Okay, so you want to get people started with Web API in .NET. So I guess the important question is, are we talking .NET Framework? Are we talking .NET core? Are we talking .NET 6, 7, 8+ - the thing where I’m calling Modern .NET, where does it sit?
Irina
Jamie
Irina
Jamie
Irina
Jamie
The thing is, I feel like much like with what you were saying about syntactic sugar, you can learn the other things once you’ve got the basics right. C#, it has evolved quite a lot since the .NET framework days. And .NET Framework, as far as I’m aware, I mean, I am an MVP, but I’m not on the inside track. As far as I’m aware. .NET framework isn’t going anywhere, right? It is still here to stay. It’s not being killed off, it’s not being jettisoned, it’s not being anything like that.
I actually side note, I actually talked to Scott Hunter at MVP Summit this year and apologized to him because there was an episode of this show that went out where someone took a quote out of context and said, “the sky is falling, .NET framework’s going away!” And it’s like, no it isn’t. And yeah, he got a lot of flak for that. So I actually went up to him and went, “look, Scott, I’m really sorry. This is what happened. It was four years ago, but I’m still upset about it and I want to apologize to you.” He was like, “dude, it’s fine. So that’s pretty cool.”
But yeah. So the point I’m getting at is that you can totally, in my opinion, learn modern .NET and then if a project comes up where you work, where you have to do some .NET framework stuff, it’s a case of cool. I know the modern .NET stuff. How do I learn the retro .NET stuff?
Irina
Jamie
Irina
Jamie
So I fully appreciate that there’s lots of people who don’t know that .NET is cross platform and that’s totally fine. But that means that I can then go to them and say, “cool, come over here and check this awesome thing out!”
Irina
Jamie
Because I remember one of the first builds of .NET core that I was playing around with. I was doing something on a Windows machine and I was like, “cool, I don’t get the point. It runs on my Windows machine.” And the I copied the files onto a USB, moved over to my MacBook Air. It was a 2011 MacBook Air, so it was an intel chip and all that kind of stuff. Plugged the USB in and I was like, try and install it and see what happens. And I was like, “holy moly, it runs like this is .NET on a Mac. And I’m not doing anything with mono. This is just weird.”
So yeah, I totally appreciate that. That’s because I was excited about doing that. Some people don’t have the chance to do that outside.
Irina
Jamie
A Request To You All
If you’re enjoying this show, would you mind sharing it with a colleague? Check your podcatcher for a link to show notes, which has an embedded player within it and a transcription and all that stuff, and share that link with them. I’d really appreciate it if you could indeed share the show.
But if you’d like other ways to support it, you could:
- Leave a rating or review on your podcatcher of choice
- Head over to dotnetcore.show/review for ways to do that
- Consider buying the show a coffee
- The BuyMeACoffee link is available on each episode’s show notes page
- This is a one-off financial support option
- Become a patron
- This is a monthly subscription-based financial support option
- And a link to that is included on each episode’s show notes page as well
I would love it if you would share the show with a friend or colleague or leave a rating or review. The other options are completely up to you, and are not required at all to continue enjoying the show.
Anyway, let’s get back to it.
Jamie
And that’s where we are now. And it makes perfect sense, right? Azure has a whole bunch of Linux servers. Why can’t we run our .NET apps on them? Boom, now we can.
Irina
Jamie
Okay, so if we come back to the book for a moment then; you said earlier on that eventually in the second half of the book, I believe it was, you get onto ORMs. So does that mean that you’re going to cover databases as well? Or is it just a case of, “hey, put this code here and magic and then database”
Irina
But I’m not talking about our foreign keys and concepts whatsoever, but I’m showing that, “hey, since you’re having an API that you’re exposing, you might as well have a storage to store data somewhere.” And I’m using SQL Server because it’s easy to do. And once you have Visual Studio installed, you have everything you need in there. The default instance is there. You will be able to access it and you don’t have to install too many things and to configure.
Jamie
And the I guess it then becomes an exercise for the reader. “Hey, you finished the book, you’ve learned some stuff. Let’s move your app to a Linux machine or a macOS machine and we’ll talk a little,” this can be an exercise for someone once they finished the book, they can be like, well, how do I move it? Well, guess what? If you learn a little bit, just a little bit about Docker, you can then put a SQL Server container inside of inside of Docker and then run your app on. Or, you know, if you want to change a few lines, if you want to take the time to learn which lines to change outside of the book, you can change it. So you’re running against a SQLite database or a MariaDB or some database on the cloud or whatever.
So I guess you’re right there. It sets people up with the here is the base level of knowledge that you’ve got to pick one technology. You’ve got to pick one out of all of them. So we pick the one that has the most support the most documentation, and then if things go wrong, you can go to look that up, and then it’s, “hey, you could do it this way, or you can do it that way. If you want to go over there after you’ve finished, you want to go learn how to do MariaDB well, guess what? There’s a whole page of the stuff that you will now understand because you now understand all the content in the book.”
Yeah. I like it.
Irina
Jamie
Irina
Jamie
Irina
So, to be fair, in my projects, where I work as an architect, unit testing, integration testing, it’s a must. There are pillars of good quality code, so you cannot do without them.
Jamie
My own personal yardstick is I always, at the very least, sometimes when I’m working on Greenfield stuff, I’m like, “let’s write tests for everything as much as I can.” Maybe not test driven development, but at least tests for stuff. And if I’m walking in on a pre-existing project, a brownfield project, I’m like, “right, okay, give me a bug, and I want to write a test which proves that the bug exists, because then I’ve got a regression test,” right. Or maybe prove that I fixed the bug, whichever way around. Right. And I think those are in a brownfield project. My own personal opinion, those regression tests are way more important than proving that the system works the way that you think it works.
Irina
Jamie
Irina
Jamie
I’ve heard this. I don’t want to say fight, but it is that juniors and apprentice.
Irina
Jamie
Irina
Jamie
Irina
Jamie
Okay, so we’ve got an API, we’ve got the database we’re talking to it with entity framework, with an ORM. So you’re explaining what that is. We’ve got some testing in place. Are we HTTP or are we gRPC or are we some other acronym that’s just been made up.
Irina
I like to do this exercise in my talks at conferences. Sometimes when I get the context, the right context, I ask, “hey, whoever developed the Rest API?” And everybody raises their hands. And afterwards I talk a bit and explain some things and then, “okay, now really, honestly, who here develops Rest APIs?” And nobody raises their hand. So to implement a Rest API as Rest supposed to be, is very hard. And sometimes I’ll be fair, it doesn’t add too much value. So the focus is for the reader to learn about HTTP protocol and to build on that, to understand the verbs, to understand status codes, and to use them.
Jamie
Irina
Jamie
All that stuff.
Irina
Jamie
This is my worry with things like coding boot camps because they seem very specific to a very specific niche of a problem. “You’re going to learn React and you’re going to do everything with Node and you’re going to use this particular library. That particular library, these versions of these libraries.” I’m not saying React, Node or JavaScript are bad at all. That’s not what I’m saying. I’m saying that you could say the same thing with .NET. Right. “You’re going to learn .NET 7 and you’re going to use these particular libraries and that’s it. Once you’ve done that, you’re in the industry, you never need to learn anything ever again.” And the something goes wrong or a version is updated, a package is updated to a new version and the API changes or something like that.
And I feel like teaching folks things that are immediately applicable, but then they can actually sit there and “wait, hang on. But it’s doing the same thing as my browser is doing, except the browser is doing get requests for a lot of stuff. Wow. I can see how this fits automatically.” And I feel like with software development, it’s something that doesn’t really fit with other types of learning. Like if I go and learn mechanical engineering, I can immediately apply what I’m learning to how my car works, right. I start understanding that the pistons in the engine move up and down and compress a bunch of air and fuel. And then that’s ignited, which pushes the piston up, which is then transformed into circular motion for the wheels, right. I can see it. If I take the bonnet or the hood off of my car, I can literally see it happening in front of me.
But with software, not so much. It’s all arrangements of little opaque boxes.
Irina
It’s always evolving. So we need to keep up. We need to always update ourselves in terms of know how. Even though some of the concepts might be reusable and they are reusable. I mean, let’s look at gRPC. Well, in a way gRPC is replacing WCF; it’s kind of SOAP but prettier. So there is a debate and discussion that we could start around it, but some concepts tend to resurface from time to time. So once you know a thing, you’ll be able to at least, I don’t know, adapt your previous knowledge to the current things.
Jamie
And I think that’s the important thing to impress upon people who are learning new stuff. And that is: you’re going on a journey. You’re starting to learn this one thing in this one specific context. But like you said, you can apply that to other things. You can learn C# and .NET and then you can say, “hey, I want to go learn Python.” Well, guess what? Both languages are a C-family. They’re both from the C family of languages. So if you know one, you can apply some of your knowledge to the other, and all you need to do is learn - so you’ve been taught the .NET way to program. .NET. Then when you go over to Python, all you need to do is switch your brain over to, “how do I learn the Python way to write Python?” Not the syntax, not the commands, not the vocabulary, none of that. It’s, “how do Python people write Python code?” Which testing libraries do they use? Which ides do they use? They may even use a different keyboard. I don’t know. I’m not a python vev.
So all those different kinds of things, you learn those and you’re still applying that same programming knowledge from one language into another. It’s brilliant.
Irina
Jamie
I always tell people that it’s never a waste of time learning something. You can always apply it somewhere, right. And that’s why I do a lot of reading outside of development. I don’t actually read that many development books every year, maybe one or two. But most of my reading happens outside of it. So like leadership books, business books, self help books, language learning books, because we’re learning languages, right?
Irina
Jamie
So we talked about how you’re using HTTP, and we talked about ReST stuff, and you said how in your talks you always get people to put their hands up. Yeah, I’ve done a ReSTful API. But then you talk a little bit more and you say right now that you know what a Restful API actually is. Who’s done a real ReSTful API. So let’s talk a little bit about that.
Irina
So it has the first constraint as being the client server architecture. There is two entities involved, the client and the server that need to talk to each other. And then we have statelessness like we’re using HTTP we shouldn’t keep state as we used to do with older versions of .NET. So everything should be self contained in that specific request or response. Why not? Okay, so then we have the cache: your resources should be able to be cached like the server marks the response as being cachable, the client understands and looks at the header and so on. So state machine-wise using the right verbs, right? There is also a thing. So the uniform interface for me is the fourth constraint that should be in a Restful API. So we should be able to identify resources and should be able to manipulate them, right, using the right resources. So four of them, I mentioned the last two of them, but I’m not emphasizing the in the book.
An API, an endpoint of the API, should be clean enough, should be easy to understand, right? If you look at an endpoint, you should be able to use the right verbs if you have cats, right? So you will have cats and you’ll look at the endpoint, you’ll automatically understand, okay, this is the endpoint that deals with cats being the many of them. So what you’ll be able to do is to query the endpoint. You should be able to use .NET to get all the cats, you should be able to filter them using query strings, so on. You should be able also to create a new resource, right, to add a new cat. And then if you look at the individual endpoint, you’ll have the cat’s by ID, right? So cat the ID placeholder and then you should be able to use three verbs to do operation on the specific endpoint.
These are conventions, but these are conventions that are there to help us create endpoints that are easy to understand, people won’t need, I don’t know, extensive documentation to call our endpoints, right? So I’m keeping this to a minimum, I explain a lot, I have schemas in the book and so on, but I think at that level, these are the things to be concerned about, right? You have HTTP, use everything, use headers to identify things that are different, use header to cache, use header to maybe transport and send information that are not, I don’t know, it doesn’t belong in query string or in the body of the request, stuff like that. Use the right verbs because those are there to stay and use the right status codes. That’s why we have like 64 of them, right? Just to be able to look at those, to see, “hey, it’s 404, what does that mean?” Well, it starts with a four, that means that is your fault as a client and specifically it’s not found because that’s what 404 means. Or it’s “a 201. What does that mean?” It starts with two, it’s a success one, but it means created and it should be returned as a result of an operation that adds a new resource, right? Created. Hey.
So that’s how I pretty much explain Rest as a concept. And I think this is how it’s just my personal opinion, but this is how Rest should be looked at just as guidelines around creating APIs that are mindful to other developers and to API consumers, basically. Because I personally lived the time when I had to read Soap documentation to understand what should I send in there to get a response, a valid response back. But those times have passed, and we should just be able to create easily create endpoints that are meaningful. Right?
Jamie
/cats/get and send a get request, and I’m like, that’s not Restful. Oh, yes, there was a /cats/create. I’m like that’s not restful. And then there was a /cats/delete. That’s not restful. And then there was a /cats/get/cached. And I’m like, Are you even trying now?Irina
Jamie
Irina
Yeah, I think it is possible. But one thing is lacking around libraries. I found it very difficult to implement the HATEOAS part. Basically, the server should be able to drive the client, right? And with each response, it should be able to say, “h"ey, you’re here. These are your next steps. You can go to this specific URL or to this specific URL. You choose, but these are the only two options.” Yeah. So the client should be like, let’s call it “dummy” but it should be able to look at those links sent with the response to be able to navigate the server. I found it lacking in terms of libraries that help you do that because, well, the community didn’t invest in it because it haven’t seen the value of it, I think.
Jamie
Irina
Jamie
Irina
Jamie
Irina
Jamie
Irina
Jamie
Irina
Jamie
Irina
Jamie
Irina
Jokes aside, before the pandemic, I had to talk about Rest APIs. And when I started doing that, I was, okay, who’s going to listen to me? Who’s going to care about Rest? And I was surprised how many people didn’t know things about Rest and they were interested to know and to learn about Rest because Rest as a concept is it was misunderstood and not so well implemented.
Jamie
I feel like there’s this leap towards, don’t worry about it, we’ll create an endpoint and then we’ll figure it out later. And actually, no, you’re saying that the contract for your app doesn’t matter, when actually it’s the contract that’s the most important thing. How something else speaks to you is the most important thing. How you deal with it doesn’t matter. Because one of the things that I do when I’m building brand new apps, if I’m just returning data, I just return an in memory list because I’m like, it’s not going to change until I get to the point where it needs to change, until I’ve figured out what that contract should look like. Without knowing what that contract looks like, it doesn’t matter how I get the data. I can fix that later. Let me work on the contract first. Get that contract working, because then when that API then looks the way that I want other people to see it - that was a really bad sentence, but hopefully you get what I mean. When it looks the way that it needs to look for other people to use it, that’s when I can actually go, “right, okay, the contract is sorted. I will go and work on making the other side of it, my bit of it work out.” But the problem with that is that that then requires you to step away from the fun bit, which is making your code work.
Oh, gosh. So, Irina, and just remind us all about the book because we’ve said all of this and we haven’t even talked about what the title is. So remind us about the book and how people can get it, and then tell us a little bit how people can get in touch with you.
Irina
Jamie
Irina
Jamie
Like I said at the beginning, my hat, we say in British English - I don’t know if it translates, but “my hat is off to you.” All respect to you, because I can’t do that. But, yeah. There you go. Awesome.
Irina
Jamie
Because there’s some stuff that I’ve learned specifically around being fully ReST or ReSTful. Like I said, that’s probably a talk title, right? So get that written down quick before someone else steals it. Coming soon to a conference near you. But there’s things about being ReSTful and being fully ReST that I didn’t really contemplate. And so I’m going to actually go away and fix a bunch of my APIs, make them a little bit better, add some extra headers and stuff like that.
So, yeah. Thank you ever so much for sitting with us this afternoon and talking with us about being brand new, the readers of the book being brand new to web API, because you see, I’ll let you speak in a moment, but I’ve just had this brainwave. It is so important, no matter where we are in our learning journey, to take a step back and look at the things that are aimed at people who are maybe a few steps behind us, a few steps lower than us in our journey. Because there will be gaps in your knowledge, as I’ve just proven right, the stuff about ReST I didn’t know. So there will be gaps in your knowledge. You can totally go read something that is aimed at someone who has slightly less experience, slight less knowledge than you, to fill in those gaps, because why not?
Irina
Jamie
Thank you very much.
Wrapping Up
Thank you for listening to this episode of The Modern .NET Show with me, Jamie Taylor. I’d like to thank this episode’s guest, Irina Dominte, for graciously sharing her time, expertise, and knowledge. Make sure to check the full show notes for a collection of links and lots of background information that Niels graciously provided to all of you, as a place to start your journey in learning about performance-based programming.
Be sure to check out the show notes for a bunch of links to some of the stuff that we covered, and full transcription of the interview. The show notes, as always, can be found at the podcast's website, and there will be a link directly to them in your podcatcher.
And don’t forget to spread the word, leave a rating or review on your podcatcher of choice - head over to dotnetcore.show/review for ways to do that - reach out via our contact page, or join our discord server at dotnetcore.show/discord - all of which are linked in the show notes.
But above all, I hope you have a fantastic ReST of your day, and I hope that I’ll see you again, next time for more .NET goodness.
I will see you again real soon. See you later folks.
Useful Links
- Irina on the web;
- Irina’s book “Web API Development for the Absolute Beginner: A Step-by-step Approach to Learning the Fundamentals of Web API Development with .NET 7”
- The Expert
- Maslow's hierarchy of needs
- Try.NET
- the Socratic method
- http cats
- HATEOAS
- Supporting the show:
- Getting in touch:
- Music created by Mono Memory Music, licensed to RJJ Software for use in The Modern .NET Show