Probably my favorite thing about programming is making a program better. It is a process of constant improvement. Getting a new program to work for the first time is exciting, but perhaps even more fun is sharing more code within a program.
Recently I had two features in a program, and they both had the same basic concept behind them—generate output files from source files. I realized that the two features could share a lot of the underlying infrastructure. Code reuse has many benefits in programming:
As for my program, by rewriting one feature to use existing code from another, I reduced code size from 1000 to 300 lines of Rust code. Having to maintain code is not necessarily a bad thing, but having less to maintain is easier.
The images on Dot Net Perls have been part of its success over the years. Images bring light and color to otherwise boring blocks of text. Unfortunately images require many times more bytes than text. With JPEG, PNG, and WebP we can compress these images.
I have found WebP to deliver a good compression ratio, good visual output, and to be easy to use a developer. In a Rust program, encoding to WebP can be done with some popular crates. The encoding happens entirely within the same process, and is very fast.
WebP has several advantages over other image formats like JPEG:
A problem with WebP is that its library is written in not written in a safe programming language. If it was written in Rust (or something similar) we would have fewer security problems. But overall, WebP has been beneficial to web sites that use it.
Every programmer uses some kind of text editor. This means the editor can make a big difference to the experience of programming—it can make it easier or more frustrating. Over the past several months I have tested the Zed editor, a new Rust-based editor that uses the GPU for rendering performance.
Zed starts up quickly, and it supports the features I need to write code. When scrolling through files, its rendering performance (which is run on the GPU) is apparent. When compared to Visual Studio Code, Zed is notably faster for these tasks.
It has many features that help make a programmer's life easier:
Overall, I have enjoyed using Zed editor. I sometimes dream of a world where all software is written in Rust (or a similar language) and has graphics acceleration. Even with just a text editor, Zed's improvements to typical software are evident. I imagine we will hear more about this program as it becomes more widely-known.
Here at Dot Net Perls I use a Rust program to generate all the site as static files. This means it is super fast to serve up when someone wants to view a page. But it means all the work involved in developing the site is done in a 7000-line Rust program.
When working with Rust, I often end up fixing a lot of compile-time errors. This is one of the key benefits of Rust: problems are found earlier, before the program ever compiles. Here are some related benefits to getting compile-time errors:
When the Rust compiler tells you to add a clone call or to a reference a variable, it gives syntax suggestions as well. So it makes the developer feel smart because he or she is fixing all these bugs one after one. I guess an ego boost is helpful once in a while.
It is time for a new feature on Dot Net Perls. For many years I have focused on writing technical articles about popular programming languages. Many of these articles are still useful, but others have lost some relevance with time. And I have decided a more personal touch may be of more value now than ever before.
In the last couple years, LLMs like ChatGPT have become widely used, and people are using them for technical content. It is unclear whether the existing articles here will be able to compete. But what cannot be replicated with LLMs is a personal touch. I hope to write a positive blog about the craftsmanship of programming—not just to promote my existing articles, but to try out something entirely new as well.
Some ideas I have include:
I feel strongly the vibe of the blog should be positive, so I want to avoid ranting about things that might be upsetting to me or others. The craftsmanship of programming should be something uplifting, not negative. I will do my best to keep things worth reading as well. As far as LLMs go, I will not be using any text generated by machines—if it wasn't worth writing for a human, why should a human be expected to read it? Each article should contain a picture of some sort, just for visual effect.