The fundamental processes behind business and software development are very different, and it’s often the reason why getting the two working together can be challenging.
In business, you’re often able to test ideas quickly and without major costs, which means that an experimental approach to development is common. In software development, you aren’t able to test your ideas as quickly, because you need things to be stable and that costs time and money. This means that software development depends on well-specified needs that business people have a hard time articulating, because they are not used to doing that.
There are many ways to go about improving this. One option is prototyping, and another option is for the business people to acquire a better understanding of how software development works, thereby improving the foundation for good communication.
I think learning Node.js with Express.js can be a great way for business people to gain an understanding of how software development works that lets them improve the relationship in two different ways: by building prototypes that can help them explain what they want, and by being better at speaking the language of developers.
It has a big and active community that builds awesome frameworks and modules, so when obstacles arise, chances are good that you can find a module or a fellow developer that can help you out. This keeps you moving forward.
Node can be used to a lot of other things too, like building a web or chat server, and that encourages you to try and understand how it all works together, and it makes you feel very empowered by just learning one language.
It’s super easy to install, and it’s amazing how quickly you can get an app running. The only steps you need to go through are1:
- Install Express.js:
npm install express
- Generate the app:
- Install dependencies:
cd myapp && npm install
- Run the app:
- Access the app at:
Express defaults to using Jade, which is a template engine (in other words, a different way to write HTML and insert data into it) for Node. But, if you prefer using HTML and Handlebars.js, you can do that. First, install a few packages:
npm install html npm install hbs
Next, change some settings. In the
app.js file, change
app.set('view engine', 'jade') to
app.set('view engine', 'html').
Then, configure the app to use
hbs by adding this line:
index.html and have it print the title with HTML and Handlebars.js:
Relaunch2 the app, go to
localhost:3000, and it should display the title that is set in the route.
The framework doesn’t make any assumptions in terms of how you want to structure your code, so you’re free to do what makes sense to you for the current project. That can be a bit confusing at first, so let’s look at an example of how you’d begin the development of an app.
Let’s say that you want to have a page that shows some numbers about your business. To handle that, you’ll need a new route and a view, and you’ll have to tell the app where you want the page to be.
- Add a
numbers.jsfile to the routes directory, and paste in the code from the index route. Configure it to render the numbers view instead of the index view.
- Add a
numbers.htmlfile to the views directory.
- Add this line to your
By adding this line of code, the numbers route will be called when
/numbers is requested, and the route will then grab the data and render the view.
You can now start adding logic to the route that gets the data you need, but you’ll soon need a model that can take care of pulling in data from other services such as a database. Express doesn’t suggest a place to keep the models, but as long as you only have a few, just put them in the root directory. As you app grows, and you get more routes, views, and models, you can adjust the structure to your liking, and by that time, you’ll know exactly what that is.
In summary, Node.js with Express.js is great for business people, because it’s easy to learn, it can be used to do a lot of different things, and it encourages you to understand how the Web works. It empowers you to build things quickly and iterate until you’re happy, which is a great way to prototype and demonstrate your ideas.
So, if you’re a business person (we all are), and you have ideas that you’d love to see brought to life (we all do), consider Node.js with Express.js. It’s awesome.