Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaScript in the enterprise?

 
J Kilgrow
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you see JavaScript as an enterprise-worthy programming language?
What are some best practices I can use to ensure I make it enterprise worthy? Meaning, taking advantage of reusable components, error handling, debugging in a production environment, etc.
 
Sunderam Goplalan
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the good practices in my opinion on the error handling side is as below. (for enterprise applications)

Have a separate "div" for error handling in conjunction with a global error handling function.

<div id="error"></div>. When there is an error , one could say.
document.getElementById('error').innerHTML = "error msg". This approach is more user friendly than displaying a blocking alert window.

window.onerror = errorFunc;
functiuon errorFunc(errorMsg, url, line) { //use these arguments to populate the error div element above }

"LocalStorage API", which is introduced in HTML5, to store "light" client specific data could serve as a limited replacement for maintaining client state using "cookies" or "Http Session" as the latter
involves data transfer over the wire. With Local Storage API, non sensitive data can be stored in the browser cache and this saves memory in the server.
 
J Kilgrow
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting....what are you using for development tools?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64837
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
J Kilgrow wrote:Do you see JavaScript as an enterprise-worthy programming language?

Absolutely.

I see a lot of demand for high-level JavaScript developers. And not just for the client side. With the growing popularity of Node.js, server-side JavaScript is on fire.

With apologies to Anita Bryant, "It's not just for browsers anymore!"
 
J Kilgrow
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SERVER side JavaScript?!? Interesting...I will have to investigate that further. Thanks!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64837
86
IntelliJ IDE Java jQuery Mac Mac OS X
 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:And not just for the client side. With the growing popularity of Node.js, server-side JavaScript is on fire.

With apologies to Anita Bryant, "It's not just for browsers anymore!"

I don't see a good future of JavaScript on server side. My biggest concern is the libraries. Java as a platform, has been developed for more than ten years. There are lots of good libraries available there. It will be a big waste to drop them and develop the same thing in JavaScript again.

My another concern is: Is JavaScript a really good language? Although it has some good parts, it's far from a goodlanguage. The JavaScript is popular due much to it's a language for the web. I have played with Python and Scala this year, I think both of them are better than JavaScript. Especially the Scala, it's based on the Java platform.
 
Rob Crowther
author
Ranch Hand
Posts: 297
5
Android Fedora Firefox Browser
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
qunfeng wang wrote:Java as a platform, has been developed for more than ten years.


Java is less than 5 years older than JavaScript, both have been developed for more than ten years.

qunfeng wang wrote:There are lots of good libraries available there. It will be a big waste to drop them and develop the same thing in JavaScript again.


The same is true of any programming language switch, it was true of all Java implementations at one point. Though several of the server-side implementations are actually implemented on the JRE and allow you to access Java libraries (not Node, though).

qunfeng wang wrote:My another concern is: Is JavaScript a really good language? Although it has some good parts, it's far from a goodlanguage. The JavaScript is popular due much to it's a language for the web. I have played with Python and Scala this year, I think both of them are better than JavaScript. Especially the Scala, it's based on the Java platform.


Well that's always going to come down to a matter of opinion, but you might be interested in JavaScript: The Good Parts (there's also a book).
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64837
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my experience, many people who think that they don't like JavaScript don't know JavaScript particularly well. They're either using the language poorly, and so reacting to the fact that it's not doing what they expect because of that. Or, because it's been used primarily in the browsers, they could be reacting to the DOM API bindings -- which frankly, do suck.

When used as a functional language, I think JavaScript is quite a powerful and elegant language. Does it have its warts? of course it does -- every language does.

Scala and other JVM languages are cool and interesting, but I don't see a lot of the same momentum behind them that JavaScript is getting.
 
chris webster
Bartender
Posts: 2407
32
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Crowther wrote:Well that's always going to come down to a matter of opinion, but you might be interested in JavaScript: The Good Parts (there's also a book).

Thanks for the link, Rob, that's a fascinating talk by Doug Crockford.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic