The Story behind NET MAUI

Salih Cantekin
6 min readJul 26, 2022

--

One of my favorite aspects of Microsoft is that they take full ownership of the ecosystem they have established. At first, they thought that they should have full control of this, but then they realized that this is not a good way in the modernizing world and they adopted the concept of open-source code. By doing this, they not only became transparent, but also received the support of community. If you want to support and maintain this ecosystem, you have to do things you haven’t done before, different and better than your competitors!

Microsoft EcoSystem

C# Ekosistemi

The entry point to this ecosystem for me was in 2005 with WinForm Applications. Even though it wasn’t included in the curriculum, thanks to one of my teachers(“Zahide”) who took the responsibility and started teaching us C#. Good thing she did.

However, as it was later understood, WinForm was not the only application we could develop in this ecosystem. We can develop web pages, Console applications as well. As a result of the rapid developments in the Information Technologies field, mobile phones and naturally mobile applications began to appear. Microsoft could not provide the necessary contribution to its ecosystem to develop mobile applications early. Microsoft’s general rule is that a developer can develop applications for different platforms using only C# (including F# and visual basic) in their ecosystem.

This paved the way for Microsoft to enter the mobile market and create the Xamarin platform. Again, using only C# language, applications could be developed for Android, IOS, or Windows Mobile operating systems. The term “Cross Platform” is used for applications that can run on more than one platform with a single code base. However, Microsoft’s competitors were also developing many efficient languages. Some of them were Cross Platform supporting languages, which were not accepted by many programmers. Others were using Native languages/tools (xCode, Android Studio) to develop Native applications that satisfy many developers. Although Xamarin was not that popular, it took big updates and made moves to bring it closer to its competitors.

Xamarin

As I mentioned above, Xamarin is a Microsoft product that enables mobile applications to be run on multiple platforms by producing Native output. Undoubtedly, one of the biggest moves of Microsoft is to combine .Net Frameworks and turn them into a single structure. Concepts such as .Net Framework, .Net Standard, .Net Core were now gathered under the umbrella of NET. I personally think they managed this process well. While there was such a merger on the framework side, there was still a mess in other areas. The platforms of WinForms (windows or MacOs), Web Pages, SPA (Blazor), and Mobile (Android, IOS, etc.) applications were still separate. The rule of Microsoft, which entered the SPA market with Blazor, was the same. To provide this service to software developers using the C # language.

Blazor

Blazor is a Microsoft product with which we can develop applications with the SPA (Single Page Application) approach with WebAssembly or Server versions. Microsoft, which has invested heavily in this area in order to stand out in the SPA market, had one last move left to tidy up this mess a little more.

MAUI

Oh man, didn’t you start this article by telling me about MAUI, you might be saying why are you talking about Blazor and Xamarin. But bear with me :) I’ll link them all together.

Desktop Apps, Web Apps, and Mobile Apps are the environments where we can develop applications using Microsoft products. However, the fact that these are also divided into sub-categories can be annoying many times. In other words, we say Desktop, but usually, Desktop applications in Windows operating systems come, but what will we do if we are going to develop applications for the macOS operating system?

For this reason, it was necessary for Microsoft to take the responsibility for these platforms and do something like merging .NET Framework, and the concept of MAUI came into our lives.

We will hear this concept very often. Because it may be one of the revolutionary projects on the Microsoft side. However, not only that, it can have the same effect on software developers like us. The rule here is still the same. To be able to create applications using only C # language. So how do we create applications?

With MAUI, we can develop Native Mobile (Android, iOS), and Desktop (Windows, macOS) applications. I’m not talking about the ability of an application developed with MAUI to run on the Android platform, do not get confused. I’m talking about developing a Native app for Android or other platforms by using only MAUI.

So how does MAUI do these operations? So, how can a “button” object that I add to the screen be a separate button in both Android, iOS, and Windows Desktop applications?

It’s a very simple, abstraction. Abstraction is a concept we’ve been using in OOP for years. In short, we can think of it as a fixed structure in the foreground and a variable structure in the background. So for our example, MAUI is the abstract part here. MAUI gives us a button object and we use it on our screen. Then, when we compile our project, in which environment we will run it, the part that remains as a variable in the background finds its place. If we are compiling for Android, the part that changes our application becomes android and we suddenly have the android button. This is how Microsoft handled the “Cross Platform” approach.

So will we be able to do something specific to the operating system?

The answer to this question is YES. Under a single project folder, under the folder named Platforms, there are separate folders for projects where we can compile the application. Below these, we can make the necessary adjustments and customizations. Apart from that, we can add our conditions in the code as follows.

So what about the applications we developed in Blazor?

MAUI will be able to work in a hybrid structure with Blazor. So if you have a Web Project that you have written with Blazor, you will be able to use MAUI as a container and publish it on other platforms. I think we will not be like opening a website in a native MAUI. As far as I know, Microsoft doesn’t use WebView here :)

Why MAUI when you have Xamarin?

MAUI can be seen as an upgrade of Xamarin. We cannot develop Desktop level applications with Xamarin. Of course, there are other differences as well. For this reason, I can direct you to this article. I don’t know yet if Xamarin will receive new updates from Microsoft after MAUI comes into our lives, but we will be able to easily convert and use our Xamarin applications to MAUI.

I hope it was an enjoyable read. See you in other articles.

--

--