The success of software development is as much about the development environment as it is about the developer. In this article we will construct a suitable NodeJS development environment for our future series of articles.
The next three articles serves as both a practical exercise for the readers of the popular ‘essentials’ series as well as an introduction to software developers following the ‘developer’ series. In the past we have learnt about the internals of an API as well as how to build a good API. This series will assist software developers to follow the API life cycle using good documentation and design practices. As a starting point the tutorials contained herein will be based on NodeJS using the popular RESTify framework.
In this article we will take a staged approach in establishing the ideal development environment.
There’s so much debate on which operating system is ideal for the development of a particular language that many of the debaters miss the fundamental issue: never use your primary operating system for development.
Despite creating the next ‘big thing’ software development is a rather destructive process requiring the installation of multiple tools, libraries and other development assets and that’s before running potentially bug infested software.
For very good practical and sane reasons the first tool that should be installed is some sort of virtualization software whether it be VMWare, VirtualBox or Parallels for the OSX folks. Thereafter one can enter the debate of which environment is more suitable.
Over the years I have developed a philosophy to have my development environment resemble the expectations of production as much as possible. If I know that an API is going to be running on a Linux machine I will make use of a Linux development environment and likewise for Windows. Although my primary machine is a MacBook Pro thanks to virtualization software I can emulate any number of environments.
For most of these tutorials I will make use of Ubuntu 16.04 which is easily installed either automatically or via its .iso file in a virtualized environment. However as NodeJS works in other operating systems too you are free to install whichever you are comfortable with as the tutorials and commands do make it easy to adapt.
Although just about any development language can be used to build APIs we will be focussing on the high performance NodeJS development language.
Binaries for NodeJS can be found at https://nodejs.org/en/download/. Windows, Linux and macOS are supported. It is probably best to install the ‘LTS’ version for long term support and stability.
As written previously we will be installing the RESTify API framework for NodeJS. RESTify is a high performance API framework capable of significant throughout. More information is available at http://www.restify.com
When NodeJS was installed two additional commands were made available. ‘node’ is used to launch the interpreter and ‘npm’ is used to install packages. NPM (or node package manager) is a command-line application to search and install suitable libraries for use in NodeJS applications. Although a console driven interface is available to search package the sheer number of available packages makes it a very inefficient method. For this reason I recommend using https://www.npmjs.com/ to research new packages.
NPM can install packages either locally on a per-application basis or globally as the needs dictate. For now we will not need to install any packages as this will be managed by the sample code later.
Integrated Development Environment
IDE’s as a minefield and every vendor has an opinion on which one is best. Ultimately any IDE requires a period of time with which to evaluate and properly learn so take some time to research and experiment.
I have been crunching code well before IDE’s made us lazy so I don’t use any IDE other than ‘vim’ on Linux machines for most of my development irrespective of language. However you may have success with other IDEs such as Komodo, IntelliJ, Eclipse or any others which suite your requirements. In these tutorials I will not be displaying any one particular IDE.
Source Code Management
To retrieve the YourAPIExpert examples as well as code from other developers hosted on GitHub or other sources you will need to make use of a source code management tool.
Generally I make use of the ‘git’ command line tool which is installed via the package manager on Linux (‘apt-get install git’ if you’re on Ubuntu) but recently a very nice GUI based interface has been made available by http://www.syntevo.com/smartgit/ which is free for non-commercial use. SmartGit is a very clean and intuitive interface to the git command line and simplifies most of the tasks greatly.
Once your chosen git tool is installed feel free to checkout the YourAPIExpert repository on GitHub.
In our next article we will learn how to check out code and will explore the design, development and testing of a basic API.