Creating a Virtual Machine

In this post I will share how to create and minimally configure a Virtual Machine on VirtualBox.

Note: this post is a part of the series of posts about my experience using Ubuntu Desktop for software development.

 

Creating And Configuring Virtual Machine

After starting VirtualBox application you will be greeted with Oracle VM VirtualBox Manager. As you can see on the following image – I already have Ubuntu Desktop 16.04 created but we’ll create a new one from scratch.

post-13-02

Hit the New button on VirtualBox Manager and in Name and operating system provide the following information:

Name: Ubuntu 16.04 Desktop Blog (or choose your own)
Type: Linux
Version: Ubuntu (64-bit)
Memory size: 2048MB (you can keep the default 768MB and increase the size later)
(*) Create a virtual hard disk now

Continue reading “Creating a Virtual Machine”

Creating a Virtual Machine

Installing VirtualBox

In this post I will share how to install VirtualBox and what version worked for me.

Note: this post is a part of the series of posts about my experience using Ubuntu Desktop for software development.

 

UPDATE: after working with different combinations of VirtualBox and Ubuntu Desktop I found that the following versions/build work very well with each other:

 

Downloading VirtualBox

You can download the latest version of VirtualBox following this link. After you download the DMG file, just double click on it and follow the installation instructions. It does not require any setup after installation.

post-15-01

 

See Also

Installing VirtualBox

My Choice of Hardware, Host Operating System, Virtualization Product and Linux Distribution

Note: this post is a part of the series of posts about my experience using Ubuntu Desktop for software development.

 

My Choice Of Hardware

As I mentioned in one of my previous posts – almost a year ago I got MacBook Pro and it proved to be a terrific choice.

post-14-01

 

My Choice of Host Operating System

Since I’m using MacBook Pro, my obvious choice for the host operating system is Mac OS X. Even though I love Mac OS X and like the development experience on it, for experimenting with new technologies I prefer using virtual machines (VMs). The reason is simple – if something goes wrong – it would take me long time to reinstall (or restore from backup) Mac OS X and applications I use. But with virtual machines everything is expendable – create virtual machine, instal operating system, SDKs, tools, etc., use it and when you done – just delete it if you do not need it any longer. The huge benefit – your primary operating system stays intact.

post-14-02

 

My Choice Of Virtualization Product

Initially I was a happy user of Parallels Desktop until they rolled out update 11.1.2 which made a lot of people angry and made me to roll back to version 11.1.1 and reinstall all of the guest operating systems. As a result – I started looking for alternatives and now VirtualBox is my virtualization product of choice.

post-14-03

 

My Choice of Linux Distribution

There is no shortage of Linux Distributions. Currently I’m experimenting with Ubuntu Desktop 16.04 LTS, but I’m open to experiment with the others as well.

post-14-04

 

See Also

My Choice of Hardware, Host Operating System, Virtualization Product and Linux Distribution

Using Ubuntu Desktop for Software Development

In this series of post I will share my experience using Ubuntu Desktop for software development. I plan to experiment with many different tools, languages, editors, development environments, SDKs, etc., so the posts will include various installation and setup steps which I plan to keep short and mostly independent of each other.

post-13-01

 

Installation And Configuration

Using Ubuntu Desktop for Software Development

Null-Conditional Operator in C# 6.0

If you’ve read blog posts or even MSDN articles explaining new features in C# 6.0 – I’m sure you’ve learned that the null-conditional operator in C# 6.0 will help you to greatly reduce the number of hard-to-debug and hard-to-reproduce NullReferenceException-s.

When I first read about this operator, the only thing that registered in my mind was that it helped you to chain null checks, especially for descending into data structures, and short-circuit the rest of the checks as soon as you hit null somewhere in the chain. So, I thought it was just a mere convenient syntactic sugar.

But I still did not completely understood the true power of this operator. I’m usually pretty meticulous about null checks and have a lot of C# 5.0 code like this:

private static int GetCurrentSpeed(Car car)
{
	if (car != null && car.Engine != null && car.Engine.ControlUnit != null)
	{
		return car.Engine.ControlUnit.CurrentSpeed;
	}

	return 0;
}

And I was debating whether it was worth it to go through the code base and refactor it to use null-conditional operator. Would I gain anything? Was it worth it just to have the code to look like this:

private static int GetCurrentSpeed(Car car)
{
	return car?.Engine?.ControlUnit?.CurrentSpeed ?? 0;
}

Okay, I cut 5 lines of code, what’s the big deal?

Continue reading “Null-Conditional Operator in C# 6.0”

Null-Conditional Operator in C# 6.0

The Elegant Code I Wish I Can Write In C# 7

In my previous post Better Functional Programming Support Is Coming In C# 7  I argued that by the time you get a chance to write in C# 7 you should already be familiar with Functional Programming paradigm. But since you cannot use C# 7 at the time of writing – you should definitely consider F# for learning the concepts of Functional Programming. I hope we’ll be able to write elegant declarative-style code in C# as we do in F#.

It is hard to convince somebody to spend their time on something new without showing immediate benefits. But the benefits usually come in the form of idiomatic language features which can be overwhelming at first. I hope this post will show you immediate benefits of Functional Programming by looking at real code example and understanding the features one-by-one. I do not intend to present all of the features of F# – just enough to get you interested in Functional Programming.

Recently I have been watching Pluralsight course F# Fundamentals by Liam McLennan and stumbled upon this elegantly crafted code (fast forward to 0:46):

let rec quicksort = function
    | [] -> []
    | x :: xs ->
        let smaller = List.filter ((>) x) xs
        let larger = List.filter ((<=) x) xs
        quicksort smaller @ [x] @ quicksort larger

I was just amazed how much functionality was packed into these 6 lines of code! If you are new to Functional Programming and F# in particular, it could be hard to appreciate this code, so let’s review feature-by-feature what makes this piece of code so elegant and powerful.

If you are curious to see how quicksort implementation looks in C# – scroll to the bottom of the post.

Continue reading “The Elegant Code I Wish I Can Write In C# 7”

The Elegant Code I Wish I Can Write In C# 7

Better Functional Programming Support Is Coming In C# 7

I have recently listened to .NET Rocks! episode #1272 Looking into C# 7 with Kathleen Dollard where she mentioned that the next version of C# will have better support for tuples, immutability, records and pattern matching. You can download the episode and fast forward to 27:04 and 30:04 respectively. If you are interested, you can review the C# 7 Work List of Features (revision circa March 24 2016). You can familiarize yourself with support for these features in C# 7 right now, but since it is pretty much still work in progress, by the time it hits CTP or even release – there is a big chance it will look different.

So, what can you do in the meantime? Fortunately, Visual Studio ships with F# and you can start learning above mentioned Functional Programming concepts right now. Remember, F# is just another CLR language as C# is and many features like Generics and support for async/await came to C# from F#. When it comes to Functional Programming I hope this trend will continue.

Continue reading “Better Functional Programming Support Is Coming In C# 7”

Better Functional Programming Support Is Coming In C# 7