Coder’s Vacation : My Slide Deck for the Upcoming HTML 5 Developers Conference

Continuously Kicking Ass
Continuously Kicking Ass

Web development isn’t always easy. Really, there isn’t a form of application development that is easy, there’s a lot of steps, tools, and other traps to coding. One of the best unifying ways to insure that all this complexity doesn’t kick your ass, is to implement continuous integration & delivery practices. I’m going to cover that in a talk this Monday at the HTML 5 Developers Conference in San Francisco. As a precursor to the talk, here’s my slide deck… which I’ll admit isn’t the whole kit and kaboodle, because I will haz codez so subscribe and those I’ll be publishing during this Coder’s Vacation of mine.

NOTE: Pending on levels of connectivity, I’ll be showing a number of details, examples and a little code on implementing continuous integration for JavaScript, specifically with vows and Node.js elements.

Cheers!

Coder’s Vacation : Getting Some Names…

Actual Live Status of the NameFactory Project

One of the things I’ve started working on is a #PhatData (re: my renamed version of big data) sample. So far what I’ve created is a JavaScript Application that works something like this. (The actual build status is shown to the right here in the “build status” image)

Step #1: Continuous Integration

The first thing I did was setup a solid node.js project that works on Travis CI (Continuous Integration). This is a pretty quick process. First create a directory and add an appropriate .gitignore and README.md file.

[sourcecode language=”bash”]
$ mkdir NameFactory
$ cd NameFactory/
$ git init
Initialized empty Git repository in /Users/adron/coderz/NameFactory/.git/
$ git remote add origin git@github.com:Adron/NameFactory.git
$ mate README.md
$ mate .gitignore
[/sourcecode]

The mate command is merely textmate, use whatever you’d like though to create the files. I also use Sublime 2 and other things, textmate just happens to be the poison I often choose from the command line. The .gitignore has the following to take care of WebStorm and other files that might pop up.

[sourcecode language=”bash”]
*.idea
.idea
idea
.DS_Store
*.DS_Store

lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

node_modules
npm-debug.log
[/sourcecode]

The README.md I just put the following in. You don’t really need this, but I’m showing you what should be put in a minimal project. In addition to being a good practice, we’ll need the README.md file for plugging in Travis CI in a few steps.

[sourcecode language=”bash”]
Name Factory
===
Description: This is JavaScript Node.js Project for generating random names.
[/sourcecode]

Commit those files.

[sourcecode language=”bash”]
$ git add -A
$ git commit -m ‘Adding gitignore and README.md.’
[master (root-commit) 14b1cf8] Adding gitignore and README.md.
2 files changed, 23 insertions(+)
create mode 100644 .gitignore
create mode 100644 README.md
$
[/sourcecode]

Once that is added there are some other files needed for Travis CI that I’ll add before flipping on the actual CI project on the Travis CI Website. First add a .travis.yml file to the project.

[sourcecode language=”ruby”]
language: node_js

# test on two node.js versions: 0.6 and 0.8
node_js:
– 0.6
– 0.8
[/sourcecode]

The packages file should look like this.

[sourcecode language=”javascript”]
{
"author": "Adron Hall <adronhall@gmail.com>",
"name": "NameFactory",
"description": "A library that creates randomly generated names for insert into various databases.",
"version": "0.0.1",
"homepage": "https://github.com/Adron/NameFactory/wiki&quot;,
"main": "./lib/names",
"repository": {
"type": "git",
"url": "git@github.com:Adron/NameFactory.git"
},
"scripts": {
"test": "vows –spec"
},
"engines": {
"node": ">= 0.4"
},
"dependencies": {},
"devDependencies": {
"vows": "0.6.x"
}
}
[/sourcecode]

At this point add a few tests that you know pass. I added the following examples from the vows site (this is the default example on the site).

[sourcecode language=”javascript”]
var vows = require(‘vows’),
assert = require(‘assert’);

// Create a Test Suite
vows.describe(‘Division by Zero’).addBatch({
‘when dividing a number by zero’: {
topic: function () { return 42 / 0 },

‘we get Infinity’: function (topic) {
assert.equal (topic, Infinity);
}
},
‘but when dividing zero by zero’: {
topic: function () { return 0 / 0 },

‘we get a value which’: {
‘is not a number’: function (topic) {
assert.isNaN (topic);
},
‘is not equal to itself’: function (topic) {
assert.notEqual (topic, topic);
}
}
}
}).run();
[/sourcecode]

…now make sure the tests run ok…

[sourcecode language=”bash”]
$ node test/names_object_should_exist.js
··· ✓ OK » 3 honored (0.003s)
$
[/sourcecode]

So that’ll get the continuous integration via Travis-CI for NameFactory up and running, with a Github NameFactory Repository that is ready for the name generation code to be added. For my next blog entry I’ll leap into some generation strategies, dig up some good name lists (if you know of any, leave a comment w/ a link), and work on figuring out the fastest way to generate names.

Once that’s done, it’s time to setup some distributed databases.
Shout it

Adam & Krishan Got Me Motivated Today… to toss the trash conversations

I was speaking with Krishan Subramanian (@krishnan) and Adam Seligman (@adamse) today. I love talking to these guys. They’re both smart, intelligent and upbeat guys. They see the positive things we’re all working toward and accomplishing in the technology space, specifically around PaaS, Cloud Computing and around the cultural implications of stronger technology communities, involvement of individuals. We all can see the positives, of how the industry is moving forward so that corporations aren’t the only enablers that are juxtaposed against developers or consumers but instead act to serve consumers based on the progress that individuals make themselves. There’s so much to do and so much progress to be made, the venders can simply follow the community and step up to provide points of leadership.

Absolutely great talking with these guys…

On that topic, what is it that we discussed that has me so motivated? Well there’s a few things that I’m done with and I’m going to make every effort to just throw away the trash. Here’s a few of these things that we discussed and I challenge everybody out there, drop the trash talk and let’s move forward because there is a LOT of awesome things to accomplish. Here’s the two things I’m just dropping…  cold. No reason to discuss them anymore.

  • Toss the language and framework religious wars. It is far simpler than it is sometimes perceived. We have a polyglot industry now where we can easily use the right tool for the job, the right framework, or the language that handles our particular domain the best. There is literally no reason to argue about this anymore. Of course we can talk semantics, debate best use cases, and of course we’ll talk accomplishments and what various things do well. That’s exactly what the focus should be on, not the harping on my X is better than your Y nonsense.
  • The culture war is basically over. Sure there are the hold outs that haven’t gotten a clue yet. But it’s an open source world at this point. Even the dreaded and horrible Oracle has generally conceded this and is frantically waving its marketing arms around trying to get attention. But at the core, mysql, java and the other things that they’ve purchased they’re keeping alive. They’re active participants in the community now, albeit in a somewhat strange way. Considering that even Oracle, Microsoft, Apple and so many others contribute back to the open source community in massive ways, that war can be considered won. Victory, the community and every individual in that community!
  • Lockin is basically dead. The technological reasons to lock in are gone, seriously. There’s some issues around data gravity that are to be overcome, but that’s where a solid architecture (see below) comes in. Anything you need can be contributed to and derived from the development community. Get involved and figure out how technology can be a major piece of your business in a positive way. If you design something poorly, lock in becomes a huge issue. Use the rights tools, don’t get into binding contracts, because in the polyglot world we’re in now there’s no reason to be permanently locked in to anything. Be flexible, be where you need to be, and make those decisions based on the community, your support systems, and your business partners. Don’t tie yourself to vendors unless there is mutual reasons to do exactly that. Lock in is a dead conversation, just don’t, time to move on.

So what are the key conversations today?

  • Ecosystem Architecture – If you’re deploying to AWS, Heroku, Tier 3, AppFog or Windows Azure it all boils down to something very specific that will make or break you. Your architecture. This is where the real value add in the cloud & respective systems are, but there are many discussions and many elements of the technology to understand. This is a fundamentally key conversation topic in the industry today. Pick this one up and drop the other trash.
  • Movement & Data Gravity – How do you access your data, how do you store it, where and how do you derive insight from that data? This is one of the topics that came up in our discusssion and it is huge. The entire computer industry basically exists for the reason of insight. What should we eat today, how do I shift my investments, how is my development team doing, what’s the status of my house being built, where is my family today and can I contact them! All of these things are insights we derive from computer systems. These are the fundamental core reason that computers exist. As an industry we’re finally getting to a point were we can get some pretty solid insightful, intelligent and useful information from our systems. The conversation however continues, there is so much more we can still achieve. So again, drop the wasteful convo and jump on board the conversations about data, information and insights!
  • Community Involvement – I’ve left the key topic for last. This is huge, companies have to be involved today. Companies aren’t dictating progress but instead the community is leading as it should. The community is providing a path for companies to follow or lead, but the community, the individuals are the ones that are seen and known to be innovating. This is so simple it’s wild that it is only now becoming a known reality – companies don’t innovate, people do. Companies don’t involve, people do. Individuals are the drivers of companies, the drivers of Governments, they’re the ones driving innovation and progress. The focus should now and should have always been on the individuals and what they’re working toward to accomplish. So get involved, get the companies involved as a whole and keep the semantic ideal of individuals and the progress they can make core to the way you think of communities. The idea of the “company” innovating is silly, let’s talk and build community with the people that are working around and innovating with these technologies.

