Why C# is Still Worth Learning Today

These days with all the programming rage is JavaScript and related web frameworks or data science with Python or R, C# isn't as popular as it used to be. Of course, that makes sense. Programming languages come and go as languages and compilers are evolving. However, I think C# is still a good language not only to learn but to master.

With the recent release of StackOverflow Trends we can see how popular tags have been on the platform. Considering how popular and influential StackOverflow is in terms of getting help, this data is worthwhile to look at.

Here's a look at the current list of popular languages according to TIOBE index (we'll talk more about this further down this post).

That's a lot to gather in one chart, so let's break it down a bit.

From this graph, C# was very much used due to the amount of questions on StackOverflow back around 2009.

Sure, it has steadily gone down in time and will probably continue to decrease. But think, all of those companies who picked up C# and .NET back when it was much bigger...they need to support those applications. Some may decide to rewrite them depending on their budget and what kind of experience their current developers have, but I'm sure C# will continue to run a lot of those applications in the future.

This reminds me of the current state of Cobol. A HackerRank post mentions an interesting statistic about Cobol:

70-80% of all business transactions worldwide are written in COBOL today

That's a lot of businesses still running Cobol! I believe it'll be the same with C#.

Every year for the past few years StackOverflow has conducted a big developer survey. What they find there can be very interesting!

Here's the most popular technologies of 2016:

https://insights.stackoverflow.com/survey/2016#technology-most-popular-technologies

https://insights.stackoverflow.com/survey/2016#technology-most-popular-technologies

Most popular doesn't always mean that developers enjoy working with it, does it? In terms of C#, it seems developers still enjoy it!

https://insights.stackoverflow.com/survey/2016#technology-most-loved-dreaded-and-wanted

https://insights.stackoverflow.com/survey/2016#technology-most-loved-dreaded-and-wanted

C# is here to stay

Developers still ejoy working with it, but what about the industry itself? All of the data presented so far was from StackOverflow which was derived from surveys, where people can lie if they want, or from their own data with tags, which just means people ask a lot of questions about it. The TIOBE index mentioned earlier gathers a lot more data. Here's their list of the top five languages:

Source: www.tiobe.com

Source: www.tiobe.com

Still impressive to be in the top five and I don't see it getting below that very much in the near future.


With all the debate about what will be next to learn to keep you on the edge in terms of development, a good solid understanding in C# is still a contender. Not bleeding edge, of course, unless you're getting alpha of the newest C# versions to try out new language features.

C# is a great languge to learn from since the tooling is great and there is no shortage of tutorials and courses for it.

Git Commands I Can't Live Without

Git has definitely become the main version control system developers use lately, and I admit, I got on that bandwagon when I got more into GitHub. I wanted to be more familiar with Git since I was doing more and more with GitHub.

I'll also admit, and I may be dating myself here, my first version control system that I used was StarTeam. Never heard of it? I don't blame you. Just look at the interface it had:

StarTeam interface

I used that for a few years until the company got rid of that and went to Team Foundation Server. Definitely a step up from StarTeam, but then I got started using Git. The more I use it the more I enjoyed using it.

However, I didn't get an appreciation for how powerful it was at first. I first started using Git when GitHub had their GitHub Desktop applications and used that for a while. I also used SourceTree on one project I was on.

While these applications are great, I still wanted to learn more about the commands these applications are running in the background. That's when I started to only use Git through the command line. From that challenge I set myself, I realized there was way more to Git than these applications may show. Below is a list of commands I've been using quite often, but feel they may not be as well known.

Stash

If you ever need to quickly put your current changes away so you can help work on something more important than your current task? Well, git stash is here to the rescue!

Just type in git stash and your changes are "stashed" away.

Stash newly tracked file

Stash newly tracked file

Now I can move on to working on something else while keeping my changes away for me to come back to.

You can have many as many stashes as you need, as well. If you're not sure of the ones you have, just do a git stash list and you'll see them all.

List of git stashes

List of git stashes

Oh, but you want a meaningful message when you stash to you have an idea what changes are in it? Git has you covered there, too! Just do a git stash save <message here> and git will save the stash with your message.

Save git stash with a message

Save git stash with a message

So we can save stashes in a couple of different ways, but what if we want to go back to a stash to continue our work? We have a couple of ways to do that, as well.

If you want to just apply the latest stash, just do a git stash apply.

Applying the latest stash

Applying the latest stash

If we want to apply a specific stash we can just do git stash apply <stash name>.

Apply stash by name

Apply stash by name

Note that, if you’re in PowerShell and try this command it won’t work. To get it to work, you’d have to put the stash name in quotes.

Diff

Sometimes, you just want to double check the changes you've done before adding and commiting. In that case git diff is there for that.

Git diff results

Git diff results

No need to go to a separate application just to see what the changes are. You can just look at them in the command line.


With all this said, though, there is still a ton more commands and uses that Git has that I probably have never even heard of. Because of that, as y'all could probably guess, I got a book for it!

 
 

I'll definitely be reviewing this after I go through it to let y'all know how it is overall. Just going through the table of contents indicates that it covers a lot of really useful commands.

