Developing With Windows


Developing on Windows is a chore for front-end developers, you'll not go long without having to debug node-gyp and sifting through stacks of solutions trying to find the one for your exact situation. You'll also encounter the famous 256 character length problem on Windows, when your node_modules nesting exceeds the limit the OS can handle, after that the operating system cannot handle the paths. Another issue exists if you're used to the terminal, and commands such as grep, ssh, and other functionality doesn't translate over well.

There are a number of ways to handle this, as someone who has been extremely frustrated in the past with how a Windows operating system flows during development, I think I've found a fairly decent balance for my needs.

Acquiring Balance

I have two main devices I develop on, my desktop and my Surface Pro. There may be a simple solution for my problem, installing Ubuntu in some way. Be that either dual booting or formatting my Windows installation, that would work to solve all of my problems with Windows. I am of the inclination that Windows does certain things very well:

Running Adobe CC Software

For a standard installation of Ubuntu, you're stuck with two solutions to this huge gap in software.

  1. You install WINE and try to use the compatibility layer to run Adobe software, for everything that's not an outdated version of Photoshop you might not be successful.
  2. Trying to sift through oceans of outdated or lacking applications, GIMP makes a decent alternative to Photoshop; but I also do a little video editing, After Effects has no equal in that regard.

These simply aren't good enough, perhaps if you only needed Photoshop now and again but beware running an application through WINE comes at a heavy performance cost.

Documents

There are a lot of solutions out there for Office-like functionality on Ubuntu, it still has a certain level of sway but not as it once had in the past. However, if you're looking to do something such as simple PDF annotation, there is nothing remotely close to what is being offered on Windows. Drawboard PDF is an amazing piece of software that I have missed sorely at times.

Performance

Performance on linux is lacking for my specific hardware configuration, for example any video acceleration is severely handicapped by the poor implementation of AMD drivers. As my motherboard doesn't provide hardware pass-through, this means something such as simple video-editing cannot be hardware accelerated and becomes unbearably slow.

Enter Docker

Docker allows you to split up any application you're developing into the relevant micro-services. What this means is for something such as a typical Node.js application you can reliably separate it into different containers:

  • A container running your Node application.
  • A container running Nginx to reverse-proxy to your application.
  • A container running your database solution.

This could be further split down, for example you could split your node application into a client and an API that could then be used to power mobile applications. This has a lot of benefits, but the one that really shines for the development experience is that it normalizes your development and production environments. Your environments will be exactly the same, and using docker-machine allows you to define specific overrides for your production and development environment.

A basic Dockerfile for a Node application could look something like;

FROM mhart/alpine-node:latest

# Copy code into container
RUN mkdir /app
WORKDIR /app
ADD /src .

# Install Dependencies
RUN apk add --update make gcc g++ python

# Install Node Modules as Production
RUN npm install --production
RUN npm install -g nodemon

# Expose the container port
EXPOSE 3000

# Start the application
CMD ["npm", "start"]

This is a straightforward set of instructions, and it allows you to focus on actually developing instead of worrying about constant incompatibility errors with your operating system, conflicts with dependencies from other projects, and other issues that come with not modularizing your project development workflow.

Of course, there are still situations where setting up this type of workflow is a huge amount of overhead for the task at hand. For example I build this blog with a static site generator on my windows machine without worrying about containers and whatnot, there's next to no worries about something such as a task runner giving you any trouble. That said, there are certainly unexpected problem areas, such as image processing, which require a docker container to run on windows - but hopefully in the future when the bash implementation for Windows is working well we can throw those fringe cases to the wind.