Should I Focus on Rust Exclusively?

in Learn to Code17 days ago

rustcomp.jpg

@learn2code recently launched the Learn to Code Community and the BYTE Token.

I've considered writing a series of articles about programming.

As I was researching different articles, I stumbled on a mandate from the Biden Administration warning programmers against traditional programming languages. The Biden Administration suggests that programmers adopt a new language called Rust.

Reference: ONCD Report Calls for Adoption of Memory Safe Programming Languages and Addressing the Hard Research Problem of Software Measurability

It appears that the White House and other powerful organizations are seeking to deprecate several programming languages because the languages lack constraints on how programmers access the computer memory.

I was considering writing a series on C. C leaves memory management in the hands of the programmer. Suggesting that coders learn C puts me on the outside of a political struggle.

Of course the fact that the Biden administration issued such a statement has me worried that the political class might start regulate programming.

In such a such a case, resistance might be warranted.

I would hate to instruct people to use a program that the Biden Administration intends to cancel.

I am not opposed to Rust. There are several things that I like about this new language. So, I thought I would write up a brief history of Rust and ask the question as to whether or not it should be the first language a programmer learns.

History of Rust

Graydon Hoare of Mozilla Research began the Rust Project in 2006.

Mozilla is a free software company that was founded 1998 by the developers from Netscape.

Netscape was the favored browser of the open source community at the turn of the Millennia.

The Internet Service Provider acquired Netscape in 2002. Several key developers of Netscape left the project as they were worried that AOL would turn Netscape into a proprietary program.

The developers created a new company called Mozilla. Mozilla quickly became the darling child of the open source community.

Mozilla released FireFox in 2002. FireFox gained over 32% of the browser market by 2009 and helped unseat Internet Explorer as the dominant browser.

An Internet Browser is a complex program. A browser must be able to read and display web pages from a variety of sources including a weird mix of HTML and XML derivatives. The browsers must also support numerous image formats and be able to handle JavaScript.

To make matters worse. Web users are accustomed to opening dozens of tabs and sorting through hundreds of pages during a web session.

Since web browsers might open and close thousands of files during a session, web browsers need robust memory management systems.

FireFox was built on a complex object framework that depended on a "garbage collection" scheme to manage memory. The software was bloated, slow and prone to memory faults.

Mozilla was interested in an alternative to Garbage Collection; So, in 2009, Mozilla began supporting Rust.

So, Rust was developed to handle the intense memory management requirements of web browsers.

The programming language was built around techniques to assure proper memory management.

Rust Enters the Market

Engineers achieved an important milestone in 2011 when they were able to successfully compile Rust using Rust. Using the program to compile the program means that Rust can stand on its own without dependencies.

A year later, in 2012, Mozilla announced the creation of a memory safe browser called Servo.

During a 2012 interview, Graydon Hoare noted that, as a programming language designer, he was intrigued by memory safe programming techniques used by computer languages of the 1970s and early 1980s.

Many early programs employed the functional paradigm. In the functional paradigm, functions owned their memory. Since the functions owned the memory, it is possible to automatically free memory on completion of a function call.

I probably should interject. This is what I've always done! It is not really a new idea. I never liked the garbage collection of C++ or Java.

Just on a side note. When C++ and Java became the rage. People like me who supported the functional paradigm were routinely put down and derided as legacy programmers.

I actually find the current state of affairs humorous because, to an extent, the people who derided me for preferring the functional paradigm are now being labeled as legacy code dinosaurs.

I've encountered several videos on the transition from C++ to Rust that use the phrase "Winter is coming."

Apparently, this is a reference from "Game of Thrones" that implies that C++ and Java programmers might might start seeing dark days as a new paradigm moves into the spotlight.

BTW: it is not really that new. C programmers learned to free up memory when the function exits.

But back to the evolution of Rust.

Mozilla released FireFox Quantum which incorporated elements of Servo in 2017.

Mozilla responded to the pandemic by laying off a quarter of its 1000 programmers including many members of the Rust Team.

In response to the layoff, the Rust Team formed the Rust Foundation in 2021. The foundation had support of Google, Microsoft, AWS, Huawei and Mozilla). Google announced support for Rust in the Android Open Source Project in that same year.

Google announced that they would be bringing elements from Rust into the Chromium project in 2023.

Should the Government Force People to Use Rust?

Rust has had a meteoric rise. The announcement that the Biden Administration would be forcing the language seems a bit premature as most C and C++ programs aren't suffering from memory fault errors.

Learning Rust

Since Rust is currently the golden language of the programming world, I believe that anyone wanting to learn to code in 2024 should take time to learn Rust.

The best way to learn rust is to Read the Rust Book. The book begins with instructions on downloading and installing Rust. The book has differently installation proceedures for different operating systems.

