• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

JavaScript in the enterprise?

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interesting....what are you using for development tools?
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SERVER side JavaScript?!? Interesting...I will have to investigate that further. Thanks!
 
Bear Bibeault
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Node.js
 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 297
5
Android Firefox Browser Fedora
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic