Publishing this several months after I wrote it - the issues were eventually addressed and I managed to unblock myself.
Tuesday, March 25, 2025
Monday, March 24, 2025
Four views of XAML development
Having spoken with hundreds of developers about XAML development, they almost all fall into one of three groups:
- They've been using it for a long time (many years) and have grown happy with how it is. They can be productive and aren't interested in change.
- People who don't like it and have decided to use something else instead.
- People who begrudgingly use it, moan about some of its "quirks", and don't feel as productive as they would like to be.
If you're in either of the first two groups, that's great. Use what works for you. Be productive, build great software, and enjoy your life. The rest of this post is not for you.
Group three is by far the biggest group. At a[n educated] guess, I'd say it's easily more than 90%.
I count myself in a 4th group. (Not just because I'm "special".)
I use XAML, but what I write doesn't look like the XAML that I see online, in demos, samples, and other people's codebases. The code I write is a lot shorter, clearer, and easier to maintain.
Part of what makes this possible are the tools I've created to help me. (Considering the challenges they face, that so few others do this, surprises me.)
But tooling has only gotten me so far.
Another language may be more beneficial.
But not one that requires a rewrite. Something that works with my existing code and also helps with new files.
Something that can enable experimentation without the risk of being stuck with code in an unsupported language and so can't be tried/used in "real" projects.
It sounds almost too good to be true.
Sunday, March 23, 2025
Why do I care about XAML if I have such seemingly lofty software development goals?
Wanting to improve things for many people using software by providing better tools for developers may seem at odds with my focus on XAML. Afterall, XAML is a relatively small language only used for making native (mobile and desktop) apps by people building with .NET.
If I wanted to really make a big impact, why not look to do something online? or with AI?
Yes, more people use web-based technologies than use XAML.
Yes, AI has the potential to make a massive change.
However, many people are focused on these areas, and I don't want to get distracted by something new and uncertain.
I know XAML and its related technologies very well.
Very few other people are working to make working with it any better/easier.
It may not be a big niche, but it's overlooked by most, so I can (hopefully) make a big (relatively) difference with my efforts.
The people who use desktop and mobile apps deserve the best software, just as much as those using the web.
The developers who build and maintain that software also deserve the best tools.
There's also a lot of such software already in existence.
Software becomes old because it continues to be valuable to a business. If it wasn't, it would be scraped or replaced. That so much of this software is around highlights its value and importance.
Rewriting old software isn't always practical, but it still needs to be updated and maintained. Making that easier (faster and with fewer risks of unexpected consequences to changes) can be a big win.
For companies with a lot of existing software, being able to use the existing skills and knowledge in new software is very appealing. Building new apps faster and in ways to avoid future maintenance fears is another big win.
Secretly (I'll tell you because I like you), focusing on this area is fairly low risk.
I'm demonstrating an understanding of businesses and how programming languages are used within them. I also hope I'm showing an understanding of developer wants and needs and my ability to create sophisticated solutions to meet those challenges.
Even if all XAML development went away or I had an opportunity to work on something very different, I'm confident I'm building (and demonstrating) useful skills for the future.
Software development as "creative problem solving" - and me.
The following is inspired by multiple interviews with actors and comedians. - Yes, I find software development inspiration in unusual places.
A motivated person who wants to make it in the 'arts' will typically have to do many things by and for themselves.
This means being a creative problem solver.
Want to put on a show but don't have a stage, set, or costumes? - Work something out!
Want to make a film but only have a tiny budget? - Get creative!
Want to try something entirely new and different that no one has thought about before and that everyone says is impossible? - Find a solution! Help others see your vision!
These are also the aspects of software development that I love best.
While software can do "anything", such a broad set of options is rarely helpful. Constraints are real, and they drive innovation and creativity. The constraints often lead to discovering that something isn't as impossible as originally thought.
There may be a need for people to build software that is the same as (or a tiny deviation from) what already exists, but I don't want to do that.
Not because it's beneath me but because it doesn't excite me.
I've previously particularly enjoyed projects along the lines of:
"We need it to do X but can't use [the only way anyone has ever done X before]."
or
"We only have 5 weeks to build [seemingly large and complex series of connected software], or we miss out on a massive opportunity for the business."
or
"We want it to do Y, but as no one has ever done that, we don't know if it's possible and can't (yet) see how to do it."
There are two ways such projects can be even more satisfying (to me):
- When I get to see and hear how the created solution helps people and improves their lives. Even if only in a small way.
- When I'm creating something that helps improve things for other software developers. This is because improvements for them are multiplied into more, higher quality software that is beneficial (or even "just" less frustrating) to many more people.
This is, possibly, why I've recently refound an enthusiasm for the possibilities that come from creating software.
2024 wasn't a great year for me. I left what was initially a very exciting project as a team was formed around the work I'd started. As I felt the project moving backwards, it became frustrating and unproductive, and so I stepped away, wondering if this was even an industry I wanted to stay in.
Side note. Many months later, a simpler version of the project was launched, which received much acclaim and positive reactions. Hopefully it will go on to be very helpful to a lot of developers, but I can't talk about it in any detail.
I planned to take some time off and reassess my career plans.
That's not how it played out, as I sustained a physical injury that meant I had six months where all I could do was sit (literally) and watch the world (and work) go by.
It was like a miniature version of the COVID-19 lockdowns, but just for me.
Upcoming plans were cancelled. These included career goals, planned jobs, and events I'd been looking forward to for months (and even years in one case.) It was not a happy time.
At the start of 2025, when once again mobile and recovering well, I determined to forget the past year and try and find not only paid work (because bills don't stop when people do) but something that would excite me again. A way to use my creative problem-solving skills that could help other developers improve the overall quality levels of the software in the world.
As my experience is with native (rather than web) technologies and because I've spent a lot of time over the last few years thinking about how it can be easier and more productive to work with XAML, I've been thinking about that once again. As I refine what I would have previously thought was "too big an idea for me", I also look forward to sharing more about that soon.
Job titles in tech compared with other collaborative work in creative industries
Ok, that sounds like a boring and almost academic title, but this is about how filmmaking, food, and events can help me think about creating software.
Look at all the names that are displayed in the credits at the end of a movie.
So many names, each with a specific title, and each title implying a specific set of tasks. Those tasks may each require a specific set of skills, talents, and abilities.
It's not just a random assortment of names under a general title such as "team" (or "organized by").
Those titles aren't just labels or descriptions; they are also signals to others working in the production.
They also serve as a way to clearly communicate with people outside the group. This includes customers, partners, contractors, people they are doing business with, and the wider industry (including potential future employers and collaborators).
The roles/titles all have defined meanings, even if they're unclear to people outside the industry. (Do you know what a "key grip", "best boy", or "2nd Assistant Director" is or does?) Despite the different titles in the credits, these people may also call themselves 'filmmakers'. Even if they're not the director or doing everything themselves, they are still contributing a vital part to the process.
Or consider a large professional kitchen. Again, everyone has very specific roles that may also require particular skills or knowledge.
But during service, everyone in the kitchen is a 'chef' and is called that. Sometimes, this also includes front-of-house staff while in the kitchen.
The shared title is a mark of respect and acknowledges the need to collaborate and the values that different people bring. This is especially true when only one person is the public face of the work that took many.
Then there's the software industry.
Every company seems to have their own job titles with their own meanings. These may or may not bear any resemblance to the use of the same title by another organization.
Software "teams" are notorious for being highly separate and communicating poorly with the broader organization. There's also rarely a shared, collective responsibility that cuts across teams.
Many people working in software creation are also dismissive of people in other roles. "Oh, they're just in the [department or team name]." Or, "They're just a [job title]."
These are the thoughts and impressions I have gained throughout my career.
I'm sure it's not everyone, but I hope it improves.
I enjoy working on solo projects, but I also like the idea of once again working on a large, cross-discipline team to help create great software.
Here's to hoping I find that soon.
Friday, March 21, 2025
The state (& future?) of XAML - A summary of a summary
Last week I gave a talk to a room full of .NET MAUI developers about "Rethinking UI Code".
The talks at the conference weren't recorded so I wrote up some of the key details for anyone not there but interested.
That write-up became quite long, so here's the very short version (because I know you're busy):
- Everyone agrees that XAML has issues but loads of people still use it anyway.
- There are ways to make XAML much nicer to work with, but few realize this.
- Many of these improvements can be made by treating XAML like you would any other programming language.
- C# probably isn't the solution you want unless you want to rewrite everything you already have.
- I have lots of tools that can generate code and make XAML easier to work with.
- I've created a prototype of a language (I'm currently calling ENAMEL) that produces XAML and so sits on top of existing tools and toolchains. This language helps address many criticisms of working with XAML.
- I've done this as a way to encourage further discussion about what's possible and what the future might hold. (Not because I have answers. But because I have lots and lots of questions.)
Now that you're intrigued, you can go and read the full version here or as a series on LinkedIn.
My talk at MAUI Day in London
For most developers working with MAUI (or WPF, or WinUI, or UWP?), creating the UI means using XAML. I've probably spent more time thinking about how this could be better than anyone--not a boast, and I wish this wasn't the case--so it was a privilege to share my thoughts with an audience who uses this technology every day.
Yes, I included multiple Taylor Swift references in my slides. What of it? |
- Maybe the solutions are so obvious to everyone else that it doesn't even need saying. But, if that's the case, why does everyone: complain, write objectively bad (I said "poopy" in my talk) code, and write code that looks like it could have been written 18+ years ago?
- Maybe the complaints aren't real; people just like complaining, and XAML got the short straw when it came to choosing what everyone should moan about. But that can't be the case, as it is objectively bad.
- Maybe what I see as bad is "good enough" for everyone else. But if that's the case, why all the complaints?
- The books from that time are still mostly relevant.
- The examples from that time are still mostly relevant.
- The way it is taught has not changed since that time.
- Why are you using it?
- What are the alternatives?
- Are there ways it can be used that address some of the problems?
- What other decisions have you made with the same justification?
- Why is this acceptable?
- Most UIs defined in C# (all examples I've seen) adopt the same structures, patterns, and mistakes seen in XAML files. The code is basically the same as the equivalent XAML. Just because it's a different syntax, doesn't make it better.
- Claims of a "fluent interface" are exaggerated due to the use of method chaining for some functionality. In reality, the need to combine setting some properties directly, setting some properties via chained methods with the property name, setting some properties via a chained method with a different name, and having to rely on massively overloaded fallbacks for some functionality means you can only really be fluent if you're very familiar with all the options and which to use when.
- That C# is "easier" and has "helpers" available ignores the fact that XAML can be written to be "easier" to read and helpers can be created to work with it too.
- Claims that the use of C# creates a faster application than using XAML, ignores the benefits, of using compiled XAML. More importantly, the performance of code is often down to the way it's written and used, rather than an underlying benefit. I've not seen these performance claims backed up with real data to show the benefit, and people arguing this position don't seem as concerned with optimizing every aspect of their code for performance. If performance is a problem or is critical to an application, then, of course, you should do what's necessary to produce software that performs adequately. If you claim to make a decision for performance reasons but don't measure performance or optimize for performance consistently, I don't consider it a good argument.
- That C# needs to use fewer "magic strings" ignores that there are ways to remove the need to use any kind of "magic value" in most XAML scenarios and that most C# code (including demos and reference examples) is littered with "magic numbers".
- One argument for using XAML is that it encourages the separation of logic from presentation code. Though it's possible to maintain this separation when using C# for everything, it can lead to more complex code, and the effort required to separate things means it is rarely done.
- Even if everyone did decide to switch to using C#, does that mean they need to rewrite all their existing XAML? Would that be the best use of people's time? Would everyone be able to do this confidently because they have good UI test coverage and so could avoid introducing any unintended changes while doing the rewrite? - No!
- And if using a single language for everything is so great and such a wonderful solution, why don't we see this elsewhere on other platforms and with other technologies? For the people switching to Blazor because they don't like XAML, they still use HTML and C#. Why is almost all web development done with at least three languages (HTML, JS, & CSS)?
- Easy to write
- Easy to read (and understand)
- Consistent
- Well formatted
- Unambiguous
- As concise as possible without inhibiting understanding
- Without unnecessary duplication or redundancy
- [Only] include useful, relevant comments.
- Order content within the file so that it matches the order of items being output.
- Structure the use of files within directories in a consistent manner.
- Avoid miscellaneous files that become a "dumping ground" for assorted functionality.
- Follow the Single Responsibility Principle. Give elements in the XAML a single task and, therefore, a single reason to need changing.
- Simplify layout structures within files.
- Avoid using unnecessary elements.
- Avoid setting redundant or duplicate property values.
- Avoid specifying properties with their default values (unless there's a good reason and you add an appropriate comment to explain it to people looking at the code in the future .)
- Don't repeatedly define the same values/items.
- Make use of language features.
- Use inheritance where appropriate.
- Don't use "magic strings"
- Don't use "magic numbers"
- Encapsulated repeated logic.
- Use language features (such as a custom MarkupExtension) to show relationships between values and make those relationships clearer.
- Avoid repetition of text. (So you only need to change it once, in one place.)
- Use semantically meaningful names that show where and when to use something. (Not what it does or looks like.)
- Don't use variations of "Hungarian Notation" when naming UI elements or resources.
- Use inheritance to simplify code. (There are tools that can help with this.)
- Create new types that combine existing ones that are repeatedly used together.
- Create new controls to isolate stand-alone pieces of logic.
This code produces the screen in the screenshot. |
Yes, this produces the same as the above, shown in the inset screenshot. |
3 ways of triggering an event or command when a button is tapped. |
2 ways of triggering a command when the button is "Clicked" |
Again, both code snippets produce the same UI. |
Isn't it nice when there are fewer words needed and those words are all necessary and helpful! |
Some people complain about the inclusion of XML namespace aliases, I prefer to use them in ways that provide clarity. |
Two ways of creating a horizontal gradient. One with 7 lines of code, the other with only 1. Yes, both code snippets produce the same output (as seen in the top right) |
- Which version of .NET to use (You should be using .NET 9 for your MAUI apps!)
- Whether you want to use XAML+MVVM, XAML+CodeBehind, or C# to create your UI
- If you want to use the Shell, and what sort of navigation style (tabs or flyouts) to use
- How many pages you want in the app, what they should be called, and what (if any) default content they should include
- What features, functionality, libraries, and dependencies should also be included in the app
These new options can be a massive time saver |
![]() |
See how quickly a page can be filled with useful, appropriate XAML |
- A bool called IsRefreshing becomes bound to an ActivityIndicator.
- An ObservableCollection<T> produces a CollectionView and the DataTemplate includes entries for each of the properties for the Type.
- Commands cause buttons to be added to the XAML to trigger the invocation of the command.
- etc...
![]() |
No steps were removed. It really is this fast |
![]() |
Not that I want to be comparable to Thanos in other ways |
- It would need to be able to work with existing XAML (& C#?) to avoid the need to rewrite all that already exists.
- Many people would still assume the need to rewrite in the new option as the other option(s) would (eventually) go away.
- Assuming that the new language also came from Microsoft, the number of things they need to support and maintain would be increased (they'd need to ensure all pre-existing things continue to work) and this extra requirement would slow down development/advancement in other areas.
- What about all (sigh) the tools that already exist? Would they need replacing or updating?
- It would require thorough documentation (which takes time and effort).
- All the SEO goodness of existing docs, blogs, etc. would make it hard to find appropriate, up-to-date information about whatever is new.
- Developing a new language is hard to get right.
- Developing all the required integrations with developer pipelines and other tooling (there's more to MAUI than just XAML) is complex and would be a lot of effort.
![]() |
Is this too much Marvel? |
The output XAML (& C#) can then be used just like the files you have and write today.
- By having a new language that can produce XAML (& C#) files that are used as the project system and developer tools currently expect, there isn't the time and effort needed to change what already exists. We can experiment and iterate faster on possible alternative solutions.
- By producing files that are valid even if the experimental language goes away or you decide not to use it, there is little risk. You still have working code, and you're not stuck with something that needs to be rewritten in a way you can support and maintain going forward.
- As it works on top of existing files, it can be used in whole or part within a project or a team. Just start using it for the files (pages/controls/dictionaries) that you want. It's entirely optional.
- By treating XAML as acceptable input, it's also really easy to try it out. Just copy the existing XAML into the new file and start modifying it there. You can progressively switch to the new, simplified syntax and make use of new functionality a bit at a time. If there's anything that can't be done with the new language (or you don't know how) simply fall back to doing it with XAML.
- By generating code at design time, it's possible to do things that hand-written XAML can't.
- Low effort
- Low risk
- Big improvement
![]() |
An ENAMEL (.enml) file in use inside Visual Studio |
- On the left is an .enml file in an editor window.
- In the middle is the .xaml file produced from the ENAMEL.
- On the right is a design-time "pre-visualization" of what the page will [approximately] look like.
- A property (highlighted in pink) is uncommented in the ENAMEL and the file saved.
- This causes the XAML to be updated (yellow highlight) and that property added.
- This change is also reflected in the "pre-visualization" of the XAML.
And, that then gets turned into XAML and used when compiling your app?
- How can we make existing and future XAML easier to work with?
- If it's another language, what should it be like?
- If not another language, then what?
- In an ideal world, there's someone in need of my development skills and an interest in these tools so that I can continue to develop them in ways that become beneficial to that company/project(s) and the wider community.
- Or maybe there's a company I can help build some software and this will leave me to continue developing these things in my own time.
- Or, maybe there's a company somewhere that has seen my creativity, skills, and way of thinking, and has an opportunity for me to discover entirely new things to work on. (And I find that so exciting I forget all about XAML and someone else can lead the charge to make things better.)
Wednesday, March 19, 2025
Why did you need to change 8 files to add one checkbox?
- The file where the UI is defined.
- The file where the new setting is persisted.
- The interface (or header) file for the service/class that handles setting persistence.
- The file with the test abstraction for the settings interface.
- The place(s) where the new setting has an impact on code logic.
- Any modifications to existing tests that are impacted by the new setting/behavior.
- New tests for the new behavior.
- All files with localized resources for the label shown next to the new checkbox.
- Any screenshots of the UI that are now different (because of the added checkbox)
- [User] Documentation that explains the new setting/checkbox.
Why build a native app?
Today, more code runs on the web, and more developers write code that runs on the web than in traditional or native apps. This still isn't all software, and there are many reasons not to build for the web or use web technologies.
The most obvious reason to not build an application with web-focused technologies is because the devices the software will run on are not, or are rarely, connected to the internet. If you feel as though you are always connected and often by multiple devices, it can be hard to remember that this isn't always the case for everyone. This can also be due to circumstances (like location) or done deliberately for security reasons.
Even when internet connectivity is not an issue, some features are unavailable outside of native apps. This includes access to specific APIs or integration directly with the OS and other applications.
Some accessibility-related features of the OS are only accessible (ironically) to native apps and so are unavailable if using web technologies or must be recreated within the app.
Matching the native look and feel of the OS can more easily be achieved through the use of tools, frameworks, and languages that were created to integrate with the native UX of an OS.
Higher levels of code performance can also be achieved when not using the abstractions added by using multiple technologies. This is a debateable argument as it more comes down to how you use individual technologies rather than the technology themselves. It's possible to build apps that perform well or badly with most technologies. Being able to get closer to the silicon (with fewer layers of abstraction/framework/conversion) usually makes the possibility of better performance easier.
When there's seemingly an app available for everything on mobile devices, it may seem unnecessary to build an application specifically targeting more traditional computing devices. Even when apps can be built to run on varying devices and adjust accordingly, there's still a need to consider each device type differently. The creation and consumption of content required or provided by different apps can be better suited to the different capabilities and form factors of a PC, laptop, tablet, phone, or other device.
Beyond the device and required capabilities of an application, you may also need to consider your existing skill set and any other apps you already have. If an organization already has multiple existing native apps that they support and maintain, adding a new app built with a different technology and requiring a different set of skills and knowledge can be a considerable risk to the organization. Training staff and maintaining a suite of apps built with a mixture of technologies can require a lot more work and, therefore, cost. This isn't to say that these reasons should be the deciding factor in what you build.
Many developers can't imagine building anything other than a web based solution. That lack of imagination and inability to consider scenarios other than what they do every day, probably isn't a great trait to have though.
Once you've decided to build a native app (or accepted that some people need to), there's the question of how to build that app...
Everybody "needs" to be capturing emails
It's a sentiment I hear a lot. Maybe due to the people I talk to and the podcasts I listen to.
I get why it can be important to capture emails for promotion but as I don't yet have anything to sell you (other than myself--BTW, I'm currently available for work) do I really need this? Maybe I should as it may come in useful one day.
I recently got locked out of the service I previously used to capture emails and that has made me rethink this topic.
It doesn't feel like it's in anyone's best interest for this site to have a pop-up asking for your email but I probably should have a simple way of letting people provide this if interested. SO, now there's a page linked in the header and no pop up. You're welcome.
While I've nothing to sell you today, hopefully I'll have another book finished later this year and my mailing list will be first to hear about that.
If you might be interested, click here or on the link above to join.
Tuesday, March 18, 2025
Variations on "the boy scout rule" in coding
- Make improvements as part of every change.
- Leave it (the code) as you'd like to find it.
- Leave the code a little better than you found it.
Maintainable software requires these three things
- For there to be (documented) knowledge of everything the software does (and doesn't/shouldn't) do.
- For there to be a simple way of verifying the software behaves as intended.
- For it to be written in a way that makes it clear to a person looking at the code what it does, so it avoids any unintentional side effects when changed.
"As an architect, part of my job is to improve the way we do things"
I was recently listening to a podcast and was struck when the interviewee (a "senior software architect" at a large company) confidently stated that:
"As an architect, part of my job is to improve the way we do things."
Two things jumped out at me about this statement and the way it was made:
- It implied that other people at the company don't look for ways to improve things.
- It implied that other people at the company aren't allowed to suggest improvements.
I find this concerning.
I consider it everybody's job to always be on the lookout for ways to improve things.
Not that people should be spending a lot of dedicated time focusing on looking at and evaluating alternatives, but that everyone should have an awareness of challenges and opportunities for improvement and should share these when appropriate.
Many years ago, after the weekly developer team meeting at a company I was about to leave, someone else on the team asked why I had suggested a change to a process in that I'd be leaving in a few days.
I made the suggestion because it would be better for everyone working there. Even if that only included me for a few more days.
That other person was happy to be told what to do and then do it. No questions asked.
I don't want to work like that (and probably wouldn't last that long in such an environment.)
Monday, March 17, 2025
Why UI code matters
- Client/frontend
- Headless/backend
- Embedded
I like that they make software easier to use because I can see things and don't have to remember as many options, commands, or a set of seemingly magic words to get the software to do what I want.