Developing software on Surface Go 2

My previous post about Surface Go 2 was brief introduction based on my own experiences after one month of using it. Surface Go 2 is lightweight machine with limited hardware resources. It’s not your next portable dev machine as it’s more to the tablets world but still there are some software development options to consider before buying Surface Go 2. Here’s my advice.

It’s all from real life. Before and during writing this post I tried out all options described in this post. I used real ASP.NET Core project I’m writing for one of my customer and I tried to complete real tasks on Surface Go 2.

1. Remote Desktop to in-prem machine

Maybe the easiest way to build software on Surface Go 2 is to have VPN connection to company network and use Remote Desktop to connect to main dev box. All you need to do is to set up VPN connection in your Surface Go 2 and you are good to go.

If you are working from home like me then probably you are interested in connection to machine located in your home network. Yes, sure, you can open Remote Desktop port in your router and redirect all traffic to your dev box but stop for a moment. It’s not secure. Depending on router and its software you can probably set up VPN right in your router. I strongly recommend you to do it to keep your machines and home network safe.

With RDC you can configure screen size and resolution of session to remote machine. With very low settings you should be able to have stable connection to dev box even over slow network.

Pros

  • Energy efficient as Remote Desktop has compact protocol
  • Leaves enough resources for other applications to run

Cons

  • No chance for offline work
  • Not all applications scale on screen over Remote Desktop
  • Sometimes it’s not so easy to get VPN to company network
  • For home network all security is up to you

2. Remote Desktop to cloud machine

If you don’t want to buy hardware for dev box and you prefer to go with what cloud environments offer then you may have your virtual dev box in cloud. On Azure you can set up different virtual machines and use Windows or Linux as operating system.

On Azure virtual machines have nice feature – automatic shutdown. If you leave virtual machine running when you finish your work then it still consumes resources and grows your bill. And it’s easy to forget virtual machine running. With automatic shutdown feature you can set time when virtual machine is shutdown automatically. If you vote for Azure cloud I strongly recommend to use this feature.

With virtual machines on Azure you have two options to get connected – Remote Desktop and SSH. If you prefer Remote Desktop then it’s practically like the first option discussed here. On Azure you can have virtual network and VPN gateway to make your dev box accessible only over VPN. But be warner – this option comes with high price tag.

Pros

  • Energy efficient as Remote Desktop has compact protocol
  • Leaves enough resources for other applications to run
  • You can set all things up exactly like you wish

Cons

  • You need stable network connection to use Remote Desktop
  • No chance for offline work
  • Not all applications scale on screen over Remote Desktop
  • VPN gateway service is expensive

3. SSH to remote machine using Visual Studio Code

No matter where your dev box is located, in some cases you can keeps things smaller when accessing your dev box over SSH – be it Windows or Linux machine. And what’s best – Visual Studio Code has extensions for SSH.

What it means? You can run Visual Studio Code straight on your Surface Go 2 and connect to your project folder in dev box using SSH. User experience is practically the same as using Visual Studio Code for local development.

What’s still up to you is to organize dev machine and host it somewhere – be it company network, cloud or your home network.

Pros

  • It’s Visual Studio Code with all goodness running on your machine
  • Enough resources to run other programs too

Cons

  • No option for offline work
  • You need stable internet connection
  • Hosting and managing of dev box is up to you

4. Using Visual Studio Codespaces with Visual Studio Code

Visual Studio Codespaces is online service by Microsoft that you can use to run virtual dev box on cloud and write code using Visual Studio Code or online code editor provided by service.

This option is a little bit similar to SSH to remote machine using Visual Studio Code but instead of machine set up by you there’s VM set up by Codespaces service. When configuring this machine you will specify code repository, size of machine and idle timeout. If you have not used your VM for specified amount of time then Codespaces service will shut it down to save expenses.

Pros

  • Usual Visual Studio Code experience with all its goodness

Cons

  • Not an option for offline work
  • Service has only Linux boxes right now
  • Not much options to configure your VM

5. Local development with Visual Studio Code

If you don’t have complex application to build then it’s also possible to build it locally on Surface Go 2. This option is perfect for more lightweight solutions like web applications, Azure Functions and console applications.

Some of my readers probably want to ask now – but what about database? Surface Go 2 is not for running SQL Server, even Express Edition will be overkill for this machine.

There are few things you can do:

  1. Connect to SQL Server hosted on some other machine. It’s not perfect choice, specially when SQL Server is located thousands of miles away. The closer you are to SQL Server the better connection you have.
  2. Use SQLite on Surface Go 2. You can use SQLite as it is small and lightweight. You get something close to relational database but consider one important thing – SQLite is not SQL Server. Make sure you have unit and integration tests for your code to make sure that your LINQ-queries are translated to correct SQL Server commands. SQLite is supported by NHibernate and Entity Framework Core.
  3. Use in-memory database of Entity Framework Core. In-memory database that comes with Entity Framework Core doesn’t have any files on disk. It lives only in machine memory until your program is running. When program is stopped then in-memory database is gone. Again – in-memory database is not same as SQL Server and I strongly recommend you to use tests to make sure that code you wrote works well with SQL Server too.

If you are using Entity Framework Core or NHibernate as you object-relational mapper you can be sure both of them support SQLite. If you wrote your own data layer then things may get very complicated on supporting different database products and I highly recommend you to use database in some other machine.

Pros

  • Visual Studio Code with all plugins and extensions you need
  • Work online or offline
  • It’s possible to use SQLite or in-memory database to mimic real databases

Cons

  • When offline you have no access to real databases like MSSQL, MySL, Postgre etc
  • Building of solution may drain the battery fast
  • When travelling it’s easy to forget to commit code changes back to repository

Conclusion

Although Surface Go 2 is not for software development but targeted more to business people it is still possible to use it for coding. Sure, it will not be the main dev box but it’s excellent complement to it for days when there are meetings at customer site or you need to travel from one place to another. If you really plan to use Surface Go 2 for software development then I suggest LTE version as it’s always connected and you don’t depend on availability and stability of near-by WiFi.

Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

    2 thoughts on “Developing software on Surface Go 2

    • October 20, 2020 at 11:05 am
      Permalink

      Thanks for the great review, I am also considering a SP2 for media consumption and ‘armchair dev’ via vscode SSH when I am away from my desk.

      Would you be able to comment on battery life (generally in terms of media consumption and also when running vscode).

      Thanks

    • October 27, 2020 at 9:38 am
      Permalink

      I tried out VS Code on SG2 and after 2.5h us drive I had 40% of battery left. So I think per one charge you will get ~3.5-4h time for VS Code. I’m not sure about media. It depends on video quality. Full HD is easier task for machine than 4K, by example. So, factors like these will all matter.

    Leave a Reply

    Your email address will not be published. Required fields are marked *