It's not a secret anymore!*
The moose likes HTML, CSS and JavaScript and the fly likes JavaScript in the enterprise? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JavaScript in the enterprise?" Watch "JavaScript in the enterprise?" New topic
Author

JavaScript in the enterprise?

J Kilgrow
Greenhorn

Joined: Oct 05, 2010
Posts: 18
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

Joined: Oct 10, 2011
Posts: 73
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.


SCJP 5.0 , SCEA Java EE 5
J Kilgrow
Greenhorn

Joined: Oct 05, 2010
Posts: 18
Interesting....what are you using for development tools?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

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!"


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
J Kilgrow
Greenhorn

Joined: Oct 05, 2010
Posts: 18
SERVER side JavaScript?!? Interesting...I will have to investigate that further. Thanks!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

Node.js
Qunfeng Wang
Ranch Hand

Joined: Jan 28, 2005
Posts: 430
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.


To be or not to be. It's a question.
Rob Crowther
author
Ranch Hand

Joined: Nov 06, 2012
Posts: 295
    
    5

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).


Read my books: Hello! HTML5 & CSS3 | HTML5 in Action | Read my blog
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

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

Joined: Mar 01, 2009
Posts: 1609
    
  13

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.


No more Blub for me, thank you, Vicar.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaScript in the enterprise?
 
Similar Threads
Disable HTML frame using Javascript
EJB Certification (SCBCD/OCPJBCD) - 95%
Getting ready for the job market quickly - so many technology combinations, how to focus ?
where to start on assignment
Fetch 10K rows from table