Learn a new Language

RUST – Language for constructing reliable and efficient software
In many states across India, the month of April marks the days of new year per lunar calendar. As
developers let us also resolve to start something new, something which we might not give much attention
till we are forced to focus – Learning a new language.
Shifting workforce requirement and necessity to differentiate oneself has mandated every developer to look beyondwhat they can do today. Learning a new language is an easy win for many who are looking beyond what they do 9-hours a day. Not just that learning a new language gives developer the view and maturity which is much needed to grow in career. New languages offer new way of accomplishing a thing, it also offers the much-needed skill of patience, since learning itself as activity requires one to wrangle with difficult concepts which does not come straight to you. Patience is the virtue which help one weather such a tempest of unknown or difficult to comprehend.

As you read this if this question hits you – “With developers learning new exotic languages when they apply an app becomes a soup, with so much variation it is difficult to maintain.” So true, that is more a governance failure than a problem with developers learning new languages. In such scenarios it is necessary that a developer should not stop learning, rather should also be learning how to govern (i.e. apply, and manage) such new learnings.
Rust is the new language which one can pick up these days as it has got some attention and has mature release pipeline and growing in adoption. In case you already know this language as to how to develop software using Rust you are already an exotic developer. But for the many others who are knee deep in deliverables relating to maintain a steady state of an enterprise this will come across a new language.
Recent news article about Microsoft adopting Rust over C/C++ for OS development has taken stage with
much flare1
. Mozilla has developed this language for nearly a decade. This is a multi-paradigm language.
New languages that mature into market these days cannot afford to be merely functional or object oriented.
Thus, multi-paradigm is the ability to be able to write code e.g. which is object-oriented and then using the same language to write functional style. Also Microsoft has started developing a language inspired by Rust called Verona.
Rust
Rust is practically C++ with additional memory safe operation. It is evangelized as a language that is
focused on performance and memory safety (for high level concurrency). Did you ever think about the evolution of a programming language? E.g. C and C++ kind of languages attracted lot of adoptions for ages because for their time they were kind of languages which assist programming in large. Programming in large has a contrarian perspective of programming in small. You can recollect your thoughts on this terminology from your past formal education or from Wikipedia article2
. Bringing back the focus on the language; we touched about the syntax resembling C++, Rust adds a memory management layer on top of the idiomatic C++ without causing a performance dent. This memory translatest distinctive concepts –  Automated garbage collection to free memory space

 Defining the convention of Memory acquisition is initialization
 Differentiating safe and unsafe coding with different constructs
From the paradigm perspective, Rust can be used for writing –
1 https://analyticsindiamag.com/why-microsoft-is-dumping-c-c-for-this-new-programming-language/ retrieved @ 16-04-
2020T111:25UT
2 https://en.wikipedia.org/wiki/Programming_in_the_large_and_programming_in_the_small retrieved @ 16-04-2020T11:37UT

 Functional programs
 Structured programs
 Generic programs using generic type system
 Imperative programs using inferencing style of writing code.
Another interesting way of exploring the language is to know how are other developers using this language.
To our benefit there is a great community out there for the Rust support in Stackoverflow. Additionally, the maintainers of the Rust programming language also encourage participation of community in the
development of the language. As for fact much of Rust development was built using RFC process which
stands for Request For Comment. From the yearly survey of the Rust developers few interesting
observations can be made –  Use of async I/O has improved a lot when compared to previous years; which also tells us about
recent releases to this front by the release channels
 GUI development is not a forte for this language. Many developers are still not using Rust as a go-to
language for applications with UI  IDE experience for Rust has increased marginally which also be connected with rise in adoption as
more developers adopt demand for features and better performant IDE increases
 Tools and support for the language has increased over past year.
You can also take a peek on the report here – https://blog.rust-lang.org/2020/04/17/Rust-survey-2019.html

Aspects of Rust
Learning a new language could be a difficult task if we do not get a grip on the process of learning. Yes,
learning is itself a process which can be mastered. Once done learning a new language will not be a affair  which you do once a blue moon rather a regular activity.
The process specific to learning a new programming language will involve –  Understanding the paradigm supported by the programming language.  Requirements to run an application developed in that language – Installation experience for
development and in server  Components of development pipeline – i.e. IDE, compiler, and tools
 Understanding the documentation structure of the language
Functional paradigm example
As an example of paradigm consider functional programming. In Rust you can define a variable like this which is a closure and one of the many aspects of a functional program –
let hello_closure = |num: u32| -> u32 {
println!(“assume a modelling call…”);
thread::sleep(Duration::from_secs(2));
num
};
let run1Result = hello_closure(10);

Installation consideration
On the requirement of running the application we will have installation for Windows which is distributed as  an  installer here – https://www.rust-lang.org/tools/install. The installation will require a pre-requisite of  Microsoft Visual C++ build tools. That unfortunately is a different installation distributed by Microsoft. Did you wonder why Microsoft Visual C++ is required here? Any way that was rhetorical question. If you have navigated to that page; you will as well notice the distribution for Rust is beyond the standard installer for different OS. It is also available for embedded devices with different CPU architectures. The downloaded file is a simple exe called as rustup. This small executable manages the entire toolchain of rust. On the other side of the world that is the server; rust can be installed as a standalone executable and also run from docker image3
. Components of development pipeline
Developing a rust program will require you to; obviously; install the SDK first. Once you are done with that
there are few things you need to familiarize with Rust –  The standard library
 Crates
 Editions
 Cargo
 Command line tool Web assembly

These are the components that a developer will require to develop using Rust. All of them can be obtained using the rustup manager. Let us take a brief moment in understanding their role. We will spend more time working with them latter.
The standard library
They are the identifiers for the programming language. As developer you need to understand this very well before you could go any further. They offer the language primitives for Rust programming language. They offer the capability and paradigm support we boasted earlier. The features inside the standard library is arranged in Crates. For the time being walk along with me for the usage of the word. We will be expanding upon the definition of the word in a while. For now, let us read it as libraries if that comforts you. These
crates are –  alloc,  core,  proc_macro,  std  test
Amongst these the one which are unavoidable in usage are core and std. The IO that we noticed from the survey result is right inside the std crate.
Crates
The official word is; it is a repository of important things in rust. They are what we have maven central in the Java world and npm repo in Javascript world and Nuget in the Microsoft world. Will you agree at this
moment that many languages have similar concepts and are thus easy to learn? Anyway, back on Crates
they are good for central repository but interacting with them require client known as Cargo.
Cargo
Cargo is the package manager for the programming language. You will use this like you do with maven
from command line. You can add packages, remove and manage them using the command line tool. This
is installed by default when you install Rust with rustup.
Editions
They are boring release management stuffs. i.e. they are used to bundle features into smaller packages
and over a period of years these packages are combined together to form a bigger package to indicate  major changes. Editions serve the need for developers to absorb changes seamlessly than a big bang approach.
Command line tool
We are aware of this component! It is rustc. The one which help us get so far with Rust. Did you confuse
yourself with rustc serving only as installer? Oh, please don’t; this is a tool which helps us get around with lot of thing in Rust. It I actually a compiler with added features.

Web assembly
This is the best part of Rust; it can be run on browser. For that to happen for a language which works at
lower level of computer abstractions; it is packaged as web assembly. This is packs and plays well with
JavaScript and ECMAScript standards.
We will pause for this dispatch right here. We will skip the documentation as for most; thought it is
important; it is considering a boring stuff. We will pick up the concepts of crates, modules, packages,
structs, traits etc for the next dispatch.