simon_bisson
Contributor

Uno Platform updates to 5.0

analysis
Nov 02, 20236 mins
C#Development ToolsMicrosoft .NET

A new release of Uno in advance of .NET 8 adds support for MVUX and C#-based markup.

November is the time for .NET updates, with .NET 8 peeking around the corner. It’s not the only part of the .NET ecosystem that gets an update; many third-party tools, frameworks, and platforms roll out their own updates to be ready for the new release. As this year’s .NET is an even-numbered long-term support release, getting tools ready for the transition is even more important, as many enterprises will standardize on this version for the next three years or so.

One important arrival is a new version of the cross-platform Uno user experience platform, which helps build one code base that can target Windows, macOS, iOS, Android, Linux, and, thanks to Web Assembly, the web. The new release, Uno 5.0, is a big update, with a focus on developer productivity and an alternative to the dominant Model-View-ViewModel (MVVM) user experience design pattern.

The new Uno Platform

There’s one important difference between Uno and other .NET UI frameworks: It’s driven by a team that comes from an agency background. This is key because the team understands the relationship between designers and developers. They are building tools to reduce the friction that arises when design and code are delivered at different paces. After all, they use this framework every day to deliver applications for their clients.

It’s also why Uno is evolving into a platform, going beyond its initial set of controls to deliver tools that help build cross-platform user interfaces for .NET code wherever it runs. Like the .NET C# Dev Kit, Uno goes a long way to make Visual Studio Code a preferred .NET development environment, including a fast Hot Reload to help go from code to running application as changes occur.

Introducing the MVUX pattern

One key feature in the new release is support for the MVUX design pattern. Standing for Model-View-Update-Extended, it’s a different way of thinking about how applications operate from MVVM. For one thing, it delivers an immutable model and view, rebuilding them when data changes. As it treats data as a feed, it’s a good way to work with asynchronous data and streamed sources. This makes it a good match for stateless cloud-native applications where scalability concerns and distributed system architectures make it impossible to guarantee persistent connections.

MVUX works well with the underlying technologies in .NET’s UI stack, as it adds a bindable proxy between the model and the view, allowing it to support the data bindings used in .NET to connect to XAML controls.

The idea of a flow of data is central to MVUX. A feed sends an update, generating a new model, which links via a bindable proxy to its view. Uno provides a new control, FeedView, which simplifies connecting a model to a feed. Once a feed updates, a new model is generated along with its updated view. It’s a similar approach to reactive programming techniques, with its feed roughly analogous to reactive’s concept of an observable. This keeps the view and model separate, which should help with both model development and UI testing.

You can wrap the whole operation in an asynchronous class, ensuring that the model only updates when there’s fresh data. The view updates through the binding proxy when the model is refreshed, keeping it in sync. You can add additional information about the state of an update, for example, if the code is waiting for new data, if an update has succeeded, or, more importantly, if it has failed.

The Uno team has been using this technique on its own projects and is claiming a three-to-five-times productivity boost. Of course, that doesn’t translate to all projects, but when you’re managing a tight loop between designers and developers, getting code out and tested faster speeds up the design process as well.

C# markup for any control using source generators

An important development in Uno 5.0 is the use of source generators to link layout and controls directly to C# code. You can still use the familiar XAML techniques to bind controls to code, but this approach builds on the capabilities of .NET’s Roslyn compiler to create C# markup for designs, simplifying application development by keeping code in one place and only needing one set of skills. There’s a one-to-one mapping with XAML, so names and types come across into C# directly.

What’s nice about this approach is that it’s supported for existing controls, so you can pick up the Windows Community Toolkit, Uno, or your own custom controls and start coding against them. By choosing to use source generators, Uno removes one level of dependencies; a new control comes out and you’re able to work with it as soon as it’s in your development environment.

Using both source generators and MVUX offers a distinct advantage for development teams. It allows them to use sketch-driven development models, working with rough versions of custom controls while they build out the model and view together. As new versions of controls are delivered, the C# markup automatically updates, allowing developers to continue to build in parallel with design changes, working against the initial C# markup and adding new features as they are added to app layouts.

From Figma to code

Adding Figma integration closes the designer and developer loop. Designers can continue to iterate on their layouts, working with users to improve usability and exporting design elements as C# markup. This alone should speed up development, as it lets designers work in their preferred tools, exporting control updates with the appropriate markup automatically using Uno’s Figma plug-in. With the MVUX pattern increasing developer productivity, there’s a lot of value in bringing these two ways of working together.

This is key to a sketch-based development model. A designer can put together an outline layout and basic controls, export via the Uno plug-in, and a developer can add model and view code to the application. While code is refined and tested, new versions of the layout and controls can be exported, ready for use. If control functionality and naming don’t change between updates, new builds will compile, or developers can use their C# development environment to quickly update C# markup for new references.

It’s interesting to see Uno pushing .NET development forward at the same time as delivering an alternative to MAUI for cross-platform user experiences. MVUX looks to be an interesting alternative to MVVM, reducing code complexity and speeding up development. Coupling that with integration with designers’ preferred tools and C# markup to remove a development step, there’s a lot to like in Uno 5.0.

simon_bisson
Contributor

Author of InfoWorld's Enterprise Microsoft blog, Simon BIsson prefers to think of "career" as a verb rather than a noun, having worked in academic and telecoms research, as well as having been the CTO of a startup, running the technical side of UK Online (the first national ISP with content as well as connections), before moving into consultancy and technology strategy. He’s built plenty of large-scale web applications, designed architectures for multi-terabyte online image stores, implemented B2B information hubs, and come up with next generation mobile network architectures and knowledge management solutions. In between doing all that, he’s been a freelance journalist since the early days of the web and writes about everything from enterprise architecture down to gadgets.

More from this author