Thursday, September 14, 2017

A Team Lead's Influence on a Junior Dev

I want to mention a few things that my supervisor, whom I'll refer to as James, did / does that has made my first year of working as a developer a success. In this article I'll give an account of my "initiation" or "just starting out" period at my job, the middle "growth" phase, and I'll write about my "Hey, I'm a developer now!" part (aka nowish). I will focus around interactions with my supervisor (James) that helped me grow and be a better developer.

Initiation Period
When I started they handed me a schedule outlining what I was going to be doing for the first two months as a junior dev to get up to speed so I could start doing real work. After I got through the corporate policies and my machine was set up, I was given a practice project which I finished a week ahead of schedule. Once I had finished that project James sat me down and we had a meeting. He asked me how soon I wanted to be working on actual things and what I felt I needed to do to get there. I told him that I felt that the best thing for me would be to start doing things on the actual product and that I would learn fastest that way.

After that meeting he started handing me small tasks and gradually gave me bigger and bigger projects to work on. When he was convinced I was competent enough, he had me doing code reviews on his code changes.

When he reviewed my code, he was always very nice, but he was also straight forward and told me when I had a problem in my code. When he started having me review his code I felt an obligation to be just as critical of his code, which helped me be more thorough and conscious of quality.

James was nice to me, gave me responsibility quickly, and worked with me at my level. This resulted in me feeling like a member of the team and a part owner of it's success.

Growth
After a while I noticed things about our code base. I found our project had 20 unit tests that were all broken. I told James about these things He admitted to not having a lot of experience with them and he gave me time to learn about unit tests and fix the ones in the project. Eventually I got some of those fixed, eh but not all (writing unit tests after the code is written is not easy or ideal).

I also found that our most frequently changing portion of the code base was becoming unmaintainable. He gave me a little time to think up a way to re structure that portion of our code base. After coming up with various restructuring plans (off and on for about a year) I approached James about going through with the refactor, to which he said "Well, you have some time right now, how about you now then?". I was quickly overwhelmed with the size of the project I had been given (by me to some degree).

James let me contribute my idea's to the project and let me be a part of decisions made on the code base. I could even say he encouraged me to contribute.

"Hey, I'm a Developer Now!"
After working on the major code refactor project for a month or two (on and off, but mostly on) I was pretty burnt out. We had recently hired another junior dev to work on the same portion of the stack that I work on. At this point my title is no longer junior developer and I really wanted help with my project. James had me guide the new guy through the refactor process (while doing a different piece that needed to be done sooner) and immediately after it was done he had the new guy helping me finish the refactor. After that it only took two more months to finish the refactor.

After a few months our new dev left for greener pastures. I made it known to James the things I've been interested in training and being a part of the interviewing new candidates (where I work we do panel interviews). I was able to be apart of the interview process for our most recent dev, whom I get to train.

James kept giving me responsibility. He let me train and code review and get out of the junior dev bracket.

Conclusion
I've cited some specific examples of things James has done for me but I'd like to summarize the end result. He did things that made me feel valued, that my opinion had value, even when I was still just a junior dev. He has given me more and more responsibilities to help me grow as an individual and in my career. I guess ultimately he cares and he listens.

Friday, September 8, 2017

The Rise of a Better Type of Network Service

No one person owns the internet. The same is not true for the services that run on top of it. Some services it makes sense to follow this model, others it makes less sense. The new kind of network model (well not really new, but seeing more of them) is a Distributed Federated Network Service (DFNS). In this article I will go over what a DFNS is, why it's important, why you should use one, and a few examples of currently existing DFNS's.

What is it?


A Distributed Federated Network Service (DFNS) has the following characteristics:
 - If I have a server with an instance and you have a server with an instance they talk to each other.
 - I own my server and you own yours.
 - It runs on the internet

I am not a spokesperson for any of the services I use as an example. I am not paid by any of them either.
Tldr;

Why is this important?


Federated is important because...

