Skip to content

Instantly share code, notes, and snippets.

View SuperJMN's full-sized avatar
💭
Always dealing with compilers, DDD, Clean Code and cross-platform stuff

José Manuel Nieto SuperJMN

💭
Always dealing with compilers, DDD, Clean Code and cross-platform stuff
View GitHub Profile
@SuperJMN
SuperJMN / mvvm.md
Last active July 13, 2022 13:19
MVVM framework replacement

MVVM framework replacement

Goal

We want to replace ReactiveUI by another MVVM toolkit. The candidate for such move is the library called CommunityToolkit.Mvvm AKA Microsoft.Toolkit.Mvvm. This text will use “CTM” for short.

Evaluation

The library has been evaluated, focusing on features that can be useful for Wasabi Wallet.

Features

void Main()
{
var result = ReadUser("JMN")
.Map(u => FindProduct(u))
.Map(p => ReadTechnicalDetails(p))
.Map(pd => View(pd))
.Handle(response => ErrorView(response));
Console.WriteLine(result);
}

Why is the .NET community so disperse, unwelcoming, unfocused and decreasing?

  1. .NET doesn't have a real community: there's no sense of belonging to a community. There are more or less big clusters, usually attached to particular projects.
  2. Microsoft usually acts like a competitor instead of a facilitator.
    • You can't try to do better than Microsoft. Whenever a project is doing some real good job in an area in which Microsoft has already placed its bet, you'll not only be ignored, but also repudiated by a big bunch of microsofties. You'll be on your own.
    • Eventually, if a community project looks like a winner and is getting momentum, Microsoft will try to catch up and make up for lost time creating an enemy product (usually inferior) in an attempt to undermine it.
  3. .NET fails to get to the young people. Why? because beginners usually start doing front-end, and front-end isn't .NET:
  • Front-end catches young people because it's visual and looks "easier" to get fancy resu

Compile-time issues

Problem 1

error CS0260: Missing partial modifier on declaration of type 'ActualSizePropertyProxy'; another partial declaration of this type exists

All classes inheriting from UIElement must have the partial modifier. This is because of the NativeCtorGenerator This is present to avoid random crashes caused by iOS/Android internal behavior

Problem 2

warning NU1701: Package 'CommonServiceLocator 1.3.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

public class UefiDownload : IDeploymentTask
{
private readonly IGitHubDownloader downloader;
private readonly IFileSystemOperations operations;
public UefiDownload(IGitHubDownloader downloader, IFileSystemOperations operations)
{
this.downloader = downloader;
this.operations = operations;
}
@SuperJMN
SuperJMN / KeyTrigger.cs
Created May 5, 2017 11:01
A Trigger that executes Actions when a KeyDown event occurs.
using System;
using System.Reactive.Linq;
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Input;
using Microsoft.Xaml.Interactivity;
namespace App2
{
public class KeyTrigger : Trigger
@SuperJMN
SuperJMN / PdfViewer.xaml.cs
Created March 13, 2017 12:06
UWP useful fragments
using System;
using System.Collections.Generic;
using Windows.UI.Xaml;
namespace IbercajaPay.UWP.Controls
{
using System.Collections.ObjectModel;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Windows.Data.Pdf;
@SuperJMN
SuperJMN / Specification.txt
Last active January 16, 2017 21:57
Tree-building language
* The language will represent a tree. Each node can have zero or more children.
It will look like this text (tabs matter):
Root
A
B
C
D
E
F
@SuperJMN
SuperJMN / Viewbox.cs
Last active October 1, 2018 08:26
AvaloniaUI's Viewbox
using Avalonia;
using Avalonia.Controls;
using Avalonia.Media;
using static System.Math;
public class Viewbox : Decorator
{
private IControl Root => Child;
protected override Size MeasureOverride(Size constraint)
namespace Mcd
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine (Calculo.Mcd(75, 100));
}
}