As part of our goal to serve up more helpful content, we have created a Q&A interview series with our experts. The intention is to help answer some common and unique questions surrounding data pipelines, consulting, and today Node.js. 

In this interview, we are excited to introduce all of you to Brad King, a software engineer at Mosaic. Brad has 20+ years of experience in software development and builds some cool, real-time web and geospatial applications for our clients. Word on the street is that Brad can build anything!

Q: What are some tips/tricks that everyone should know about Node.js?

A: Node.js allows us to use JavaScript in a server environment, but it also has a runtime architecture optimized for I/O and asynchronous operations. The current trend toward Microservices and Cloud are ideal environments for Node.js. Node is also one of the most effective ways to move into AWS Serverless technologies like Lambda. It’s just so much simpler to develop with and deploy. Rapid development, scalability, and the ability to use the same language and libraries on the client and server creates a hyper-productive environment for developers, and a strategic advantage for companies.

Q: What are some of the biggest mistakes that people make when working with Node.js?

A: I find I need to refresh my knowledge more often on current language features and refactor code I wrote as recently as a few months ago. For example, if I’m using a library like Axios to make external HTTP calls, I may have originally written it using callbacks or Promises with “then” functions. Now with JavaScript supporting async/await, there is a much cleaner way to write this code. The same could be said for something as simple as iterating over an array with forEach, which previously required an external library but is now native to the language. Don’t get me wrong; I love lodash, but just like I don’t use Bluebird for Promises anymore, I prefer to use native language features when they exist. So, not keeping up with the language and Node.js core library as well costs time and productivity searching for libraries not necessarily needed.

Q: How is Node.js relevant to data?

A: That’s an interesting question. Node can certainly be used to interface with classic relational databases and GIS databases. We use PostGIS a lot here, and can easily do whatever we need with the Node Postgres client. It gets more interesting when you look at platforms like graph databases, NoSQL databases, or API’s as data which utilize GraphQL or JSON. Node is not only supported for those architectures but is usually one of the preferred application implementations. JSON being part of the language, saves a ton of time over what legacy data formats require, such as XML parsing and data transformation. If you can store your data in JSON, you’re already a step ahead, working with data in Node.

Q: What do you think the future will be for Node.js?

A: I think it will become more prevalent in enterprise-level services and integrations as the benefits become more well known. I have a node server consuming extensive gzipped messages from an Enterprise Messaging System using AMQP for one project, extracting that payload, parsing it, and sending out optimized messages on web sockets to client applications. It barely moves the needle on CPU usage, and the code is a couple of hundred lines! Typically, this is where a larger development investment would have been made to create a Java application. Less code not only reduces development investment, but significantly reduces costs related to bugs and maintenance as well. Those savings are significant! The momentum of the Open Source community is with Node. I think NPM now has over 1 million Node.js libraries available, which is astounding.


0 Comments

Leave a Reply

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