What git commands can you not live without?

Using GIFs on Bug Reports

If you've been developing software for any length of time you've fixed a bug or two that someone has reported. Whether for a customer or a user within your organization, sometime's words of how something is fixed or how to duplicate an issue may not be enough.

Using screenshots is great to show if something is working, especially if it is something easily to show like a UI element working. However, to show that a series of steps is working with the end showing that the fix is there, I believe GIFs are a great way to include in your bug reports after a fix has been implemented.

But How Do I Make A GIF?

I primarily run a Mac, so I really love how easy Screenflow is for this. Sure it's primarily for screencasting, and I use it for that, too, but it's really easy to make GIFs with this.

Of course, there are free alternatives (before Screenflow I was using Recordit with good results) and they all are good to use in their own right. One thing I really like with Screenflow is that it is really easy to edit after recording your GIF.

Why Does Editing GIFs Matter?

The primary reason why I'd want to edit a GIF is to remove unneeded parts of what I was recording. The same thing you'd do with any video, remove any dead or time consuming parts. If you're recording a GIF to show that something is working after a fix is put in, you may have times where you're waiting for a process to execute in order to show the fix is working. Editing your GIF to remove the time it takes for the process to launch and load will reduce the length of the GIF as well as to make it smaller for uploading or viewing.

Another awesome reason I like using Screenflow for GIFs is that you can use all the advanced screencasting features Screenflow provides for you inside of your GIFs. For instance, I can zoom in on places I want to show in the GIF or highlight specific areas of the screen so the viewer can know what I want them to see.

Let's take a look at an example. I did a very quick recording of some F# using VS Code and running a selection in the FSI. Here's the GIF of that using Screenflow's editing tools.

Not the best edited example, but I hope it helps illustrate some of the things Screenflow can do to make GIFs that much better to include in bug reports.

There are a couple of things of note, though.

  • Screenflow allowed me to specifiy what area I wanted to be recorded. I just adjusted the preview window right before recording to the size I needed.
  • I did a small zoom to better show the FSI output.
  • I did a callout to show to viewers the specific output in FSI of the input I gave it.

I got Screenflow to start doing some screencasting, but since they've introduced GIF support I've been using it much more for caputuring GIFs for projects at work and uploading them to whatever bug tracker we're using (Jira, Visual Studio Team Services, GitHub) and, to me, it's been quite helpful. Often I've recorded a GIF and found something else I needed to work on for that issue before it should have been sent back as fixed.

Introduction to Paket

Paket has been quite the talk lately in the .NET community, and for very good reason. It is essentially another way to manage dependencies in your .NET projects.

But why replace NuGet?

Paket is basically a NuGet replacement so I'm sure you're wondering, "why would we need to replace NuGet?" Paket essentially just takes the functionality of NuGet and adds some extra nice features.

For one thing, Paket makes it able for you to control exactly what's happening with your package dependencies. No more conflict between different packages if those packages reference different versions of the same dependent package.

Another really cool thing Paket does is that it can reference a single file from GitHub. How many times have you needed that and just wound up downloading what you needed and using it that way? If a new version of that file comes along, you'll have to repeat that process.

But I'm already using NuGet

No problem at all! Paket has a nifty convert-from-nuget command to get you up and going.

I'm hooked...but how do I get started?

First, you need to include a .paket folder in the root of your solution. This will include paket.exe that will be used to install and restore packages.

Once that folder and its contents are there, you'll need to create a paket.dependencies file in the root directory of your solution. This file will be similar to the following:

source http://nuget.org/api/v2
nuget FSharp.Data
nuget FAKE

This file tells Paket what the sources are (NuGet or GitHub) and the package/file names so it can be downloaded.

You can then use a build.cmd file or manually call paket.exe like below.

\.paket\paket.exe install

This will create a packages folder that will include all the libraries.

From here you can always manually reference the libraries that you want, but Paket makes this easy as well. In each of the folders where you have a project file, create a paket.references file that contain the names of each library you want to be referenced, like below.

FSharp.Data

Note that FAKE isn't in the file since it won't get referenced. The paket.references file will only add to the project if the library is in a lib folder. FAKE is in a tools folder. This isn't a problem since it can be referenced manually in the build.fsx file.

To get Paket to use the references file, simply rerun the install command with the --hard switch.

\.paket\paket.exe install --hard

This will look at the paket.references file and use that to automatically reference the project with the appropriate libraries.

After that, you're good to get started on your project.

Conclusion

Hopefully this walkthrough will help you get started with using Paket to make your package management easier than before. This is still a young and very active project so I wouldn't be surprised if there are tons of things that this can do for all of our .NET projects.

Beginning Ruby for C# Developers

Ruby has become quite popular as a programming language over the past few years. Probably mainly due to the popularity of the Ruby on Rails framework. Because of its popularity, it makes sense to learn at least the basics of it and what all it can do for you as a developer.

Until I have a better solution for embedding Ruby code and output, I'm just embedding the code and results as Github Markdown for now. Even though it doesn't seem to display properly in the embed, it does when viewing the actual gist on GitHub.

Getting Started