If one service goes down we want the least ammount of people to need to find a new service. For example, google hangouts provides call, vid call, and chat. Only google customers can use the service and chat within it's service. Let's say one day either google and it's services disappears or they decide to shut down that service. Every user will have to find a new service and find their friends again on it. If it were federated then google hangouts could talk to yahoo hangouts (not a real thing) and also to bing hangouts (also not a real thing) and keep the same functionality for everyone.

Ownership

If it's federated and one company owns every instance then we still have the same problem. If google goes down all of the instances will, at least eventually, go with it.

Runs on the internet

To work it needs an existing infrastructure everyone already uses, that is already a DFNS to work. The internet is already here and it works.

Why should i use one?


When you use a DFNS it becomes more prominent and popular. By choosing to use a service you are casting your vote into whether you want it to live or die. Donating money takes it a step further, but if you don't have money to give then at least by using it you are a part of the user base.

Real Life Examples


Matrix.org

Matrix is a DFNS for communication. It supports voice calls, Vid Calls, and chat. All of these include E2E encryption.

Matrix is more of a protocol (https://matrix.org/docs/spec/). It defines a spec that others can implement themselves. As long as it's implemented correctly, it will federate with the rest of the matrix network. This is also similar to how the internet itself works. You don't need to have matrix's implementation (synapse) of it to have your own.

If you want to use it today check out riot.im it's a completely free service which will offer paid tiers in the future. The service currently has network bridges for slack, gitter, and irc. You can use Riot.im to talk to other chat services you use.

Riot.im has an android app, ios app, desktop and web application available as of now. I would place this service at beta currently with improvements and updates happening fequently. Even though I say it's beta, it's completely useable now. I use it to integrate with slack channels and irc channels.

For you nerds out there, there is a matrix command line client.

The Librem5 phone, currently being crowd sourced by puri.sm, will be a matrix first communication platform and traditional call second.

Mastodon

Mastodon is a micro blog social network like twitter, except open source and a DFNS. You can set up an account on one server and follow it on another. Mastodon isn't fully open though, individual instance owners can filter and block other instances that have different terms of use. If you want to find an instance that filters content according to your tastes, this tool is useful https://instances.social/

My mastodon handle is @springbov@mastodon.technology go ahead and 'toot' at me.

I would rate this as prod ready.

LBRY


LBRY is a DFNS content sharing platform. you can share pictures, video, and other kinds of content. You can charge people for your content, or give it away for free, or some sort of weird mix of the two.

Conclusion


Distributed Federated Network Services provide a more stable future for network services we use. What network services you choose to use affect what network services you will get.

Tuesday, August 22, 2017

Tips for Debugging Minified Prod JavaScript


I thought I'd share two tips on how to debug minified javascript. I've found this most useful for debugging production issues in my code.

Let's say we have the following code

var table_spot = document.getElementById("table_spot");

table_spot.appendChild(tableGenerator(3,4));

function tableGenerator(width, height)
{
var table = document.createElement("table");
for (var i = 0; i < height; i++)
{
var row = document.createElement("tr");
for (var j = 0; j < width; j++)
{
var cell = document.createElement("td");
cell.innerText(i + " " + j);
row.appendChild(cell);
}
table.appendChild(row)
}
return table;
}


and here is the minified code

function tableGenerator(e,t){for(var a=document.createElement("table"),n=0;n<t;n++){for(var r=document.createElement("tr"),l=0;l<e;l++){var d=document.createElement("td");d.innerText(n+" "+l),r.appendChild(d)}a.appendChild(r)}return a}var table_spot=document.getElementById("table_spot");table_spot.appendChild(tableGenerator(3,4));


The first thing I do (using chrome dev tools) is I pull up the source file in question and do a beutify, which still obfucates a lot of the code.
there is a little button with the '{}' symbols in it that does it.



Because I have the source code I know what I'm looking for to debug.

Tip #1 - Strings don't get minified

Not everything changes. Strings, for example, don't get minified. If they appear in your source code they won't change. So to find the right spot you will 'Ctrl + f' and find that string.

Tip #2 - Object obfuscation isn't complete

Objects are obfuscated... kinda. Usually properties will not change. If you are receiving data from an api call, for example, the properties on that object will not be known at the time the file is minified.

You might have a line that is 'resonablynamedObject.propertyone.subProperty' that would obfuscate to 'j.propertyone.subProperty'. Usually, you won't have any problems searching for '.propertyone.subProperty'


I hope this helps some poor unfortunate soul.

Saturday, August 12, 2017

Binary, Memory, and Variables (Oh My!)

If you progress far enough in computer science you might learn some weird things. Weird things like "9.4 - 9.0 - 0.4 != 0 ". I put a code example here. This weird thing is an example of a rounding error. The purpose of this article is not to show why these happen. It is to explain how data is represented inside of a computer at an introductory level.

Binary

Binary is a number scheme that only has two valid characters to represent numbers: 0 and 1. In contrast the number scheme that most humans use to communicate numbers has 10 possible characters: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Our number scheme is called decimal.

If we look at the places for number, for example the number 22, we have a 2 in the 10's place and a 2 in the 1's place. This is the same as having 2 tens or '10 + 10' and 2 1's or '1 + 1'.

We can also represent decimal numbers in the following way.

1000's | 100's | 10's | 1's
___________________________
 10^3  | 10^2  | 10^1 | 10^0

If you are not familiar with this notation, the '^' symbol just means 'whatever number is to the left multiply itself by itself the number to the right times. so 10^2 is '10 times 10'. Also anything to the power of zero is one.

The following is a chart for the "place's" of binary numbers

 8's | 4's | 2's | 1's
_____________________
 2^3 | 2^2 | 2^1 | 2^0

Binary follows the same pattern as decimal, only because we have 2 characters instead of 10 we do 2^n instead of 10^n where n is the number indicating the position.
So if we have the number 0101 in binary that would be the same as '4 + 1' which is '5'.

Binary follows a pattern. As an exercise try writing all the numbers in binary 0 - 15. You can check your work by looking it up on the Internet.

Hexadecimal

Hex means 6 and decimal means 10. Put them together and you get hexadecimal- it's base 16. Hexadecimal is what computer scientists use as a shorthand for binary in coding applications. Hexadecimal has 16 characters to use. Those characters are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. The symbols after 9 represent the numbers 10 - 15. Hexadecimal (hex for short) follows the same pattern as the other numbers.

 16^3 | 16^2 | 16^1 | 16^0

So the number 002F is the equivalent of  '16 + 16 + 15' or '47'.

We use hex as a shorthand for binary because it's convenient. Let me show you.

In binary we may have a long number such as '0000 0010 1001 1111' (we put spaces between sets of four in binary to improve readability). Every set of four places (or bits, as the places are referred to in binary) can be represented by a single hex value. So our number before in hex will be '029F'

Binary and Computer Memory

 You can think of computer memory as a long list of rows. Each row has a certain number of bits (binary number places). Each bit can be either on or off. On is represented with a 1 and off is represented with a 0. At a much lower level than most programmers go you can actually specify a place in memory by its number and retrieve the value that resides there. For example:

 location | value
 _________________
 0000 | 0000 0000 0000 0000
 0001 | 0000 0000 0100 0001
 0002 | 0000 0000 0000 0000
 0003 | 0000 0000 0000 0000
 ...
 FFFF | 0000 0000 0000 0000

In computer memory everything is stored as binary values. Images, movies, sound, text... Everything. It becomes up to the programmer to interpret what those values actually mean.

ASCII

A long time ago, near the beginning of modern computers, ASCII was developed. ASCII was / is a set of rules to interpret a number as a letter or character. In our previous example at location hex 1, we have a value that equals the number 65. If the programmer was using interpreting that location as a character it would be the letter 'A'.

Floating Point Numbers

Also a long time ago a standard was formed by IEEE to interpret numbers that have a decimal point. In our examples above we can only interpret them as whole numbers (numbers with no decimal point). We call numbers that have decimal places a 'float' or 'floating point'. Almost all computers use this standard.

High Level Programming Languages

In high level programming languages, you won't have to worry about the binary representation of variables. In C, C++, Java, or similar strongly typed languages, the compiler knows what binary representation to use when you declare a variable. 'int' declares a (depending on the language) 32 bit long integer number. a 'char' would declare a character value (at least 8 bits long). etc...

The point is that most of the time you don't have to deal directly with interpreting bytes and binary notation for different types.

Conclusion

Most of the time you won't need to deal with how your variables are represented. You won't need to deconstruct it or any of that (unless you are doing lower level activities or interfacing directly with hardware).
However it will affect you as a programmer and it is happening whether you know about it or not.

Thursday, August 10, 2017

Things I've learned this last year

Last year in January I started my first job as a developer. I'd like to share what it's been like. I'll separate it into "what I've seen in my corporate environment", "what I've learned about coding" and "what I've learned about myself".

What I've learned about coding

JavaScript is a really nice language to work in. When I started I thought JavaScript was a super weird language and that is still true, but it has some nice features I didn't learn about in school (which I feel I should have).
In ECMA script 5, supported by all current browsers, there are 3 features I use all the time at work. Even when I probably shouldn't, because they are so nice.
  • Methods on lists / arrays
    • map
    • filter
  • Properties
If you haven't used map or filter, here's an example.

[1,2,3,4,5].filter(function(x) { return x % 2 }) // returns [1,3,5]
[2,3,4].map(function(x) {return x - 1}) // returns [1,2,3]


If you don't know about these and want to learn check out MDN and look it up.

I use properties more in combination with typescript (which is something else I've learned in the past year or so) under ECMA script 6 classes.

What I've seen in a corporate environment

I've never worked for a large corporation before. I found out that all those jokes about cobol and other technologies being used far longer than they should've been are true. In general people are friendly but the older programmers don't really seem to want to learn any new technologies. Which is why we have 20 - 30 years of programming (all in a form of assembly that is not x86, arm, or anything modern). It is so much code that it became the best solution for us to write a virtual machine which will run on modern architectures instead of rewriting the code base into something modern.

It's also really nice to be on the bottom rung of the corporate ladder (for me). I see my supervisor constantly in meetings and talking with his boss and clients and people from other departments. I'd rather code than do that.

What I've learned about myself

I've learned that even though I like coding a lot, it's not sufficient for me to just have a coding job. I care about what and who are using the code I write.

I've also found that I have a desire to give back to the programming community. To try and lower the bar of entry, if I can, and I've found others who want to do the same.

One particular person who has fueled my desire to give back is Mattias P Johansson  a developer for Spotify, producer and content creator for the YouTube channel funfunfunction, experienced dev with a lot of really good insight on how to be a better developer.

Monday, October 10, 2016

Setting up Visual Studio Code for Rust Development

On Linux, Mac, and Windows

I've decided to write a series of tutorials (a rather lengthy one) that is more like an online class. I used to tutor the fundamentals of programming class at my university and I found the structure of it lacking. My goal for this series is to cover all of the material that ought to be covered in in an "intro to programming" or "fundamentals of programming" class.

In each post there will be challenges at the end for you to practice your new found coding skills. Some people would call this 'homework' but I prefer to not use dirty words. ;)

The series (including this post) are geared towards those who have not been exposed to programming before or any of the tools involved. If you have coding experience already then please read on with this in mind.

The reason why I am showing how to set up a Rust environment with Visual Studio Code is that VS Code is open source, free, and has pretty good Rust support.

I will also do a vim / command line / Linux workflow tutorial separately. Why? Because vim is awesome and I love vim. Why Linux? Because it is also awesome and I use Linux as my primary operating system at home.

Let's get started.

1. Downloading and Installing Rust and Cargo

The Rust installation package includes a package manager called 'cargo'. Cargo allows us to access pre-written code from the Internet to make our work flow nicer. It also can be used for managing Rust programming projects. To install if you're a Mac OSX or Linux user, open up your terminal program and copy and paste in the command 'curl -sSf https://static.rust-lang.org/rustup.sh | sh'. If all was successful you should see some text on your console that says 'Rust is ready to roll'. If you're a Windows user go to rust-lang.org. You will find two options based on which ABI you want it to work with. For those who are new to programming and tooling in general try installing the 64 bit "Windows (GNU ABI) (.msi)". If that doesn't work then try the 32 bit version.

2. Installing Dependencies

This step may take a very long time depending on your computer hardware. There are 3 packages to install. To save time only install and configure 'racer'.

2.1 Installing Racer, Rustfmt, and Rustsym
Mac OSX and Linux users open up your terminal program; Windows users search for the program in your start menu called 'cmd' or 'command prompt'. When your terminal (or command prompt) loads type in 'cargo install racer'. On my little chromebook-like computer this part took 10 minutes. The other two programs are optional but recommended. For the other two programs, run 'cargo install rustfmt' and 'cargo install rustsym'. They can be installed later if you decide to skip them.

2.2 Adding Racer, Rustfmt, and Rustsym to the PATH Variable
The default location for programs installed by cargo is ~/.cargo/bin, where ~ is shorthand meaning your user folder on your system. IE on windows this would look like C:/Users/seth/.cargo/bin and on Linux it would be /home/seth/.cargo/bin. I believe that on Mac OSX it is the same as on Linux but I don't know.

2.2.1 Modifying Your PATH Variable on Windows
On Windows 10 follow the instructions found here to get to the environment variable list. Under user variables there should be one called PATH. Click Edit after selecting the PATH variable and copy and paste ';%USERPROFILE%/.cargo/bin' to the end of that long line (do not delete what's already there!). Close your command prompt and then reopen it.

2.2.2 Modifying Your PATH Variable on Linux
On Linux open up your terminal and run 'nano ~/.bashrc'. Nano is a text editor program for command line. Go to the bottom of the file and after the last line add a new line that says 'PATH=$PATH:~/.cargo/bin'. This adds the cargo/bin folder to your path so that you can run the programs in it just like any other program. Save the file and close. If you don't want to restart your terminal then type the command 'source .bashrc' to load your changes.

2.2.3 Modifying Your PATH Variable on Mac OSX
I am not a Mac user, so I looked up the instructions on the Internet. They are almost exactly the same as they are on Linux. Open your terminal and run the commands 'touch ~/.bash_profile; nano ~/.bash_profile'. Second add this line to the bottom: 'export PATH="$HOME/.cargo/bin:$PATH"'. Save and close with (<ctrl-x>). The original instructions I found are at here and I modified them slightly for this tutorial. Either source your bash profile or reopen your terminal, whichever you're comfortable with.

3. Configuring Racer

Racer is used for code completion suggestions so that while you are typing your code editor can give you suggestions for what to type. This will become clearer as you use it, but for now let's set it up.

3.1 Downloading the Rust Source Code
Racer needs the source code for Rust to be able to do code completion. So first things first, we need to download the source code. Go to rust-lang.org/downloadsand click on the link labeled 'source'. The file should look like 'rustc--src.tar.gz'. As of the writing of this the current version is 'rustc-1.12.0-src.tar.gz'. Files with a '.tar.gz' file type are called 'tarballs'. They're kind of like zip files. Once the tarball is downloaded we need to extract its contents.

3.1.1 Windows
For Windows we need to install a program capable of opening the .tar.gz file. I recommend 7-zip. Download the 64 bit exe file and install it. If it won't install then try the 32 bit exe. Once you have installed 7-zip, you should see some extra options available when you right click on files. Go to the folder where you downloaded the source code and right click on the tarball. In the menu that showes up there should be something like 'extract here'. Click that. It should make a 'rustc-<version>-src.tar' file in the directory. Go ahead and repeat the same steps by right clicking on this new file and choosing 'extract here'. There should now be a new folder that is labeled 'rustc-<version>'. In your user folder create a new folder called 'src' and move the 'rustc-<version>' folder into it.

3.1.2 Linux and Mac OSX
In your terminal go to the directory where your downloaded tarball is. If you don't know where the file is, try typing 'cd ~/Downloads', press enter, and then type 'ls' and then press enter again. If it worked you should see the rustc source tarball listed with other files. If you down't see the tarball in the list of files displayed, try looking up the find command and finding the tarball with that. Or check your browser to see where it puts downloaded files. When you have found the tarball and have changed into the same directory as it, run the command 'mkdir ~/src'. Then extract the achive by running 'tar xzf rustc*.tar.gz -C ~/src/'.

3.2 Setting up RUST_SRC_PATH 3.2.1 Windows Using the same instructions from before get to the environment variables menu. Under 'User Variables' click 'add'. For the variable put 'RUST_SRC_PATH'. For the value put `%USERPROFILE%/src/rust-<version>/src` but replace with the actual version number of the version of Rust you downloaded.

3.2.2 Linux

In your terminal enter `nano ~/.bashrc`. At the bottom of the file insert a new line containing `export RUST_SRC_PATH=~/src/rust-<version>/src` but replace the <version> with the version number. Save the file and close it.

3.2.3 Mac OSX Almost exactly the same as for Linux. In your terminal enter `nano ~/.bash_profile`. Add a line on the end that has `export RUST_SRC_PATH=~/src/rust-<version>/src` but replace the <version> with the version number. Save the file and close it.

4. Testing racer

To test racer open a NEW terminal (or command prompt if you are on Windows) and enter the command `racer complete std::io::s`. If it was successful it should look similar to:

MATCH sink,160,7,/home/seth/src/rustc-1.12.0/src/libstd/io/util.rs,Function,pub fn sink() -> Sink
MATCH stdin,209,7,/home/seth/src/rustc-1.12.0/src/libstd/io/stdio.rs,Function,pub fn stdin() -> Stdin
MATCH stdout,395,7,/home/seth/src/rustc-1.12.0/src/libstd/io/stdio.rs,Function,pub fn stdout() -> Stdout
MATCH stderr,517,7,/home/seth/src/rustc-1.12.0/src/libstd/io/stdio.rs,Function,pub fn stderr() -> Stderr
...
If you get a message that contains the phrasing 'command not found' then check your PATH variable. You can refer to step 2.

5. Download Visual Studio Code

To download Visual Studio Code go to code.visualstudio.com and download the file appropriate for your system. It should show only the file appropriate for your system by default.

5.1 Linux Specific Instructions If you are on Ubuntu or Debian or something based on Ubuntu or Debian, then download the .deb file. If you are on RedHat, CentOS, Fedora, or Suse then download the rpm file. To install it navigate to the directory to which you downloaded it and double click on it. This should open a package manager to assist you in installing it.

I am a user of Debian / Ubuntu based distributions, and I like the command line. If you are like me and use Ubuntu or Debian and want to install VS Code from the command line, then use the command 'sudo dpkg -i code*.deb'.

5.2 Mac OSX and Windows I don't use Mac OSX, but I believe you just double click on the file you downloaded. And Windows is the same. In reality Linux is the same too, but I like describing things on Linux a lot and some users have a harder time with it.

6. Launch Visual Studio Code

6.1 Windows On Windows there should now be a Visual Studio Code icon on the desktop. Double click on that.

6.2 Linux In Linux VS Code should have been added to the menu of whatever GUI you're using. If it's in a sub folder then the sub folder is probably development. Alternatively, from the terminal, you can enter the command 'code' and Visual Studio Code will be launched. However, if you close the terminal, your instance of VS Code will die too.

6.3 Mac OSX I honestly have no idea, but it should be like other Mac programs. If not leave a comment and I will try and dig up where it is, or someone who knows a lot about Mac OSX will respond.

7. Install the RustyCode Extension (requires Internet access)

This step requres Internet access. Once VS Code has started, click on the extensions icon on the left hand side of the window.



It will bring up a search bar. Search for 'RustyCode'. This requires an active Internet connection.



Once the RustyCode result is pulled up, click 'install'. After it's finished installing click 'enable'. This will restart Visual Studio code.

At this point you are done with setup! Huzzah!

Hello World

To test your setup, we will write a short hello world program and compile it. A 'hello world' program is typically the first program you write when learning a programming language.

In your home folder on your operating system create a folder called 'workspace' to keep your future rust programs in. Inside of 'workspace' make a folder called 'hello-world'.
In Visual Studio Code go to 'File -> Open Folder' and open the folder 'hello-world' which you have just created.


Next click on the explorer icon.



This view shows your current directory as well as all of its files and sub directories. Click on the button that looks like a paper with a '+' symbol on it.



This will allow you to create a new code file. Type in the name 'hello-world.rs' and press enter. After hitting enter it should create the file and open it in a tab where you can work on it.



Whenever a file hasn't been saved yet or has changes that haven't been saved yet there will be a dot next to the file name.



To save go to 'File -> Save' or press Ctrl + s.

Type the following hello world program into your newly created file.
fn main()
{
 println!("Hello World, I am a Rustacean!");
}
Next go to 'View -> Integrated Terminal' (or press Ctrl + ~) to pull up an integrated terminal. In the terminal type 'rustc helloworld.rs'. After it finishes compiling, execute your program. In Linux or Mac OSX type './helloworld'. In windows type 'helloworld.exe'.
If it worked you should see the text "Hello World, I am a Rustacean!".

Challenges:

  1. In VS Code go through each of the icons on the side-bar and see if you can figure out what each one is for, particularly the files tab - explore it and make sure you know how to use it to create files, delete files, and move files around.
  2. Read the license for the Microsoft distribution of Visual Studio Code. It's not that long but it is different from their license on github. This is good because it's good to know what you are allowed to do and not allowed to do with your tools. Spoiler: you can safely use this at work for free.
  3. Figure out how to turn off the telemetry data collection on Visual Studio Code. I'm still dubious of Microsoft. This challenge is optional, of course. =)

CONFESSIONS

I've been lying about the Mac OSX instructions being different from the Linux ones in a lot of this tutorial. You could modify the .bashrc file just like in Linux (I think), but I don't know how Mac OSX works for sure, so I'm trying to be safe by using the Mac instructions I found.


Friday, September 23, 2016

Rust and WebAssembly

Recently I've become enamored with a newish language called Rust. The reasons I like rust are as follows.

  • To describe its syntax, it's like typescript, JavaScript, and c had a baby who inherited almost solely the good attributes of its progenitors. (it's a good thing, trust me)
  • It has a great project tool that is reminiscent of npm in node, but with extra features related to building your project (called cargo)
  • It is open source, released with a mixture of MIT and Apache 2 licenses ( industry friendly licenses )
  • The community is great, and active (they had their first Rust-Con this year)
  • It is backed by Mozilla, an industry leader
  • It is a systems language, meaning you could write an operating system in it
  • It is fast, on par with Go-lang (edit:9/28/16) C++ in many ways (Presentation on rust by a Mozilla employee)
  • Rust doesn't have a garbage collector, but makes it easy to write memory safe code with it's concept of 'borrowing'
  • There is already good plugin support for Vim :)
  • Rust also has good support in visual studio code, and emerging plugins for visual studio and the intellij platform

