.NET MAUI Community Toolkit
I was recently asked by @mattgoldman if I’d like to put together a post for https://twitter.com/hashtag/MAUIUIJuly. After struggling for some inspiration recently for posts I figured this is the perfect excuse opportunity to jump back into it.
For those of you living under a rock and aren’t quite sure what .NET MAUI is and why you want to use it. Lets start with what is .NET MAUI.
What is .NET MAUI Simply speaking MAUI stands for Multi-platform App UI.
Hardcoding. Have your cake and eat it
As a junior developer, one of the key principles that were drummed into me was that hardcoding values is a BAD thing (amongst many other principles). But then more often than not, the pressures of deadlines, project managers and product owners don’t afford us the luxury of building an engineered solution the first time around. So we revert to simply hardcoding just to keep everyone happy and deliver a feature. What no one ever mentions is that there are two ways to hardcode values: the RIGHT way and the WRONG way.
GetHashCode() the easy way
tl;dr Let Visual Studio generate your overrides for Equals() and GetHashCode() so you don’t need to remember the best practices.
Don’t roll your own GetHashCode() algorithm or even rely on StackOverflow, use the .net framework to work it out for you..
HashCode.Combine(Long, Lat, Altitude); Background When trying to check the equality of reference objects in c# we simply cannot apply the ‘==’ operator, as this will only compare memory locations and not data.
SignalR - Why? Because its easy
SignalR has been around for a few years now (since 2013), offering real-time notifications to our .Net applications.
RxJS refactor: BehaviourSubjects
In an earlier post I described how to leverage the power of RxJS and the combineLatest() and startWith() operators to tidy up my code. I have since updated the code on that page to reflect the new RxJS6 pipe operators.
Angular6 Runtime environment Variables
Out of the box, Angular provides a convenient method for setting environment variables for each our local dev environment and our production environment.
Ng directive Thought Experiment
Not long after publishing my recent post on minimising Async bindings in Angular by using the *ngIf=“obs$ | async as obs”; construct, I received the following comment on twitter:
Angular: arrrgh... too many async bindings
In my [previous post]({{ site.baseurl }}{% post_url 2018-03-26-rxjs-combinelatest-startwith %}) I came across a quirk with Angular, Observables and the Async pipe. That is, each subscription to an observable will initiate the observables execution. Hence we were calling the api once per async subscription.
A subscribe call is simply a way to start an “Observable execution” and deliver values or events to an Observer of that execution.http://reactivex.io Original version <p>{{ (result$ | async).
RxJS: Using CombineLatest() + StartWith() to remove code duplication
05 June 2018 Update: Follow up post with further refactoring.
01 June 2018 Update: Updated code to RxJS6.
Scenario In my Angular5 application I have a search results page that contains three components:
Text-based filters component Paged results list Pagination component After wiring up my code I ended up with something similar to below. This all worked fine, but as you can see it’s quite repetitive and not to mention hard to maintain.