Practicing Data Structures and Algorithms in Rust: My Experience, and a Text Editor Built in just 6 hours
Practicing DSA in Rust: My Experience, and a Vim-Like Rust Text Editor Built in just 6 Hours for a Hackathon
Introduction
Practicing data structures and algorithms (DSA) is a common requirement for tech professionals, but it can become tedious after a while. However, trying out different languages can make the learning process more exciting.
This was my experience when I tried practicing DSA in Rust, and it made the learning process fun and engaging again. In this article, I will share my experience of practicing DSA in Rust and how it led me to build a Vim-like text editor in just six hours during a Rust Hackathon.
Why Rust for DSA?
I was bored of practicing DSA and Rust brought the fun back.
- 😤 I hated practising DSA: It felt like I was replicating things that have already been done before and done better. Rust made it feel fresh again.
- 🏔 The Challenge: It was far more challenging to implement things like trees and algorithms in Rust, and it made me feel like I was learning things I actually was interested in, like how things move in memory.
- ⚙️ It was far harder to find solutions to common problems in Rust: Not many people use Rust, hence it incentivised me to think of solutions on my own a lot more
- 🚀🚀🚀 THE SHEER OVERPOWEREDNESS OF RUST SOLUTIONS: The same solutions written in Rust completely outclass the solutions in most other languages. Although you are only supposed to compare your solution with other solutions in the same language, it was still wild to see.
Anyway, you all just got click-baited. This post is not about Data Structures and Algorithms. I recently participated in a talk about Open Source and Rust, and participated in a Rust Hackathon after that.
Building a Vim-like Text Editor in Rust
With my only previous experience in Rust being solving Leetcode problems, I decided to take on the challenge of building a Vim-like text editor in Rust.
In just around six hours, and with my only previous experience in Rust being solving Leetcode problems with it, I completed building the thing, and won the Hackathon.
Features of the Text Editor
- 📝 Text Writing, Scrolling, Word Wrap, Clipboard reading and other typical features you would expect from a Text Editor.
- 📺 A Complete Text User Interface with Logs, User-Friendly Help Menu with Keyboard Shortcuts.
- 📚 Creating, Opening, Saving and Managing Multiple files just like any modern text editor.
Limitations
At the time of writing this, it is still a product of a hackathon and contains flaws like:
- It has virtually no optimisation and has potential bugs.
- It can only open files when you copy the path to the files in your clipboard and hit the relevant shortcut. There is no intuitive File Opener system.
- It is full of code that works, but is not organised too well.
- The UI could probably be improved
I am happy to announce that this project fully Open Source now, so feel free to contribute to it yourself and fix these, if you want to practically learn Rust yourself
Result of the Experience:
Regardless of the flaws of the project, I still won the Hackathon. The experience got me:
- A free Mug, a book and a T-Shirt.
- 🎊🎉🎊🎉 🎊 ANOTHER JOB OFFER
- All the learning and confidence that I could need to solve any problem, any time.
The experience showed me that Rust is a powerful language, and building real-world applications in Rust can be both fun and rewarding. Rust is not just a language for DSA or systems programming; it has a vibrant and growing community that is excited about building new things in Rust.
Conclusion
- Practicing DSA in Rust can be a fun and engaging experience. It challenges you to think in new ways and offers the potential for overpowered solutions.
- Building a Vim-like text editor in Rust during a Hackathon was a great way to learn more about the language and its capabilities.
- While my text editor still has flaws, the experience of building it gave me a job offer and showed me that Rust has the potential to be a game-changer in the tech industry.
Source Code on GitHub
#opensource #rust #rustlang #hackathon #vim #software