From f74ddcc5c72ef77aa1377c49ebc68d49c7e3562f Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Mon, 4 Jul 2022 10:08:05 -0400 Subject: [PATCH] added conclusions --- src/blog/_posts/2022-07-02-fsharp-avalonia.markdown | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/blog/_posts/2022-07-02-fsharp-avalonia.markdown b/src/blog/_posts/2022-07-02-fsharp-avalonia.markdown index f1b5904..dfb7eb1 100644 --- a/src/blog/_posts/2022-07-02-fsharp-avalonia.markdown +++ b/src/blog/_posts/2022-07-02-fsharp-avalonia.markdown @@ -1,6 +1,7 @@ --- layout: post title: "My journey with Avalonia and F#" +date: 2022-07-02 15:18:37 -0500 published: true --- @@ -10,7 +11,7 @@ Back when I was in college (or university, whatever floats your boat), I made a There were some drawbacks to this application. For starters, it only worked on Windows (yes, I know, shocker). This happened because the underlying framework was Windows Presentation Foundation (or better known as WPF). Just running on Windows wasn't enough for me. While I was developing the application, I had to use an application called Parsec to develop and run the program on Windows. Even though I still use Parsec to this day, developing and running the application was kind of tedious. Several issues popped up as well, like the repository sorting functionality was broken. I'd go and sort from least to most stars for all of the repositories, and it would sort correctly, but viewing the detail on a particular repository would pick the repository four indexes behind the repository I'm actually trying to view. This happens with every sorting option in my app. -I had stated in the past I would proceed with some next steps. One next step was build the application in [Avalonia](http://avaloniaui.net/), a user interface toolkit that was similar to WPF, but vastly different. While WPF used a Windows-only drawing library to draw windows, buttons, labels, and lists, Avalonia used a drawing library called Skia (SkiaSharp to be exact). This means that Avalonia can not only draw on Windows platforms, Avalonia can draw on macOS and Linux platforms. As an added bonus, Avalonia can also draw on iOS, Android, and even WebAssembly. Another next step was trying interoperability with the application. Enter F#. +I had stated in the past I would proceed with some next steps. One next step was build the application in [Avalonia](http://avaloniaui.net/), a user interface toolkit that was similar to WPF, but vastly different. While WPF used a Windows-only drawing library to draw windows, buttons, labels, and lists, Avalonia used a drawing library called Skia (SkiaSharp to be exact). This means that Avalonia can not only draw on Windows platforms, Avalonia can draw on macOS and Linux platforms. Additionally, Avalonia can also draw on iOS, Android, and even to the web through WebAssembly. Another next step was trying interoperability with the application. Enter F#. Why F#? Well, it's part of the .NET framework, so I don't have to learn a whole different standard library/framework. In my Android class, I had to learn not only the Android libraries, but I also had to learn the Kotlin standard library as well (and a part of Java's standard library as well because some of Android's libraries are tied to it). For example, you call an `IEnumerable` or an `ObservableCollection` in F# just like you would in C#, which is really handy, especially when interoperability is concerned. Additionally, another next step was to mess with F#. I have never messed with F# before and I still kind of like C# still (sorry Dave) so I thought it would be nice to give F# a fighting chance (because you know a language nut). The last step was to port it over to .NET Core (which then it is now just .NET, not Core or Framework. Just .NET) to help with compatibility. @@ -40,7 +41,9 @@ The above example is a model for my feedback functionality inside the applicatio The `let` keywords are variables inside a type, kind of like `private` fields, which is what these variables serve as, or any kind of variable for that matter. The `mutable` keywords are for letting the variables change values. By default, F# has immutability, meaning that every variable won't change from underneath you unless explicitly defined with the `mutable` keyword. This concept is similar to Rust's immutability concept and it's `mut` keyword. The `member` keywords are for properties, and they can defined with getters and setters, like what's shown above. Don't worry, though, you don't have to add getters and setters. I had to write custom code for my backing fields. It took a while to find my ground when it came to what a property was, what a field was, and variable was. [This](https://stackoverflow.com/questions/24840948/when-should-i-use-let-member-val-and-member-this) was immensely helpful along my journey. Once I knew what was what, it wasn't too hard to figure out what I had to do, as far as storing the GitHub data is concerned. -Let's talk tooling. F# is great and all but I could not find any serialization tool out on the Internet. I'm not talking about `Newtonsoft.Json`, that's a great tool, but I'm talking about JSON files and transforming them into objects/types for you. It's similar to this website [here](https://json2csharp.com/). I had to write every source file by hand. Don't try it. I'm so irritated by this that I might have to write a tool to do just that. There's some other tools I would like as well, like a C# to F# converter, but I'd imagine that's quite the ambition to take that on. Since C# and F# are both .NET languages, it shouldn't be that hard, right? Right? All-in-all, I think F# is an alright language. There's still so much I have to learn from it, though. Maybe writing the serialization tool will help... +Let's talk tooling. F# is great and all but I could not find any serialization tool out on the Internet. I'm not talking about `Newtonsoft.Json`, that's a great tool, but I'm talking about JSON files and transforming them into objects/types for you. It's similar to this website [here](https://json2csharp.com/). I had to write every source file by hand. Don't try it. I'm so irritated by this that I might have to write a tool to do just that. There's some other tools I would like as well, like a C# to F# converter, but I'd imagine that's quite the ambition to take that on. Since C# and F# are both .NET languages, it shouldn't be that hard, right? Right? All-in-all, I think F# is an alright language. There's still so much I have to learn from it, though. Maybe writing the serialization tool will help. + +What about existing bugs that need to be ironed out? Well, since I don't know how the bugs even cropped up over the three week course of my developing craze, I will try my best to get rid of existing bugs in the future, as well as squashing new bugs that come my way. ---