S05E14 1h 37mSeason 5

Sponsor Message
I have discovered a great .NET tool, Entity Services, that significantly saves development time, especially if your app collects data from various sources and shares it via web-api. It will create for you enterprise level, cloud ready source code based on a simple configuration.
What I like about this approach is that we can focus on writing code that really matters.
Learn more on their website at Entity.Services.
Episode Transcription
Hello everyone and welcome to THE .NET Core Podcast. An award-winning podcast where we reach into the core of the .NET technology stack and, with the help of the .NET community, present you with the information that you need in order to grok the many moving parts of one of the biggest cross-platform, multi-application frameworks on the planet.
I am your host, Jamie “GaProgMan” Taylor. In this episode, Mark J Price returns for the third time. We talked about his new books “C# 11 and .NET 7 - Modern Cross-Platform Development Fundamentals” and “Apps and Services with .NET 7”. For most people, writing one technical book in a year would be a monumental task, but Mark wanted to write two: one for people who want to grok the fundamentals of C# 11 .NET 7, and one for people who wanted to get their hands dirty and learn about the many different types of apps that you can write with .NET 7.
Along the way, Mark and I swapped into teacher mode and discussed a little about how .NET is becoming more accessible to students and new developers. We also chatted about ChatGPT (which was brand new at the time of recording) and how other machine-learning based content generators will likely change the worlds of art, prose, and development.
So let’s sit back, open up a terminal, type in dotnet new podcast and let the show begin.
Jamie
Mark
Jamie
We do need to preface this entire conversation with we are recording this on December 7th, I believe. Yeah, December 7th. I just have to double check because I can’t remember numbers, but that’s fine. Everybody has their own thing, but that’s fine. So, yeah, we’re recording this ahead of time on December 7th and we’re going to talk about some books that you’ve just released. And the reason that we’re saying we’ve recorded this ahead of time because obviously there’s a little bit of time cast Pod Machine wibbly Wobbliness before this comes out. So that’s why everyone, we’re just setting that expectation that we were in the past. So if things change, then we are sorry.
Mark
Jamie
Mark
Jamie
Mark
So my name is Mark, Mark Price, and I’ve been, I’m 50 years old this year, so I’ve been around for a while now and throughout most of my career I’ve been working in IT and particularly focused on Microsoft developer tools and technologies. In fact, I even 20 years ago, just over 20 years ago, I was working for Microsoft and living in Redmond near Seattle and on the, on the Microsoft campus. And that was a fantastic experience. And so I’ve actually been working with .NET before it was released to the public, working in the training and certification team within Microsoft, helping write official Microsoft curriculum training courses. So my team at the time was writing the first courses on things like ADO .NET, Windows Forms, Web Forms, all of that wonderful new .NET Framework type technology. And I’ve continued to work with all the different flavors of .NET for the past 20 plus years.
And more recently, starting in 2015, I was approached by Packt Publishing, who focuses on IT books, and they asked if I would be interested in writing a C#, learning C# book. And I was, I was teaching C#, I was getting people, developers prepared to pass the Microsoft exam at the time for C# and the various different .NET technologies. And so the opportunity to actually write my own book based on my experience of helping developers get educated about C# and .NET was a really exciting new challenge for me. So I jumped at that.
And over the past seven years, I’ve now written seven editions of that book. And so the most recent title is “C# Eleven and .NET 7. Modern Cross Platform Development Fundamentals.” And this is the first year that I actually wrote a second companion book to go with that because modern .NET, there’s just so much to learn, I couldn’t fit it all into one book and I therefore took the opportunity to kind of take a year off. I’ve actually quit my full time employed job so that I can write two books and I will be continuing to do that for at least another year. So yes, for those readers who need to wait for a long term support edition and therefore maybe skipping .NET 7 and waiting for .NET 8 next November, yes, I will be writing updated editions next November for C# 12 and .NET 8 and Apps and Services with. .NET Eight, but I should really encourage you to buy them now. The second companion book, the title of that is “Apps and Services with .NET 7”. That’s the second book the companion book. And it really literally does just continue on where the first book ends off. So if you wanted to kind of think about, well, what is going to get covered in those two different books? The first book is literally the language and the libraries. So the C# Eleven language, including all of its cool new features, .NET 7 and its libraries. Things like accessing the file system, working with data with EF Core version seven, but also the fundamentals of web development using ASP .NET Core version seven. So that book language, libraries, web development.
And then the second book, this companion book, Apps and Services. As the name suggests. It then goes into more detail on connecting to your data building data models, using SQL Server, but also cloud based data with Cosmos DB and then building services with all the different modern technologies from GraphQL to gRPC to SignalR and things like Nano functions, nano services with Azure functions, all those kind of service technologies and the pros and cons and where they should be best used. And then into building apps, graphical apps with Blazor and with the new .NET Maui.
So, as I say, massive amount to cover. That’s why it’s two books. And that gives my potential readers the choice if they’re already fairly up to speed, maybe they up to speed on .NET 6 already, rather than having to buy the new edition of the C#en .NET book. They don’t have to now, they could just get the Apps and Services book. And I’ve explicitly put in the first chapter, I cover what’s new in modern .NET and C#. So it’s not two books because I’m trying to make double the money. That’s not going to happen. I’ve made it as possible as given more choices. It’s choices for the customer.
Jamie
Mark
Jamie
Mark
Jamie
Mark
So this year, because I knew that I wanted to do two books back in the summer, that’s when I gave my notice. And I’ve literally had to spend four and a half months full time just to be able to deliver these two books because they’re, they’re both 750 pages of pure content, 820 ish pages when you include the preface and the index and appendices and things like that. Yeah, and that, and that’s a, that’s a massive amount. Even if it’s just - and I’m doing bunny quotes there - even if it’s “just” a new edition, it’s amazing how much you can actually end up rewriting something on every page. So it is a lot more effort than I think people realize. Not that I’m complaining. I love writing books. I love hearing from my readers and knowing that I am helping people educate themselves in a very cost effective way, rather than spending thousands of pounds on a couple of day training course. If you can spend the time yourself to sit down and read and go through the hands on exercises, getting that hands on practice experience, seeing the code run rather than just learning it in theory, I think is a really valuable way of learning a new technology or refreshing your skills.
And I’m always pleased to hear that even experienced developers pick up as much as a new person because you notice more and you can fill in more of the gaps and it’s lovely to interact. Well hear from my readers either through email or through maybe raising an issue on the GitHub repository. I’m very active there. But in the last year, one of the biggest changes that my publisher has implemented is setting up Discord servers and a channel for each of the major books. So I would encourage anyone who’s bought any recent Packt book join us on the Discord servers and you can chat with the author, you can interact, you can interact with other readers. And it’s been really positive experience getting that immediate feedback and feeling this community starting to be built. I’m new to discord myself in the last year because of this, but it’s been a really nice way of interacting with readers and hearing feedback and it’s just going to make my work better and better for everybody.
Jamie
But I agree with you about the, shall we say, more experienced readers reading any kind of technical book and picking things up in the last few years I’ve been reading a whole bunch of like I read your previous entry into the modern cross platform development fundamentals.
Mark
Jamie
Mark
Jamie
But there were wonderful lessons along the way about things like don’t do equality of strings. If you’re comparing an input string to a secret, don’t just do double equals and don’t do the equivalent of string that equals because they are time-based comparisons. And so if the first three characters are correct and the last ones aren’t, then immediately the equality stops and comes back. Therefore, a malicious person, a malicious actor, could fire a bunch of characters at it and effectively work their way through the string until they get to the correct answer, because they know that the previous request took four milliseconds, the next request took five. So there must be more correct characters in the correct order in the second request. So all I need to do is change the next character along. That one takes longer. So now that must be a more correct - you’re optimizing for the time of things there. But that’s a wonderful thing I wouldn’t have picked up on if I hadn’t have read that book.
So what I’m saying is, I challenge anyone to read any book, technical, fiction, non-fiction, whatever, and not learn something, because there was always one lesson to learn at the very least, in every single book. And one of those lessons might be, ““I didn’t like this book.” Hopefully no one’s learning that lesson with yours.
Mark
And that was actually one of the reasons why in my new Apps and Services book, I actually do cover so many different services, whether it’s OData or traditional REST type APIs or GraphQL, et cetera. Some developers might think, “oh well, I’m never going to use gRPC or I’m never going to use Azure functions,” but each chapter is doable in a few hours. So by having a look at all of the different service technologies and what they emphasize and the way that they do things like method signatures and what’s allowed and what’s encouraged and what’s kind of a part of the pattern. It really then helps you give a deeper understanding about the pros and cons of the ones, the technologies that you will use every day. And my hope is that I’ve managed to get the balance of giving the concept behind a technology: the basic, the key pros and cons of each technology. So to help you make a choice, a practical here’s, let’s code a real example, get it running, see how it works, so that by the end of that chapter on, say, Azure functions or SignalR, you’ll feel comfortable, “okay, I get what that technology is. I get what its pros and cons are. I’ve seen it work.” And so when you’re in a meeting with the boss and you’re discussing different technologies, you can say you can at least make a good contribution and feel more confident. “Yes, okay, yeah, I do think that is going to be the best way to go.” And when you’re then going to perhaps the official documentation, whether it’s the Microsoft Docs site or gRPC, because it’s cross platform, you might have to read examples in Java or in Python, but because you’ve seen it work with .NET through the chapter of my book, you can understand a lot more and you can start it’s.
That getting started is what I always struggle with and that’s what in some ways, like a lot of people say, they write books for themselves. It’s like, “this was the book I wanted when I was starting,” and it can really help you accelerate that getting started. And that’s my hope. And really looking forward to hearing feedback from readers, particularly of this new book, so that I can then incorporate that into the next edition. Ready for for 2023 absolutely.
Jamie
But let’s say you don’t have that. You’re picking up Jquery, you’ve never used it. If all you need to know to solve the problem is this tiny piece of information, then you solve the problem, fantastic. But then perhaps when you have five minutes, ten minutes, circle back and learn the theory and the understanding as to why that happens.
Mark
Jamie
And I think your point there about human spoken languages is a perfect analogy. I’d said earlier that I had read this book that was in Java. Effectively, I didn’t know it was a Java programming book when I bought it, but I still read it all the way through because C# and Java are quite similar. And putting the argument of writing a program in a C# style to one side, there’s only so many ways you can write an if statement or a for loop or whatever. Right. And so it all sort of fits together. They’re all kind of variations on a theme. Now, when you take the writing it in a C# or .NET style back in, things get a bit wobbly. Things change a lot because my friend Zac talks about writing Python in a Pythonistic way, because an if block is still an if block. But it’s not the if block that you need to focus on, it’s the structure of the program, it’s the supporting libraries, it’s the testing libraries, all that kind of thing you pull in that define how you will write the language in the framework. Because you’re writing a language into a framework, you have to adhere to the standards. Probably a really bad way of describing that.
But again, similar to human spoken languages, like you said, that you can appreciate why, say, C# does things this way and Java does it that way, or JavaScript does it that way, or maybe Go does it that way. But Go is an incredibly stripped down language because it doesn’t need all of the features that C# or Java or any of the other similar aged languages need. And so that allows it to run faster and produce these tiny binaries. I think Hello World comes out like 2 KB. It’s ridiculous.
Mark
Jamie
Mark
Jamie
Yeah. But I see your point about learning the bits of the language, “how to build the services and features,” that you not necessarily need right now, but you may need in the future. It’s that argument that we all have when we’re in the classroom: “but teacher, why do I need to learn this?” “Well, I’m not teaching you to fill any kind of jollies that I have. It’s not a particular pecadillo I have. It’s something that you will need. You just don’t know that you need it yet. Trust me and you’ll learn it.”
Mark
Jamie
Mark
Jamie
Mark
Jamie
Because I remember we were talking in our previous conversation about just like the minimal APIs, like Hello World becomes a single line instead of eleven lines of several using statements, a namespace, a class, loads of parentheses and brackets and all that kind of stuff. And so by removing all of that cruft and maybe putting it into the background makes it easier to get started. But then it’s really important, I think, to understand what is actually happening when you hit build, like to understand that the C# tooling is stepping in and putting all of that back. It’s not that it doesn’t ever exist ever again, it’s just it goes back in because that’s cruft, that’s toil, that’s the stuff that the language designers, the tooling designers have decided actually you’re always writing this. If we take that out, perhaps you could be more productive.
Mark
Jamie
dotnet new whatever, there’s a flag you can put on there to say, give me the old style, the more traditional style, all of the code, please. Because at the end of the day, it’s just being created by the compiler. When you hit build, that’s all that is. It’s not that it’s hidden from I guess it is hidden from you, but it’s making it easier for you to get because we’re not hired to type. Right? Like you said, we’re hired to solve the problem, and getting rid of all of the ceremony and the cruft allows us to solve that problem faster.But then you need to perhaps understand what’s happening between you typing your commands and you’re hitting build. And the actual code that runs here, not necessarily at the IL level, but like the hidden magic, the templates that are happening to put that stuff back, so then the compiler can step in and do its thing. Right?
Mark
And you can really see even today that a human developer’s skills now need to be less about necessarily writing the raw code yourself, but being able to maybe use a tool like that, but be able to recognize when it gets it wrong. Yes, like in an essay where it’s kind of got a few of the facts correct, but you need to be able to critically evaluate Ai generated essays, code, that type of thing. And that’s actually a very high level, very important skill. And whether it’s the examination boards or whether it’s coders or their managers, you can’t stop this AI stuff. But the skills that a well paid human developer will need, I think, is going to rapidly change over the next five years. And yeah critical analysis of code that something else has written is going to be the number one skill. And so a deeper and as you mentioned, it’s the deeper understanding which is so important.
I mean, that the last 15 years, lots and lots of developers solve half their problems by quick look on stack overflow and copy and paste. The AI tool now does that for you, but you still need to have that same skill of, well, is that the right answer? Is that the best way of doing it? Have I just introduced some bug that I’m not going to notice for months or years and someone else has the problem solving it? So, yeah, critical.
Jamie
Mark
Jamie
Mark
I imagine lots of marketers… journalism you can generate, even ones written by humans. These celebrity articles, they’re all the same. You’ve just got to take one minor fact and expand it into 500 words. Well, AI is going to be able to do that really quickly and that the cheaper publications won’t even bother having a human look at it. And 90% of the humans who read the article, it’s junk food kind of thing. And so the quality really doesn’t matter.
I hope that like artists with the drawings that you can do with AI now, hopefully the high quality artists will still be able to create original works. But yeah, if you’re just a publication and you need a quick graphic to just go with the text, then that’s what it’ll be used for. Sure. As usual with all technology, if you’re in the top 10% of your industry, it’ll just make you more productive. But my worry is everyone else.
Jamie
But it won’t be to those that really connect with the art piece, it won’t be a DaVinci, it won’t be a vanguard. It won’t be that original artist. Like you said, if all you want is some piece of art to throw into an article or throw on a wall, just like this is some, “I’ll have one art, please.” Right. Then AI generated art will probably be fantastic for your use. But if you want that original human take with the human feeling and the flair and that interpretation, then again, it’s way out of my comfort zone, but I feel like that will probably be the way that it goes.
Listeners won’t be able to see, but I have a number of pieces of art behind me, and I got a poster from a video game that I used to play as a child, and I’ve got a cross stitch that my brother has made completely by himself. And those two things are two completely different things. One is a print that has been commercially mass produced, and the other one is something that he’s produced himself using his own effort and put his own flair into. And so they’re both very important to me, but for very completely different reasons.
Mark
Jamie
I think to your point about AI generated code, and it requiring - I hate to put it this way - but higher level thinking. Yeah, higher level thinking is probably the right way to put it that critical analysis. I feel like it makes it more accessible as well, because I was describing to someone at the weekend about how computers are actually terribly designed. They are designed for people with hands. Well, what if you haven’t got hands because of some horrible thing that’s happened or because your hands are busy doing something else? Maybe you’re holding a baby. Maybe you’re doing something right. And so you need to have voice activation. Well, voice activation is really good, but it’s also really terrible at the moment. It’s still not good at picking up certain accents. And if there’s lots of noise in the room and things like that, so then that makes it harder to do.
And so if you can have a computer or an AI system, just automatically generate some code, and then you can actually look through it in your own time, in your own way, and pick it apart and say, “right, now, this needs to change. That needs to change. We’ll do this and,” like you say, make it more fit for purpose, definitely. Then to me, that’s immediately more accessible to people who can’t type. Like, what if what okay, what if I develop arthritis in my fingers? My ability to actually because I’m not hired to write the code. I’m hired to solve the problem. My ability to write the code goes out the window, but I can still solve the problem. And we currently solve that by going to pair programming. But what if there’s no one for me to pair program with? Then I’ve got the solution in my head, but I can’t get out. So I could use an AI tool to generate some code. I can maybe sit in a quiet space and say, “hey, ChatGPT, generate some code in C# which uses these libraries, blah, blah, blah, blah.” And it will get there eventually, I think.
My friend Paul showed me some code this morning. He was having a dialogue with it, and he said, “generate some code which leverages ImagesSharp to load an image. Now wrap that in an API. Now wrap that in a class.” And it was working, but it wasn’t. Right. And so he was able to actually go back and make it work. It still took him a few hours to get it to the point where it was working. It didn’t save him any time, just saved him typing loads of stuff. And as Scott Hanselman says, we only have so many keystrokes in our fingers. Right?
Mark
Jamie
Mark
Jamie
Mark
Jamie
And I feel that it would help with academia as well. There’s a bunch of people that I know who are software developers in academia. They are PhDs, they are people of great influence and education in certain industries that are not development, but they do development, if that makes sense. A friend of mine writes .NET and Python code as part of his work in academia, but he doesn’t describe himself as a .NET developer or a Python developer. If this person can say, right, okay, to chatGPT or whatever, “suppose I have a data set that looks like this, and I want to evaluate it using Python and get X, Y and Z out, write me some code, which does that go?” Because that is like you said, it’s a single use. All I need to do is cleanse this data or get one particular data point out of it. And it’s faster for me to sit in GPT and type it out over a number of hours, just to get to the point where it’s reduced the problem down to the smallest bit. And then it’s figured out how to write that code, then have a human look at it, and they say, yeah, okay, you could probably do that with a friend who is a python developer or a .NET developer who’s willing to do that for ten minutes in their spare time. I’m not volunteering anyone, but I feel like that’s an easier task than saying, “how much will it cost me to have you write a program which does this?” Because then they have to go away and it’s going to take them a couple of days, and maybe they’ll do it in an enterprisey way and rapid tests around it and all that kind of stuff. And it’s not a waste of code, but it’s slowing the solution down, or rather slowing down the progress to the solution. I don’t know. What do I know?
So we talked about community earlier on, and I think that’s the most important part with any kind of learning. And I love this idea that you have with Packt, you have a discord server where people can join and talk to authors, talk to similar learners, talk to learners who are more advanced than them, or learners who are catching up to them, or I don’t know - about, again, unintentional ignorance. I feel like that’s probably the worst way to say it, but the learners of all sorts of different abilities and backgrounds and experiences. And I feel like that is something that has only really happened in the last maybe two, three, maybe even five years where I can buy a book and then I can join a community, still learn from the book, in my own time, in my own space, where maybe I feel safer in my own space or maybe I feel more comfortable in my own space. I can learn from that because the problem with the book, I’ve always found, is you can’t ask why if the way it’s written isn’t put across to me in a way that I don’t fully understand. And I have to go to Google or I have to go find someone to ask. I can’t ask why, but with the community, I can actually turn to people and say, “hey, there’s this bit on page seven that says blah blah, blah, blah. And I think I understand it is my understanding correct?” And you can ask them, and because they’ve got the same book, they can jump to that section, refresh themselves and go, “yes, you’ve got it. Absolutely right. But also, here’s some supplementary things.” And then I suppose as an author, you can jump into that conversation and go, “right, okay, I understand that perhaps some words maybe need to be tweaked or maybe I need to add some extra stuff.” And I feel like it’s this wonderful feedback loop for everybody. Right?
It’s a continuous integration but for authors.
Mark
Because we started doing the discord channels for the 6th edition, the previous edition, over a year ago, I was able to get some really valuable feedback, things that I had maybe just not even thought about, because you just make these when you’re trying to write code and writing examples, you maybe do make a few assumptions. And so you haven’t fully explained exactly why you’re going to get them to do all these different things in the book.
And so I was able to just change a sentence slightly in the 7th edition that makes it so much easier for the reader to understand; yeah, why they’re doing this certain thing. Even with the 7th edition, after seven years, the fundamentals, particularly with a beginner’s book, it’s not like an
if statement or a switch expression or even ASP .NET Core changes that fundamentally, but every addition can be that 1% improvement, which actually has a 10-20% impact. It’s fascinating. Every time I think, “oh, well, there’s nothing that I can change next year,” and I end up changing so much, and I think definitely improved. I mean, just, just I’ve been so pleased with the reviews, the Amazon reviews for the current editions. I’m very happy. Everyone really seems to be very pleased with all of those improvements. And honestly, it really is thanks to my readers and thanks to that feedback and that interaction, particularly through discord. So, yes, I absolutely encourage all readers, please join us. And I think you’ll find a very happy, helpful, friendly community.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
But there are other people who maybe a classroom setting would make sense of, like a virtual classroom, or just having that community to be able to turn to someone and say, “hey, I don’t quite get this, it’s my misunderstanding, but how do I understand this?S” Or heaven for Fend. You’re doing it right. You understand it completely and the tooling breaks.
Mark
Jamie
Mark
Oh, and that’s the other thing I’d recommend to to anyone who’s listening to this, who’s maybe thinking about buying one of my books, do also please go to the GitHub repository. I do have a list of corrections and I’m very active on there. As soon as someone raises an issue, I like to get it in there. So there are a few luckily minor things, like the name of the extension, for example. But yeah, hopefully it’ll save you a little bit of confusion if you have a look at the errata first.
Jamie
Mark
Jamie
Mark
Jamie
Mark
Jamie
Mark
Jamie
Mark
Jamie
Mark
Jamie
Mark
Jamie
Mark
Jamie
Mark
Jamie
Mark
Jamie
Excellent. Okay, so let’s say I’m already of A with C# and .NET modern .MET, and I want to skip over modern cross platform development fundamentals and jump into apps and services. You touched earlier on about some of the apps and services you can build.
Mark
Jamie
Mark
So full stack is probably quite a good way of an umbrella term that would cover the contents of the Apps and services book because as a full stack developer you need to know the server side, whether that’s a ASP .NET Core website may be implemented using MVC; or whether it’s a ASP .NET Core hosted service, whether that’s built using minimal APIs or the more traditional controller based REST APIs; or using alternative kind of transport layers. And underlying kind of protocols like gRPC can be much more efficient, particularly if you’re trying to build complex microservices. So rather than having maybe one monolithic web technology REST API, you might break down that into lots of microservices and the added complexity and communication between those microservices in order to provide the complete task that might need to be currently being executed. That means that you’ve got additional communication, you’ve got the message format has an impact, the number of layers between those microservices has an impact and therefore performance of that transmission of documents becomes really, really important. And if you were to just implement that using REST APIs, then the overhead of HTTP is often just too much and you really start to get those bottlenecks occurring.
And that’s one of the reasons why Google invented gRPC with a very efficient binary format and it works cross platform with pretty much everything. And so there are third party libraries that you can use. Microsoft has done some implementations as well. So as a .NET developer you need to know how to build say, a public service which is probably going to be some kind of HTTP based like Rest or just HTTP. But also you’ll need to know how to implement gRPC so that you’ve got that more efficient communication between the microservices. If you’re trying to provide the client. Which could be a web application, a single page application using React or View or something like that. Or maybe it is just a .NET application developed using Razor Pages or MVC.
But if you’re talking to a traditional REST API then it has a very formal interface. You call this address in order to get a list of customers and you call a different address to get a list of shippers. And the format that you’re going to get back is maybe you have the choice of you can add in a request format header to say you want XML rather than JSON or something like that. But the amount of data that you’re getting back is probably pretty fairly pre formalized. Whereas if you therefore want to allow the client to have a lot more control and say well actually I only need the company name of the customer and I need this information from the orders and just give me a subtotal of that, then REST APIs aren’t the best solution. And so there are two alternatives. The older alternative might be using OData, which still can use HTTP, but you’re providing an endpoint where the client can then construct their own kind of query string with a standardized format. So you can define what columns you want, what entities, how to do the joins, filtering, all of that kind of stuff. So it’s an entire query language on top of your HTTP-based service. So you’re getting back efficiently only the data you want, but all of it all merged together in a single request, which can be more efficient.
And the more modern equivalent to that would be something like GraphQL, originally developed by Facebook. But there are implementations of that for .NET now. Now, because there are so many different service based technologies, microsoft, it would just be impractical for Microsoft to provide an official .NET implementation of all of them. Now the more important ones, like REST APIs and gRPC, microsoft does have their own official implementations, but for things like GraphQL. They don’t.
And so there are various third party libraries and in the 6th edition I used what was the most popular GraphQL implementation for .NET at the time. But I’ve now switched in the 7th edition to using Hot Chocolate by Chilesoft. And what I found problematic about the GraphQL net, the previous library that I used is that the impression I get is that the developers looked at the formal specification for GraphQL and did an exact implementation of that. So it’s a true, properly engineered, but implementation of everything of the Graph QL specification and the Raw specification for anything can be overly technical. And so it required so much effort and code and configuration just to even get the most basic implementation of a GraphQL endpoint and be able to start querying it. And so it was quite tricky to then write a simple enough example in the book and it then turned out to be quite brittle because they made changes. I think it was like going from version three to four or four to five, there were some huge breaking changes and it was just not very well documented because only a few people working on this open source project and it’s very difficult to keep it. So I don’t blame the developers at all, but just a combination of their initial approach being, I think, a bit too one to one mapping to the specification in combination with not being able to keep the documentation up to date. I found it very tricky to work with.
Whereas Chilisoft and their platform really, because they’ve got various products to build, clients to GraphQL to implement, the GraphQL server to do kind of testing and automatically generate clients for a GraphQL endpoint. Very, very Microsoft-y for anyone who is a Microsoft developer, you’re familiar with the way that Microsoft have been very good historically at taking maybe a quite complex technology and implementing a way for develop… a platform for developers to then use or implement that technology with minimal effort. And so you can get started very quickly. It works in a kind of more logical way, it fits in well with the rest of the .NET framework and the kind of conventions that a .NET developer are used to. Yeah, very convention-based, so minimal effort to get it working while still giving you the full power and being able to take control. And so I found once I switched to then using hot chocolate, everything flowed so much better.
So that chapter I’m particularly proud of. But there’s so much more that you can do with GraphQL. In particular, in the second edition I already know that I want to add more examples about how to take control over things like data loaders to make it more efficient, so that when you’re building these complex queries, because you can just ask for exactly what you need across multiple data sets, at the moment the basic implementation could therefore be potentially inefficient because it potentially have to join stuff together and just do it in a kind of maybe clumsy, not efficient way. Whereas if you go to the effort of actually implementing custom data loaders within the server, you can really make that much, much better. And I think that’s going to be an area where my readers would really benefit in the second edition.
So, yeah, if that is something so if anyone has bought the book and they’re interested in GraphQL and that sounds good to them, they do want more on GraphQL, please let me know. I’m probably going to do it anyway. But I’m really interested to know, would you rather use OData or would you rather use GraphQL? Are you interested in gRPC? Which areas should I put most of my effort for the second edition? There will probably be a third edition as well, so if I can’t get to it in the next nine months, there’s always a future opportunity as well. But yeah, I’m going to be led by my readers. So please, yes, give me feedback and right.
Sorry, this is a very long answer, but yeah, full stack. So then we’re kind of onto the client side and yeah, the two main, well, I suppose three main client to build GUI, the graphical user interface. So I do review MVC, even though I do cover that in the first book as well. I do go into MVC in a bit more detail and in particular using things like Bootstrap for prototyping. If you’re building a front end website for a client, branding is usually very important to them and using something like Bootstrap, you can end up with a site that just looks like everybody else’s. And so Bootstrap is not always the best choice for a final frontend website, but certainly for prototyping or for internal intranet type applications, very useful. So I do cover a bit more on Bootstrap in the Apps and Services book.
So, yeah, MVC and Blazor and .NET Maui. So Blazor, very good way of there are some really excellent open source free libraries with the Blazor components already created for you. Things that if you want to get a graph in there, for example, or do carousels or all these different standard things. Yeah, I’ve been quite impressed with how quickly third parties have created both paid for and free open source component libraries for Blazor. So there’s a whole chapter just covering those as well as building your own Blazor components. And then for the .NET Maui chapters. so if you do need to try and create a single project that can generate desktop Windows, and macOS Catalyst apps, as well as your Android and iPhone apps, just all from a single project .NET Maui is a great way of doing that. Yeah, I hope .NET Maui still is probably the least mature of all of the technologies in .NET that Microsoft supplies.
But hopefully it will just continue to improve and Microsoft will give it the investment that it deserves. I hope that Microsoft gets feedback that enough of their customers are using .NET Maui and the demand is there so that they can then justify maybe increasing the budget for the team who works on .NET Maui. Because I’m impressed with what they’ve managed to achieve within their constraints. I just hope that Microsoft continues to invest in that, but we’ll see. I hope it’s not going to be another Silverlight. I’ll just drop that in there, please Microsoft, give the team more money.
Jamie
I feel like the way that Silverlight had to go, not the way that Microsoft chose to make it go, but the way that it had to go just because of the way that browsers were moving at that time. I feel like that has left a lot of worry in certain early adopters, some people are just like, “oh my goodness, this is brilliant technojoy. I’ll use it to build all the things.” And some people are a little bit more reticent, I think might be a good word to use. Reluctant, probably a little bit better. And that’s just because when you build something you need to know that there’s going to be support for it. I’m not trying to defend Microsoft, I know I’m an MVP, but I’m not trying to defend them in this. They’re big enough to defend themselves is what I’m saying. But I feel like it was more the direction that web browsers were going in at the time that caused Silverlight to go in the direction that it did. By installing lots of plugins into your browser, you immediately make it unsafe and browsers want it to be as safe as they need to be, which is it just makes sense that they would do that. But yeah, I agree with you. I hope that [.NET] Maui gets the support it deserves from those who make the decisions because like you said, it’s not as mature as the other things, but that’s because it’s new.
Mark
Jamie
httpclient.Get this address and it will return the thing or post this address that will tell you that it worked. From what I’ve experienced, the very small amount of experience that I’ve had, which is eight weeks of working on an app to get it running on my Android device, their iPhone, their Windows laptop, my Mac laptop.Mark
Jamie
Mark
I’m curious about the - what do they call it? Blazor hybrid with [.NET] Maui. Because I was getting the feeling that if I had a customer come to me to build a client application and it had to run on mobile devices, but it needed some custom components to be created. I have a feeling that I might try to do components using Blazor. So that if they did have because a lot of businesses, I think, need a website and an app and a mobile app. And so what you really want is a way to implement your graphical components once potentially using Blazor components, and then be able to though host those not just on your MVC site, perhaps ASP .NET Core MVC website, but also hosted embedded inside some kind of native app so that you can get the native integrations, whether that’s notifications or just the kind of look and feel. So I have a feeling that I might go that way. But I was wondering how you feel about that. Even if you haven’t had practical experience yet, how important is it to use the actual..NET Maui native controls compared to, say, Blazor hybrid components?
Jamie
Mark
Jamie
Mark
Jamie
Mark
And you get some integrations with the native operating system by doing that. Like, yes, being able to add it as a tappable icon on the home screen. But I’m not sure, I haven’t investigated deep enough to know. What extra would you get if it was an actual mobile app? I’m assuming that things like notifications are probably some of that, but yes, I haven’t really gone to that level.
But in summary, I hope that Microsoft does continue to invest in .NET Maui. Do you have any sense about because Microsoft have officially said that they won’t support [.NET] Maui GUI apps on Linux. They won’t be doing the implementation. They’re hoping that it’s open source that third parties might do you have any sense of how that might hold back [.NET] Maui or how important that is?
Jamie
But the Linux is with a Linux desktop operating system. There’s a ridiculous amount of combinations. But I do happen to know, and it was only about a month ago I spotted something on Twitter someone had said, I think it was a blog on the Microsoft dev blogs. I may be wrong. If I am wrong, I will correct it and put a link in the show notes.
So please do check those out.
editor’s note: this was a GitHub repo created by Microsoft, and it has been silently deleted between Jamie spotting it and recording this episode. The original URL was https://github.com/dotnet-standard-ui/standard-ui
Jamie
Mark
Jamie
But then how do I put it the problem is I end up being all political and stuff. There is still a large contingency of people in the Linux environment who equate to Microsoft with evil and whether they should be or shouldn’t be, I’m not trying to make that statement, but a lot of them will make that statement. Like with the latest version of the Ubuntu distribution of Linux .NET 7 is now sort of baked into the installer. So then you install Ubuntu and you get .NET 7 out of the box. Lots of people in the Linux community were very upset about that. With certain versions of the Raspberry Pi operating system. Raspian - which is based on Debian - Visual Studio code, is installed by default. Lots of people were upset about that too, because for one reason or another there is this traditional view of Microsoft of the “extended embrace extinguish” and they have this feeling that it is coming with it. I’m not trying to make a point either side of that argument. What I’m saying is that there’s a lot of that. So I feel like if a Microsoft .NET Maui Linuxes UI is to happen, I feel like there might be a great amount of pushback against it.
There’ll be lots of people pushing for it, but I feel like there’ll be an equal or greater amount of people pushing back against it for traditional reasons of the old view of Microsoft being evil, whether they are or not. I’m trying to stay out of that argument. It’s an argument for other people to have. But I feel like there would be a lot of pushback for me. It would be great to be able to pull up my IDE, type in a whole bunch of XAML and hit build and see it appear on my machine. But currently what I’ve got to do is I’ve got to fire up the Android emulator and load it onto that. And then if I want to run it on my Windows machine, what I literally do is throw it up to GitHub. It does a build for me and gives me an exe which I then run on my Windows machine or a .APP that I can run on a Mac OS machine. So currently I have to push it away for it to be built so that I can go to that machine and run it. Which is a bit of a shame. But if they can come up with a way that makes that easier. That also doesn’t upset a lot of people. I’m in. But I’m also all about maybe we can try and be not as upset. I don’t think a UI framework is the end of the world. Right?
Mark
!!) you could put after the parameter name I think it was, rather than the data type. So you could say string firstName!!. And so that would then automatically add in the code to basically do a quick if check: “if it’s null, then automatically throw an argument null exception,” type thing.And when Microsoft introduced the feature they explained, “well, we’ve already been using it internally and the .NET team that’s writing all of the class libraries saved tens of thousands of lines of code. It reduced the code base by and so they really like it.” But there was such a massive amount of negative feedback with making some good points that they then a couple of previews later were removed. And so that features not in .NET 7. Now in .NET 6, the, the framework team in the argument null exception type in that class, it, it has now a method that you can call instead, you know,
ThrowIfNull I think is what the method name is static method. So you can almost get, you can certainly reduce the number of lines of code that you have to write. It’s definitely simplified, but it’s not quite as neat. And my personal opinion is if Microsoft wants to add a new language feature like that that can significantly wrote by tens of thousands of lines of code, I personally would vote to have it. And for those who really don’t want to use it, don’t use it. That’s my personal opinion. I understand the argument, “well, even if I don’t use it, it’s complicating the language,” and yes, I do take that as a valid argument that I tend to lean towards, “yeah, give us some new stuff if it’s going to improve the language,” and then give us the choice of using it.If you work for a particular company and you’re the team leader, you can say, “right, our policy is not to use that feature,” and just add in a code analyzer that will make sure that you don’t use it, that type of thing. But let the rest of us use it please.
But anyway, it has been really interesting to see the transparency that the .NET team has been letting us see how the sausage is made. It can be frustrating, but it’s definitely fascinating. Certainly for me it gives me a deeper appreciation and great gratitude to the team for putting a lot of thought and effort in and really taking it seriously. The feedback from the community, I think it really builds trust. Ultimately, I understand why they then took it out again. Personally, I just think it’s a little bit of a shame.
Jamie
Whereas I feel like perhaps we as people in the community and indeed perhaps in other people at Microsoft who are making these announcements, maybe we should be accepting these announcements in the vein of, “well, this is a thing if you want it.” Right? They’re very syntactic sugar. I remember there was a huge amount of pushback for the
var, for implicit versus explicit types on your variables. Huge amount of pushback. I know developers to this day who refuse to use var and I’m like, that’s cool because what you’re doing is you’re solving the problem and what’s going to happen is the tooling is going to swap that for a var. Or the tooling when you hit build is going to go from var to your type. So it’s not even a hill to die on. It’s like it’s a sock on the floor to die on. RightI hate the phrase “to die on”. You know what I mean? In the massive in the grand scheme of things, it’s not a huge argument to get caught up in. And I feel like I empathize and understand from the Microsoft point of view because when you’re announcing these things on stage, you only have an hour, 2 hours for maybe even 40 minutes, maybe even half an hour to show off a new language feature and then you’re off.
Or if you’re in a blog post, if you’re not a professional writer like yourself, then you’ve got a developer or a developer advocate who has written the blog post. And they may not have communicated in the way that the person who was the individual who’s reading it such that they know that it’s not a requirement. You don’t have to use this, but this is a convenience feature. Syntactic sugar. You don’t have to do it, but then, like you say, you got the argument of his polluting the language, all of pollutes the language from that point of view. Hopefully you hear the bunny quotes, “LINQ pollutes the language,” in that same way. So minimal, APIs, global usings all of these things that we’re all in agreement with, are pretty good at doing the same thing, but it’s for way smarter people than me to figure out. But I feel like perhaps we as a community need to approach these announcements with, “that’s interesting and novel,” and perhaps those making the announcements need to say, “this is interesting and novel and you don’t have to do it, it’s just a thing we’re trying out.”
Mark
Jamie
Mark
Jamie
Well, I’ll tell you what, Mark, we’re both running out of time that we can chat further today, but I always enjoy my conversations with you. You’re one of the few people who’s been on the show the most.
Mark
Jamie
Mark
Jamie
Mark
Jamie
Mark
So, my two most recent books that were published in November 2022, the titles are “C# 11 and .NET 7 Modern Cross Platform Development Fundamentals”. Fundamentals literally being that’s the recommended first book if you’re completely new to the language and the libraries. And then the companion kind of follow on book is titled “Apps and Services with .NET 7.” My name is Mark J Price. So that’s my Gmail account: markjprice
So I mark j Price on discord as well. I don’t remember what the number is. 7018. So markjprice#7018 on discord. And yes, for those of you who have read my previous editions or have bought the latest, I hope you’re enjoying joining them. Anything you want me to add to the next future editions, let me know. And I hope that you all learn a lot and have fun doing it.
Thank you again, Jamie, for inviting me on your podcast.
Jamie
Wrapping Up
That was my interview with Mark J Price. 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 dotnetcore.show, 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, and to come back next time for more .NET goodness.
I will see you again real soon. See you later folks.
Useful Links
- C# 11 and .NET 7 - Modern Cross-Platform Development Fundamentals
- Apps and Services with .NET 7
- Mark on Twitter
- Mark’s website