I am running Ubuntu. I was surprised that the installation had me download and executable with curl and to run a script from the internet as root. Downloading and running random scripts from the Internet is a great way to infect one's computer with viruses. But since Rust is Joe Biden's preferred programming language; I think that it is okay to veer from sound security techniques in this case.

After installing and updating the program we can start on our first script.

Users need to create a directory for the program. Rust recommends the name "projects." You will also need to create a file for the script. Rust recommends "hello_world."

The next step is to create the file "main.rs" in "hello_world" and to type the following code:

fn main() {
    println!("Hello, world!");
}

The exclamation mark after the word println indicates that the command is a macro. A macro is a placeholder for a complex program.

Now save the file. Exit the editor and run the command:

rustc main.rs

If all goes well the rustc compiler will produce an executable file. I am using Ubuntu. I listed the directory. The name of the executable was simply "main". An executable on MicroSoftt should be "main.exe" .

The executable file was 3.7 megabytes!

A one line code program created an executable that was 3.7 megabytes in size. Something seems off.

Reading the Rust Book

I worked through the Rust Book several times this last year. The book provides a serious discussion of modern programming and provides the solutions applicable to the design of Web Browsers.

I highly recommend Rust to new programmers. I suspect that the number of jobs asking for Rust programmers will gradually increase. There is a strong argument for small businesses to move exclusively to Rust.

My experience is that most jobs require that coders work with different programs.

I've worked with dozens of different programs. I've learned to validate information before processing. My code rarely has problems with memory segment faults.

In researching reaction posts to Rust, I've notice that many legacy coders have the same experience.

Most of the really serious errors that I've encountered were created by hackers. Hackers can cause serious problems when they inject malware into a programming stack.

The promise of Rust is that the Rust environment should create fewer opportunities for malicious coders.

Rust and Politics

While I appreciate aspects about the Rust Programming language. I am extremely concerned that the Biden Adminstration might use safety concerns to start regulating the programming world.

Advocates of Rust keep repeating the slogan "Winter is Coming."

The slogan implies that the political class might soon drop the hammer on C and C++ programmers.

I've already experienced the politicalization of code a few times.

Decisions made for political reasons usually turn out bad.

Of course, from a career perspective, it is always better to be on the winning side of a political spat than on the losing side.

Winter is coming and the political machine wants to stomp on the heads of C coders. Defending the legacy coders might be a bad career decision.

Image Credit

I created the image of a computer room filled with rusty gears on NightCafe

Conclusion

Rust is an interesting project that enforces memory safety at a language level.

The language began as an open source project and is being used by FireFox and Chrome to create robust memory safe web browsers.

Despite this auspicious beginning, the language might be used by the political class to regulate the programming profession.

I like some of the things in Rust, but I think I will take a multi-lingual approach that teaches people to use different languages.

Sort:  

In your opinion a beginner code should start from Rust as his first coding language? It would be a better start even when compared to Javascript or Python?

Curated by @arc7icwolf.byte for the #LearnToCode community

Many people are pushing Rust. I think it is worthwhile to work through the Rust Book as it presents the arguments that people are currently talking about.

I worked through the Rust Book a couple of times. I found Rust to be too convoluted.

IMHO: ust is too focused on itself.

If you really like Rust; I would go with Rust.

If you have access to a Linux box, I would learn C using the standard GCC compiler.

A long time ago, I learned C Sharp using the Visual Studio IDE. I did not like it because it was focused on Windows.

I've been experimenting with Zig. Zig is still too esoteric for my taste. Their learn page has the line:

Focus on debugging your application rather than debugging your programming language knowledge.

It might be the language to learn. I have not found a good tutorial for Zig . Zig is a new language. It is still in its pre-release phase.

I am really scratching my head. Should I focus on Zig or on C (for Linux).

!ALIVE

Maybe it may be a bit to hard as first language to learn? I have no basics, except for a few beginnger Python tutorials and a bit of HTML knowledge from years ago, but I'm still far form being able to code something interesting on my own...

@arc7icwolf! You Are Alive so I just staked 0.1 $ALIVE to your account on behalf of @ yintercept. (1/10)

The tip has been paid for by the We Are Alive Tribe through the earnings on @alive.chat, feel free to swing by our daily chat any time you want, plus you can win Hive Power (2x 50 HP) and Alive Power (2x 500 AP) delegations (4 weeks), and Ecency Points (4x 50 EP), in our chat every day.

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below


Hey @yintercept, here is a little bit of BEER from @isnochys for you. Enjoy it!

Did you know that <a href='https://dcity.io/cityyou can use BEER at dCity game to buy cards to rule the world.

Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support. 
 

Thank You.
Very informative.
!LOLZ