Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Taming JavaScript

Edward Hieatt
Thursday, May 17, 2007

The explosion of client-side JavaScript in Web 2.0 applications has taken many developers by surprise. I’ve often found that more senior members on web development teams shy away from JavaScript coding, preferring the known quantity (and perceived purity) of server-side development. After all, isn’t JavaScript that flaky, inconsequential language that we used to use to make pretty pull-down menus, but that can’t be relied on for any serious purpose? Since when did it become something that I can’t leave to my UI designer? Can’t I just Google for a script kiddy’s website any more? Do I really have to start taking JavaScript seriously? Well, yes. These days, it’s becoming inevitable that the majority of the team comes into contact with client-side JavaScript. But still some of us resist it, largely due to painful past experiences of long nights spent trying to get browser X to work the same as browser Y.

As a consequence, I consistently observe two patterns over the course of a project. First, the client-side effort doesn’t get the benefits of the skill and experience held by seasoned object-oriented developers. Instead the JavaScript code is left to newer, less experienced members of the team; the rigorous practices that the more senior members of the team usually insist on aren’t advocated for to the same degree on the client side. Second, because of the fear of JavaScript, opportunities to make the application slicker, more user-friendly and generally more modern are missed.

I don’t mean to downplay the difficulty of JavaScript coding. There’s no doubt about it: it’s eccentric, it’s not consistent between browsers, it’s slow where you don’t expect it, it does objects in a weird way, and the list goes on. But here’s where we can turn the situation on its head. What does our experience tell us about how to attack a difficult area in our code? It certainly doesn’t tell us to ignore it and hope it works out in the end. No, it tells us to shine a light on the painful area and apply our development practices even more strictly than usual: test-drive it, cover it with unit and functional tests, aggressively refactor it, separate concerns, extract the right objects, apply design patterns where they can help, and so on.

What I’ve seen work when it comes to JavaScript is to fight fire with fire. Rather than responding to the difficulties of JavaScript by shying away from it and rationalizing a lack of quality in our client-side code, we can choose to react by applying our practices more strictly, not less. We can ask ourselves how to better test their JavaScript, how to expose complexity more clearly, how to objectify concepts more naturally. We can break our JavaScript into layers, and apply typical MVC patterns as we might do in server-side Java or Ruby on Rails code. We can abstract our AJAX requests and responses in order to better simulate them in our tests. We can run our tests in a continuous build on all our target browser/platform combinations. Why not try to hold our JavaScript to the same standards as any other part of our code? It’s not always easy, and it certainly takes practice and strict discipline. I’ve found that the learning curve is steeper and longer than with other languages. But I’ve also found that there’s really no reason why we can’t be as rigorous with our client-side development as we are anywhere else in our codebase as. We end up with all the usual benefits: better stability, fewer bugs, more malleability.

Getting started

Amongst other topics, over the next few weeks I’ll be posting concrete ideas for ways to approach JavaScript development. Most of them will center around JsUnit, because in my experience it’s the introduction of unit tests and test-driving that drive the most dramatic improvements in not only the software but how we think about our work.

So, what does it look like when a team attacks JavaScript in this way? As someone who has been through his fair share of pain coding JavaScript, it’s thrilling to observe. I’ve seen teams at Pivotal Labs take a more disciplined and rigorous approach to JavaScript than I could have imagined even a couple of years ago. And the best part is that besides the benefits I already mentioned, there’s a huge payoff to all this added discipline: rather than being afraid of JavaScript development, we sometimes enjoy it and look forward to it. It’s simple, really: JavaScript is hard, so let’s throw everything we know at the problem. I’ve found that if we do, we can tame JavaScript to the point where our progress becomes as predictable as we expect in the rest of the codebase.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Add New Comment Cancel reply

Your email address will not be published.

Edward Hieatt

Edward Hieatt

As Chief Operating Officer, Edward Hieatt oversees all operational aspects of Pivotal Labs’ consulting business including engineering, client services and the company’s open source product strategy. In this role, he drives revenue growth and performance, and is responsible for managing all regional offices across the US and overseas.

Edward ensures that Pivotal’s development teams identify, anticipate and exceed client expectations for their products. His engineering organization is acclaimed for delivering rapid, high-quality, sustainable, iterative development services.

With experience as a software developer and an engineering leader responsible for delivering web and mobile applications as well as large-scale enterprise infrastructure projects, Edward brings deep insights to the COO position. After joining Pivotal as Principal in 2003, Edward was responsible for leading dozens of client engagements, and was instrumental in defining Pivotal’s development process and methodologies. Edward was promoted to Vice President, Engineering in 2008, and subsequently oversaw Pivotal's expansion into the New York and Boulder, CO, markets. Edward was also a key contributor to the development of Pivotal Tracker, the agile project management and collaboration tool used by thousands of software developers worldwide.

Edward holds a degree in Mathematics from Oxford University, England.

Edward's Blog

Recent Posts

  • New Product Management and Design Offerings from Pivotal Labs
  • What’s Your Start-up’s "Bus Count"?
  • CIMonitor (née Pulse)
Subscribe to Edward's Feed

Author Topics

Ideas (1)
award (2)
javascript (6)
jsunit (6)
agile (8)
mobile (1)
webos (1)
gogaruco (2)
conference (2)
ruby (2)
ide (1)
rails (1)
conferences (1)
python (1)
ajax (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >