In the early days of JavaScript there were few options for debugging large web applications. You could have used the multiple alert notifications or possibly even calling document.write to write messages into the document. Firebug changed web developers lives, and I think how we view JavaScript, by making it incredibly easy to debug HTML, CSS, and JavaScript. Since Firebug, most current versions of web browsers include powerful debugging tools. In addition to the debugging tools browsers have made available a JavaScript console object to help write debug statements. With console, there is no need to pop up alerts to inspect the state of an object. To write a log message intended for the console, just write the following JavaScript statement in the right place.

To open the console, you can find it in Safari by looking for the the Web Inspector, in Chrome it’s called Developer Tools, and in Firefox you’ll find it under the Tools menu as Web Console.

The console object has a lot of useful debugging messages for errors with different severity, such as log, debug, info, warn, and error.

console.info("I'm here.");
console.warn("Do I smell smoke?");
console.error("The roof, the roof, the roof is on fire.");

In addition to logging String messages, you can log whole JavaScript objects. It may be useful to inspect a complete object and it’s state. To write out the state of an object to the console use the dir method as in the following example.

From time to time I just blast tweets about software development, project planning, team dynamics, or whatever else comes to mind. Here is a synopsis of recent tweets and rants. If you want to follow the conversation follow me at techknow and/or juixe.

Software Development

Say no to consultant code. No to complacent code. No to sloppy and crappy code. No to cut and past code.

Developing a machine learning algorithm so we don’t have to learn anymore.

Hacking, art or science!?

Great hacking weather… Well most weather is great hacking weather as long as your computer don’t overheat.

What would an autonomous algorithm do?

Sex, drugs, and hacking.

You don’t go on Hacker News to show off your project, act arrogant that it’s a closed network, and not expect someone to hack a clone.

Nothing worse than setting a test to run overnight only to have a Windows update restart your computer in the middle of the test/night.

Refactor with conviction.

Building on assumptions is like building on quicksand.

When in doubt, step through it in a debugger.

Team Leadership

Every problem is an opportunity in the rough.

Mo’ money, mo’ problems. Mo’ problems, mo’ opportunity.

Ask the right questions is better than making the wrong assumptions.

Everything is mental, even when it’s physical.

Being successful means you are only a mistake away from not.

Don’t use the fact you don’t know a fact as a reason for not knowing it.

Just because a team member knows one thing does not excuse the rest of the team from learning for themselves and knowing it too.

A team is composed of a group of individuals, but a group of individuals is not a team.

Product Placement

Google used to be a search engine and return search results now it wants to be an answer engine and return you the answer.

What do you call a Pinterest user? Pinner? Pinhead?

Facebook IPO: it’s complicated.

How hard is it to add filters to Flickr’s iPhone app?

These @calottery lotto ticket should have a QR code so that I can quickly scan to see if I’m a winner.

The Google of today is the sort of operation that Sergey and Larry originally set out to disrupt.

Somewhere some evil genius is building a super computer out of a cluster of The New iPad.

AT&T is in the phone business, so of course when you call customer support they will always have you call someone else who transfers you that gives you a different number that redials…

I’ve always been interested in understanding common programming errors so that I can easily recognize and diagnose problems, hopefully without spending hours staring at my breakpoints in my debugger. Previously, I’ve written on Common Groovy Errors and Top Worse Java Errors.