File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Javascript in times to come Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Javascript in times to come" Watch "Javascript in times to come" New topic

Javascript in times to come

Paras Jain
Ranch Hand

Joined: Feb 26, 2005
Posts: 137
While Stoyan is with us to answer our queries, I would like to ask this question. Not directly related to his book but a general question

In this forums someone wrote not many people know JavaScript and they just pretend or assume that they know JavaScript. Someone said people are just horrified about JavaScript but in fact they are horrified by something else like DOM or CSS or something. But JavaScript in itself is a very good and robust language.
My question is - What is the reason you think that in all these years people have not learned this language?
I can think of two things. Please give your opinions on this and more reasons you can think of
1) Even now, I think that Javascript is used just for doing some validations, handle some events(mostly limited to onLoad,Onclick, onUnload, onFocus,Onblur, onSubmit etc,) and do some look and feel stuff like CSS manipulation etc. Normally we don�t create many objects with any relationship between them etc. We hardly code any business logic there. If it goes to the level of too much coding then we try to refactor the code and move it to Java classes. The guiding principle is this � �Not much coding in JavaScript�

Do you think in the times to come this will change? Will we be writing voluminous code in Javascript?

2) Debugging is very difficult. Now a days firebug is there but most of the people today don�t know how to use it. In my case our users are just IE6 users, so we don�t even bother about cross browser compatibility. And for debugging we use pop-up alerts.

I think books like yours� will help people learning this tool.

Paras Jain
SCJP 5.0
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60822

I think that the principle reason that people have avoided JavaScript is fear.

A lot of page authors are not technical and come from a design or artistic background. Coding of any kind is new to them and so they rely upon cut-and-paste without really understanding the code, or allow tools such as DreamWeaver to generate it for them.

Another class of page author is technical with a C#, C++ and/or Java background. JavaScript gets them into trouble because they have no background in functional languages and so they try to treat JavaScript like Java and get frustrated when it doesn't do what they expect. I mean, how many people started out by learning Erlang or Haskell?

And then there are the php authors with similar challenges.

The vagaries of the DOM, cross-browser issues, and the debugging debacle (getting better and better every day) also add to the fear.

The barrier to entry for JavaScript is low. All you need is a text editor and a browser. So many people never step beyond their comfort level in order to learn the in and outs of the language.
[ August 28, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paras Jain
Ranch Hand

Joined: Feb 26, 2005
Posts: 137
Bear I agree with what you said. But won't you agree that people don't even needed to learn this language?
What ever little event handling, validation etc they needed they got by some means or others.
In the AJAX and Web2.0 era people people are realising the importance of the language but still I don't think we are going to write any thing major in JavaScript.

We are using JQuery in our current proj. But in all the projects I worked so far we use to have a handful of .js files which we include on the top of our JSPs and use the existing functions for validation, formatting and stuff.

Are we going to code anything more complicated than this? Like creating domain or business objects and doing stuff with them.
While I understand the that you can't foretell future but at least guess the upcoming trends

[ August 28, 2008: Message edited by: Paras Jain ]
[ August 28, 2008: Message edited by: Paras Jain ]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60822

As I posted in another topic, even when using jQuery or any other library, I think that it's essential to understand JavaScript. Especially with jQuery, if you don't have a good handle on function contexts, closures, and other JavaScript concepts, your code is not going to use jQuery to its fullest extent.

And what about when things go wrong? How do you debug code you don't understand?

When the cut-and-pasters and DreamWeaver enthusiasts hit such debacles, all they can do is throw up their hands in horror and try to seek someone else to solve their problems. That's not "development" to me.

The same goes for the server side. Some users of tools like JSF (shudder), Struts, Spring and the like think that they can get away without having to understand basic Java and Servlet and JSP concepts. Not so.

Understanding the underlying technology is essential to effectively using the tools that are built upon them.

Otherwise, you're just a mechanic, not a developer/engineer.
[ August 28, 2008: Message edited by: Bear Bibeault ]
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

Originally posted by Bear Bibeault:
A lot of page authors are not technical and come from a design or artistic background. Coding of any kind is new to them and so they rely upon cut-and-paste without really understanding the code, or allow tools such as DreamWeaver to generate it for them.
And if you google your question "How do I do X in Javascript?" you can see the results of ten or twelve years of that sort of thing. You'll get links to all kinds of things. Many of them are hacks which help you to make your code work in Netscape 4 or Internet Explorer 4. The unwary beginner could easily waste a lot of time by using those things.

I was a Javascript beginner not that long ago, but not an unwary one. It didn't take me long before I realized that Google was leading me into a swamp. So I bought the Rhino book and worked my way through it.

For a lot of web pages, Javascript is an after-thought. It's just something like salt and pepper, you just need a little bit of it to make your page work right, so you just grab the shaker and sprinkle a little bit on. I think that's why people don't take it seriously, and that's why they just go hunting code snippets on the Internet.
Stoyan Stefanov
Ranch Hand

Joined: Jul 16, 2008
Posts: 61
@Paul - this is so true about web hunting for "how do I do X", there is just so much bad code out there. I hope with time it will pass. I'm an optimist, because it used to be true about the JavaScript books too, most of them were exceptionally bad, today it's even embarrassing to look at their code. But the new generation of JavaScript books is much, much better. So things change for the better. Google (and other search engines) are driven by inertia, the older the site, the more established it looks and has acquired a lot of inlinks, which is the currency search engines use to judge quality. All we have to do now is outrank the old sites, just blog and push quality content out there for the next 10 years

@Paras, while it's true that there is a limit of how much logic you can have public (JS is plain text on the client), it's not true that there aren't big JS applications. Just the opposite, there are many examples of client-heavy, or fat client applications and this is a trend. I think I even saw some stats about the shear size (in KB) of the JS code in popular sites, and it's going up.

Plus I find the JS language is a sweet deal, because you can code a bunch of different programs with it. Other than the browser you can do shell scripting, server-side scripting, software extensions, I mean take Firebug - it's all written in JavaScript as all Firefox extensions are. Like "learn once, write everywhere"

If you haven't seen this essay by Douglas Crockford, it's worth reading: JavaScript: The World's Most Misunderstood Programming Language.

<a href="" target="_blank" rel="nofollow">my OOJS book</a>
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

[Edit: thread hijack removed. Please ask your own questions in a new topic]
[ August 29, 2008: Message edited by: Bear Bibeault ]

subject: Javascript in times to come
Similar Threads
People on Sun java forums are rude!
Why Jakarta Struts?
Broken English
Gore Calls for Rumsfeld, Rice and Tenet to Resign
Is certification just a piece of paper?