this post was submitted on 17 Sep 2023
48 points (100.0% liked)

Programming

13376 readers
1 users here now

All things programming and coding related. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 2 years ago
MODERATORS
 

I would like to know what your hoppy coding project are. It doesn’t really have to serve a purpose, but what are you coding on in your free time that just is fun to you and you enjoy working on?

As a background: I am an experienced programmer and do earn my money with it. In my free time I always enjoyed trying out new stuff related to technology, learn new things and improve my skills by doing so. But lately I recognise that I just have no clue what I should do or what a fun toy project I could work on. I really have no ideas. My head just feels completely empty whenever I open my IDE.

So please, tell me what you are coding on for fun.

you are viewing a single comment's thread
view the rest of the comments
[–] Knusper@feddit.de 1 points 1 year ago (6 children)

Current main side project is a web music player, using WASM for the UI, because everything else is no fun.

I also have an own, tiny OS automation framework that I've been meaning to continue dicking around with.

Then I've got a minimalistic note-taking helper program. (My note system is just a bunch of loose text files, and that program helps create those files according to a scheme and allows me to search them.)

Planned projects, requiring larger and larger levels of megalomania:

  • A musical keyboard application, where I can type on my normal keyboard and it'll play like a piano. Potentially integrating LV2/VST plugins in future.
  • A physics-based game, integrating concepts from general relativity and quantum physics and such. Kind of to help (me) visualize these concepts better.
  • An own Git forge, with ForgeFed integration, WASM UI etc..
[–] REDS1736@lemmy.sdf.org 1 points 1 year ago (1 children)

Why do you prefer WASM over JavaScript (which is suppose is your alternative for the UI work)? I build a lot of web stuff but haven't tried WASM yet.

[–] Knusper@feddit.de 2 points 1 year ago (1 children)

Well, I'm mostly a backend dev, so my favorite part is that I don't have to write JavaScript. 🙃

You might be more adept at navigating it, but that language is just a minefield of unexpected behaviour and has a massive, complex ecosystem.

I'm using Rust to compile to WASM (has the most mature tooling for that, as far as I'm aware) with Leptos as the UI framework.

You write your HTML and CSS like normal, but JS is replaced with Rust code.

And well, one big advantage is that since my backend is in Rust, too, I can use the exact same models, constants etc. in backend and frontend. If they drift apart, that's a compile error.
(You do get this advantage, too, if you use NodeJS for the backend.)

But aside from me not liking JavaScript, there's lots of little things that make Rust a pleasure to use here.
Rust's sum types (Option, Result etc.) match really nicely with the infos you need for crafting a UI. Like, just yesterday I simply wanted to load a list of songs (Vec) and thought, I'll do the error handling later, but Rust's paradigms still eventually left me with a Result, Error> (contains either the song list or an error message).

At that point, I could have still just told it explode, if there's an error, but then I realized, oh yeah, if I can't load the list of songs, that Error is precisely what I want to show to the user.

And then you don't have to deal with horrid ternaries. Instead you get full pattern matching, so my UI code now looks roughly like this:

let song_list_result = load_song_list().await;

match song_list_result {
  Ok(song_list) => 
  Err(cause) => <span>{cause}</span>
}

I did leave out quite a bit of the boilerplate there, so this isn't valid code, but point is, it's a hundred times better than passing data and error in separate variables, separately checking, if they're non-null and never quite knowing what all the legal states are, since both could be intentionally null or uninitialized null or unintentionally null or both non-null. It's so much complexity that you just don't have.

And ultimately, yeah, I chose the word "fun" quite intentionally there. You get the cool parts of frontend, i.e. lots of visual feedback and something to show, while leaving out most of the downsides, i.e. fugly code.

There is, of course, different downsides to the WASM/Rust/Leptos stack, like it simply being a very new ecosystem. You can't yet pull in dozens of component libraries and so may have to build things more often yourself. And it isn't yet as tried-and-tested as some of the bigger frameworks, plus Leptos is still going through breaking changes.

So, yeah, maybe don't yet switch over everything at your dayjob, and of course, if you know Rust already, that's quite the advantage, but overall, I do quite recommend it and feel like it'll become a lot more relevant in the future.

[–] REDS1736@lemmy.sdf.org 2 points 1 year ago

Thanks for the elaborate reply! All my backend stuff is in Python (Django) but I think there is python WASM frontend stuff too so I think quite some of your insights might apply. Python is not quite as secure-by-design (secure as in I know for sure how my code behaves and where to expect exceptions) as rust but still better than JavaScript so I might look into that!

load more comments (4 replies)