Experimenting With Rust

First of all, I feel like just mentioning the word "Rust" could cause confusion. I always type as Rust Lang or The Rust Programming Language, whenever I had to mention it. But it seems rather, unnecessary. Atleast my domain name "decodedHTML.com" could be a clue pointing Rust in the right direction. :P

I finished The Rust Book. Now what? Tried building a simple REST API using Rocket, Diesel and Serde. Feels like I am missing a lot of steps. So had to build my own project.

My first official Rust project was a substitution cipher generator. It was taught in CS50 using the C language. I loved the cryptographic algorithm that, I recreated it in Rust. Link to Cipherio Repo. It is CLI application that just does one thing perfectly. Cipher a text!

Recently I tried building a accounting program. In this I started to build everything from scratch. (I know its a bad idea; to reinvent the wheel) But I haven't had much experience in systems programming. This could teach me a lot. After all I am understanding a lot. I am constantly referring my degree textbooks to understand different archetecture and practices. I even have my own personal resources goldmine, which I have bookmarked over the years (not that long though).

In this program I started by making a simple data structure to handle a user, then figured I need to store it in some long term memory, rather than the CPU memory for doing all the extensive tasks. So my first thought was to integrate a database into it. But I wanted to explore the beautiful capabilities of Rust. So right now built a json file to store the user dataset. By doing so, I just learned the steps required to read and write local files.

During my development I found out that I didn't feel confident in structuring my program. I'm jumping back and forth between the reference for packages, crates and modules in the Rust Book. There are main, lib and other modules. My current plan to structure the program goes like this. Create just the basic controls in main file. Create the widely used data structures and algorithms used by the program in lib. And create and group the data structures and algorithms that can be used in other programs as modules. Also a json server would be storing data in an order. So to implement the best search algorithm we need to make the dataset sorted. Rust has a sort_by function just for sorting. So no need to implement a seperate sorting algorithm. Also I tried creating one but I was stuck at implementing a "not-a-reference".

Rust language would be rewriting the algorithms... Which could be a better memory efficient algorithm. A world where memory is not wasted, much! I remember when I was working with JavaScript I had to implement one of the worst program logic, as said by my senior developer. I argued that I haven't completed the logic. Rust eliminates any more such situations. It won't even compile if I/you did something bad. It really helps you to work on perfecting your algorithm. Less wasted memory is what we needed all along.