Developing While On-the-go

. 7 min read

It's 2019 and all my cool friends are either on a MacBook or running Linux on Thinkpads or XPS laptops for some time now. That's all they need... apart from one or two additional screens when they're in their offices.
For me, on the other hand, a desktop machine running Visual Studio on Windows with a bunch of big screens is still an unbeatable setup. This becomes a problem whenever I need to do something outside of the office, or show a demo at a conference or even worse - run a whole day workshop.
To make things even worse, my laptop is a 15" MacBook Pro. Don't get me wrong... it's a great laptop... except when you want to run Windows on it :)
The reason why I have a MacBook is Xamarin, and the reason why I want Windows, even in a situation when I could be developing directly on macOS, is because I'm more productive with the real Visual Studio combined with Resharper than with anything else on macOS.

IDEs available on macOS (only for code that can run on macOS)

Visual Studio Code

The first thing that comes to non .NET developers mind, at least lately, when you mention Visual Studio is Visual Studio Code. It's a cool editor once it starts, and you can perform some hotfixes on your code, but let's be serious... it's not an IDE.

Visual Studio for Mac

Visual Studio for Mac is getting better and better with each release. Although some are saying that it's a rebranded Xamarin Studio and that Xamarin Studio was just a rebranded Mono Develop, it's so much more. Among other things, it supports Azure Functions development which is splendid. Unfortunately, when you get used to Visual Studio + Resharper, you just can't be serious and consider Visual Studio for Mac as a proper replacement.

JetBrains Rider

Rider from JetBrains is a newer contestant, but a challenging one. The most important thing is that it's being developed by the company that develops Resharper, and it's basically built on the same firm foundation as their other IDEs like Android Studio. What else do we have to say expect that Rider has Resharper "integrated"? My reaction when I've heard about it was "take my money".
Although I can't easily debug Xamarin applications from it, everything else seems to be more accessible, faster, and more fluid to perform compared to Visual Studio for Mac. It took me only a few trips outside of the office to start using it whenever I need to review or fix some code. However, unfortunately, like all things that aren't running on Windows, it can't run code that's not .NET Core, and when you have enterprise clients, that's a huge issue.

Another issue I've had with both Visual Studio for Mac and Rider was the fan noise while I wasn't doing anything really... on some occasions the laptop would get hot and sound like it's taking off. As soon as the apps were terminated, the laptop would cool down. It turned out that for the last 2-3 months the laptop heats less with virtual Windows + Visual Studio + Resharper on Parallels, than with just Visual Studio for Mac or Rider.

Let's run Windows

Bootcamp

The first thing that comes to your mind is to split the hard drive and run Windows "directly" on your MacBook by using Bootcamp. That works, and Windows run fast, but with many problems. Although Apple is developing drivers for Windows, those are just lame. The best touchpad around suddenly becomes something that's almost unusable. Battery life drops by approx half, etc.
There are some third-party drivers which in turn occasionally surprise you with a Blue screen of death.

Parallels

Next step - virtual Windows using Parallels. I know that VMWare has their equivalent - Fusion, but Parallels seems to be working better (a purely subjective and anecdotal evidence).
This solution works lovely until you start doing something CPU intensive... like starting Visual Studio :) Although it can run Visual Studio, when you're using Resharper on projects bigger than "Hello World", or you even dare to fire up 2-3 instances of Visual Studio, the laptop starts getting hot, and once it does the fan fires up and everyone around you turns their heads to you and wondering what's going on...
Also, since I have "only" 4 cores on my laptop, and since we're talking about a mobile CPU, once you give 2 or even 3 cores to Windows, not only that Windows isn't as snappy as you'd like, but macOS suddenly becomes sluggish.
Just keep in mind that I'm talking about all these experiences from a desktop machine user point of view. If you can get past some of the things, Parallels makes Windows development incredibly usable.

Bootcamp/Parallels "hybrid"