Of course there are more, I’d love to hear your take on what the conversations of today should be about. What do we need to resolve? How do we improve our lives, our work and the efforts we’re working toward on a day to day basis?

Deploy a Framework Friday #4 Some Node.js .gitignore Cloud 9 IDE Sharing toward Cloud Foundry / Iron Foundry Deployment

Today’s “Deploy a Framework Friday” is a little bit of a diversion. Today Richard (@rseroter) and I dove into Cloud9IDE (@Cloud9IDE) to try out some pair programming with the online IDE sharing. We made some minor progress with Matt (@matt_pardee) & Eric (@ang3lfir3) jumping in for a few minutes. The intent of this effort was to pull together a little code to deploy, as Richard wrote about a few months ago in the article “Deploying Node.js Applications to Iron Foundry using the Cloude9 IDE“.

Here’s a video of us all fumbling through attempting to get the .gitignore file setup.

Richard Seroter (@rseroter) and I (@adron) took a stab at sharing some code, with the attempt to do some pair programming. We made a little progress, and even had some people join us live via Twitter and edit some of the code with us. For a short play by play, check out the blog entry here: http://compositecode.com/2012/08/03/deploy-a-frame…dry-deployment/

Questions:

  1. Why did the .gitignore not show up on Richard’s Screen?
  2. What were the intermittent errors that came up?
  3. Why did it say I was setup for “premium” but I couldn’t use express?
  4. Is it supposed to be that the other person can’t make changes while someone is chatting?

I’m not sure what happened (anyone at Cloud 9 IDE know what happened) when the .gitignore totally disappeared  but in the video you can see that I committed and pushed the .gitignore file. I had to recreate it to get anything to show up, and initially it didn’t seem to share either. I’m not sure how that is supposed to work, but am assuming something wasn’t setup correctly in the first place.

As for express I’ll be giving that a try a little bit later.

Next Steps Toward Deployment

Over the next few weeks or so, Richard and I will be going back and forth building a Node.js based web application for deployment from Cloud 9 IDE to our Iron Foundry Environment. Overall, this will be a slightly drawn out “Deploy a Framework Friday“, with its own sub-parts to the series.

We’ll culminate the project in an open source project that will be available on Github and also with a summary on the Iron Foundry Blog. In one of our pending blog entries we’ll draw up the architecture of the application we’ll be building out. So stay tuned!

NOTE: Working in conjunction with these other bloggers / blogs:

Deploy a Framework Friday #3 with node.js + express.js

Time for the node.js “Deploy a Framework Friday”. First get node.js and express.js installed (i.e. npm install express) and then create your node.js application.

[sourcecode language=”bash”]
adron$ express nodejs

create : nodejs
create : nodejs/package.json
create : nodejs/app.js
create : nodejs/public
create : nodejs/public/javascripts
create : nodejs/public/images
create : nodejs/public/stylesheets
create : nodejs/public/stylesheets/style.css
create : nodejs/routes
create : nodejs/routes/index.js
create : nodejs/views
create : nodejs/views/layout.jade
create : nodejs/views/index.jade

dont forget to install dependencies:
$ cd nodejs && npm install
[/sourcecode]

Once the app is installed open up the app.js file and edit the code so that it reflects what is shown below.

[sourcecode language=”javascript”]
var express = require(‘express’)
, routes = require(‘./routes’);

var app = module.exports = express.createServer();

// Configuration

app.configure(function(){
app.set(‘views’, __dirname + ‘/views’);
app.set(‘view engine’, ‘jade’);
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(__dirname + ‘/public’));
});

app.configure(‘development’, function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});

app.configure(‘production’, function(){
app.use(express.errorHandler());
});

// Routes

app.get(‘/’, routes.index);

// Cloud Foundry Environment Variables
var port = (process.env.VMC_APP_PORT || 3000);

app.listen(port);
console.log("Cloud Foundry Demo Express server listening on port %d in %s mode.", app.address().port, app.settings.env);
[/sourcecode]

The emphasis is the port variable added for the VMC_APP_PORT. This variable is needed by the Cloud Foundry system to know which port that node will use to host on, which Cloud Foundry will then intelligently map to so you will get the standard default port 80 activity you expect. For more information about all this hosting mess with node.js check out one of my previous write ups on the topic on the New Relic Blog.

Once you’ve setup this file, then just deploy using the with npm support option that states the version of node.

[sourcecode language=”bash”]
vmc push –version=node06
[/sourcecode]

For more information about deploying node apps with npm module dependencies check out this blog entry on “Cloud Foundry supports node.js modules with NPM“.

All done. Yes, there is more Deploy a Framework Fridays coming up, so stay tuned!