The only things I don't like are related to it's age (It hit version 1.0 in May 2015).

  • It's executables are a little big for even something like a hello world (the compiler is being optimized with each release) (Edit:9/28/16)
    The executables are actually pretty normal sized. I just realized that the executables are big (compared to c or c++) because rust is packaging the standard library with it, whereas the standard library for c or c++ usually already has a dll on the target system (like linux or windows) which has all of that code in it.
  • The tooling (which is a current objective - as of 2016 - in the rust community) is functional, and it works, but it needs some improvement
  • I can't use it at work (yet... I need to do some convincing and suggest it at an opportune moment) :(
I expect these things will improve a lot over time, and they are all actively being worked on.

Rust is going places. Mozilla (in collaboration with other tech company's such as Google) have been designing and will be implementing a new web standard for browsers called 'WebAssembly'. In the past (and currently) JavaScript is about the only language you can write browser code for. This changes with WebAssembly (WASM).

WASM allows you to write code from a compiled language and run it directly in the browser context. In some testing that has been done, the speed increase has been as high as 20x. Also compiled code is typically smaller than text. At openwest 2016, I heard from a developer for Mozilla that good candidates for WASM are compiled languages that do not use a garbage collector. So the languages I know that don't have a garbage collector are rust, c and c++.

Mozilla is using rust in firefox already. With memory safety being a big feature of rust and WebAssembly on the horizon, Rust has a bright future. I can already imagine new video game streaming services running directly in your browser, with games written in rust. With my infatuation with rust, it's probably going to be the only thing I talk about for the next year or so.