Also, if you'd like to try both Bootcamp and Parallels, Parallels allows you to fire up your Bootcamp Windows as a VM. In that way, you can get access to "virtual" Windows when you need to do something quick, or you want to debug an iOS app from the real Visual Studio and you can always switch from macOS to Windows to get faster Windows with worse battery life.
Just keep in mind that you should always shut down those Windows when using them through Parallels to keep them sane and healthy.

Remote Windows

Connecting to remote machines through Remote Desktop isn't anything new... I've been doing it for 20+ years even through 33.6 kbps modems :) The difference is that now I'm not trying to just remote control a machine, but to get a fluid development experience, meaning that the connection should be stable, artifacts shouldn't appear on the screen, the remote machine should be powerful, my laptop shouldn't heat up, etc.
One huge benefit of working on remote machines that are connected to a proper Internet connection is that all of a sudden you can do your work even on a lousy Internet connection. (You don't even have to go to a desert or a third world country... you can just move 10 km outside of town, into a small village where I live and you'll be greeted by a sluggish Internet connection... or you won't if it just broke...)
Developing on a lousy Internet connection makes your life extremely difficult. Even small tasks like git pull will take time and tasks like connecting a remote debugger to a service running on Azure will make you want to pull out all your hair.
So, although you can't even open a proper web page without having to wait, and wait, and wait, RDP has such a low bandwidth demand that your dev experience becomes much better, and once you're connected to a powerful machine with a proper Internet connection you can do wonders.
Additionally, you won't have to worry about IP address/country whitelisting, connecting from different machines, etc.

Connecting to your on-prem machine

The first thing I wanted to do was to connect to my desktop machine in the office. One reason was the price - there's no additional cost except a tad of electricity, and the second was having only one environment to maintain.
Now let's talk about the problems...

  • Once, the power was shut down for the whole neighborhood when I needed my machine
  • The router had a quirky day and dropped the connection a few times while I was trying to showcase something
  • My computer decided it was time to perform Windows update, and shut down afterwards... naturally, at the time I haven't had Wake On LAN set up, so I had to sit in my car and drive to the office to start the machine
  • You're in charge of maintaining the whole infrastructure, including VPN, network, security, UPS, notifications, etc

So something that seemed cool turned out to be really expensive and time-consuming experience.

Using an Azure VM

Whenever this came up as an idea to me I've quickly dismissed it with the "argument" that it was too expensive... so I've only used them when needed.
One day I've decided to put together a list of all the tasks that I had to perform to keep the on-premise environment "always" ready for me. I've estimated how long it took and multiplied the numbers with a junior developer hourly rate (the idea was that perhaps it's easier to hire a junior to take care of the environment). My reaction was "wow, Azure is so cheap all of a sudden"!
After some exploring and testing, I've decided to go with Standard_F4s_v2 VM size. It's fast enough for what I need and I can always scale it up or down.
I've also scheduled automatic shut down at 2 AM every day, so even when I use the VM on every workday, I end up using it for less than 30% of a month, and thus the bill at the end of the month is less than 30% of what it would cost me to keep the VM up and running 24/7.
Also, guess what... running a VM in the same data center as the service to which you're trying to connect a remote debugger makes debugging an enjoyable task.

A mix of everything

Now that we've gone through a bunch of options, it's time to wrap it up and see what I've found to be the best setup for on-the-go development.
I tend to prefer macOS solutions because it's much faster to fire them up. That means that I'm doing small fixes in Visual Studio Code and some more complex tasks in Rider. Visual Studio for Mac just doesn't seem to be my cup of tea, so I only fire it up when I need to debug something for Xamarin.iOS.
As for Windows, as long as I have an Internet connection that doesn't drop, I'm using my Azure VM - and love it. I've even started using it from my desktop machine for some tasks because it's so much easier to have just one environment to maintain.
Also, for those rare situations without an Internet connection, or when I need to demo debugging Xamarin.iOS apps from Visual Studio on Windows, there's my Parallels installation of Windows.
That means that I still have four environments to maintain, but hey... I wanted to be able to do "everything" outside the office!