One of the easiest ways to get started using Ruby is to just use your browser. Repl.it is a site that supports many dynamic languages to be run in a browser and it's very handy to just play around in.

I've also seen people use Sublime Text to edit their Ruby code (I admit, I enjoy using it as well as a light weight IDE. I've had no problems using the beta of version 3, either). For Windows, you'd just need to install Ruby. If you're on a Mac, you already have it installed. In fact, you can just type "ruby -v" in the terminal to see what version you have.

Since Ruby is a dynamic language, there is no compiling. However, everything in Ruby is considered an object, and because of that everything will include some built in functions with it. With everything in Ruby being an object isn't necessarily a new concept to C# developers since every object in C# derives from System.Object and you do get a few predefined functions, Ruby just seems to have gone that extra step. 

For example, say you want to run a statement three times in a row. How would you do that in Ruby? It's actually easier than just using a for-loop similar to what you would do in C# or even creating a way to use a lambda expression.

Pretty easy and very straight forward, especially for someone who may not even have a programming background.

Let's go on with a few other basics...

Output

Ruby has a couple of ways to display output back to the console. The main way is to use the "print" statement, though you may also see the "puts" (put string) command as well. The only difference in these is the "puts" command will append a new line. You'll probably see these statements quite a bit, especially if you go through online tutorials.

Methods

As mentioned earlier everything in Ruby is an object, and since that's true it can have methods on those objects. Of course, depending on the type Ruby recognizes it during runtime is what methods are available. For example, the "length" method can be used on strings but not on numbers.

Methods, like in C#, can also be chained together to give some added syntactic sugar and to reduce the overall code needed to accomplish what you need.

One final note about methods that got me confused early on but I thought was really nice is that there is a bit of a naming convention associated with certain methods. Mainly methods that change the object itself and methods that return a boolean.

Take the "upcase" method we used earlier. There are actually two versions of this method, "upcase" and "upcase!". The first returns a copy of the string being used, the second (indicated with an exclamation point) changes the instance of the string being used. In other words, the first version causes the string to be immutable.

For methods that return a boolean value a question mark is appended to the end of the method name to indicate to the developer that that method can be used for branching. Take the string's "empty?" method, for example. As you can probably tell, it returns if the string is empty or not.

Program Flow

Like most programming languages Ruby supports the if/else block. However, one noticeable difference is that Ruby also has an "unless"' keyword. It will only execute if the given conditional is false. This was included to help make certain branching more readable and a bit more intuitive.

So we can change the structure of an if/else to an unless block like so...

Further Learning

One of the best resources I can recommend to help get you on the path of learning Ruby much easier is Code Wars. This site has quite a few code katas that will help in understanding the syntax and included methods that come in with Ruby.

Codecademy is recommended a lot, as well, by people and for very good reason...they have a lot of good interactive tutorials for learning Ruby.

Conclusion

Of course, I definitely don't know everything about the language or all the tools the community uses. I still haven't gotten my head totally around gem files or rake. I'm not even totally sure of the correct structure of a Ruby application! But, hopefully this will at least spark some interest in you C# people to maybe try something different outside of the .NET world. There is plenty of fun to be had with it and I throughly enjoy learning the language and all it has to offer.

Book Review: Without Their Permission

I'll be honest, I've been excited about this book since I heard about it's release a couple of months ago. I consider Alexis Ohanian to be a true defender of internet freedom and of all the good things that can come from it. Without Their Permission definitely highlights some of the most recent awesome things that have come from the internet being free where anyone can create a site for their passion.

What's Inside?

The book is divided into three basic parts - how Alexis co-founded reddit - one of the most visited web sites today, a few examples of other websites that are changing the world, and how anyone else can do the same.

The story of how reddit was started was itself an interesting tale and perhaps even one that can be its own book since it's also an inspiring read. Who would have thought that one of the most popular web sites may never have existed.

Alexis gives a few examples of other websites that set out to help the world be a better place. With sites like Kickstarter and DonorsChoose, it's hard not to see that people really want to help...and they do. I've participated in both, myself and it is, indeed, very rewarding just knowing that I played a part in helping out.

In fact, with DonorsChoose you can get the added reward of thank you notes directly from the students of the class in which you supported. It gives the reward a bit more of a personal touch. Below is one that I've gotten recently and I can't express what I felt when I read through them.

Thank you note

The third part is where Alexis gives his advice on how anyone can create something without anyone's permission. He gives the advice based on his own experience as well as the experience when he did his investments to other web sites who he feels will help the world. He even gives ideas on how to learn to code if you've never done it before.

Final Thoughts

It didn't take me long at all to finish this book as it was an easy read. It even made me laugh a few times. I'll definitely keep this on the book shelf and will even re-read it several times.

If you're looking to start something this book will definitely be a good kick in the right direction. It even felt like the book made me want to start something at the moment I was reading it. It's not just for people wanting to start a business, it's for people wanting to start anything.

Bonus

Alexis has done quite a bit for the community as a whole. To help introduce you to his work here are a couple of things he's done.

TED Talk about social media and the power of community.

Audio excerpt from the final chapter of Without Their Permission.