Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

How to work with JavaScript framework for enterprise development

Learn how to accept JavaScript framework for the language that it is to move forward with your enterprise development.

Does it appear that JS has ballooned from a scripting language to a full-blown programming language? Appearances are not deceiving. In fact, JavaScript is now coming into its own for Web and mobile applications. Mark Bates, an expert freelance consultant in the JS field, shared his observations with TheServerSide in a recent interview.

"Development is moving toward the client-side. It's a huge trend to have a back-end API and a client-side rich front end, mostly written in JavaScript. That seems to be the way people are going. With an API written for a front end, you have a very clean API that you know works. You're consuming it and you've written a client on it, so to write an iPhone or Android app on top is really easy." This approach provides the benefit of a "native-esque" client-side that appeals to users.

Is JavaScript ready for enterprise?

Perhaps not, but that doesn't matter at this point. Enterprise is stuck with JS because it's really the only game in town -- C and traditional Java have fizzled as browser scripting languages. Bates put it bluntly: "JavaScript has some terrible design flaws. It is one of those languages that you wish was never invented because you would love to see something better in its place. It would be great if the browser had Ruby or Python or some other language built inside of it. But it doesn't."

Bates said it's best for everyone to make peace with this reality. "It's the language everyone has to know, and it's not going away anytime soon. The more you push it away, the harder it will become for you to be a developer in the future." He warned that companies will shun developers who gripe and complain about the horrors of JavaScript instead of buckling down and learning how to use it well.

New tools make JS simpler for developers

Fortunately, frameworks like AngularJS and Backbone are making it easier for enterprise developers to handle JS programming. Brian Holt, director of Reddit's front-end development team, explained why: "It makes your DOM more easily manipulated from your code. You can change a piece of data and it automatically perpetuates through the front end. You change your DOM by changing your data." The added abstraction layer means developers don't have to mess around so much in jQuery, creating and tracking all the various event listeners.

Bates concurred. Before the advent of JS frameworks, developers were simply throwing jQuery at the page. This quickly led to code that was confusing and difficult to manage. While Backbone was the initial leader and provided a basic level of structure and organization, more developer-friendly frameworks such as Angular and Ember are now preferred for many projects. Regardless of a developer's background, it is likely that they can find a popular framework that feels intuitive and makes JavaScript easier to "grok."

The JavaScript onboarding progression

How can enterprise developers overcome their antipathy and learn to embrace this language? Mike Hostetler, former jQuery team member and founder of appendTo, agreed that many software engineers see JS as a toy. They don't take it seriously because it was thrown together with seemingly little thought for computer science. But there's more to JS than meets the eye. "Once you get into it and then go back to the computer science surrounding JS, you can do pretty cool things. Angular brings in some really solid CS concepts. The Dojo toolkit does as well. Even jQuery (beneath the hood) has some secret things in there that, from a CS perspective, get me really excited." He brings that excitement to the training he does with enterprises.

Over the years, Hostetler has noticed a cycle that most developers seem to go through when they start delving deeply into JS. "There's a ramp-up time. The first thing you need to realize is that JavaScript grew out of the Smalltalk world -- it comes from a different heritage. Also, it was built in three weeks, so there are warts."

He introduces enterprise architects to the language in stages. First, they are excited about the neat things they can do with it. Then, they become disgusted about all the things that are wrong with the language. Finally, he has them read JavaScript: The Good Parts by Douglas Crockford to gain a new and more profound appreciation for the language. "It has to die, and then it comes back." Developers need to understand why things have to be a particular way in JS and they need the right framework in place to make it easy to work with. After that point, enterprise teams start becoming really productive.

Dig Deeper on Java server faces

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.