views:

708

answers:

12

With the intent on becoming fluent on both to do a mix of web and application coding. Would one facilitate learning the other?

+1  A: 

It depends on which one (websites or programs) that you want to make first. If you do want to make websites your not going to get to far with just JavaScript and HTML (think about using JQuery). You might also want to learn ASP.NET, it will allow you to use C# (very similar to Java) to make rich websites with code that can run on the server and HTML/JavaScript to be displayed to the user.

If you want to make programs look into Java or C#.

I learned HTML -> JavaScript -> BASIC -> C++ -> C# -> ASP.NET. I started with websites then learned programming and in turn went back to making websites using C# as my programming language.

Lucas McCoy
He does say he means to learn both, just wants tips on "which one _first_"...
Alex Martelli
@Alex: I updated my answer to reflect his real question. Thanks.
Lucas McCoy
@Lucas: good points, though I disagree that "you won't get far" with Javascript (and HTML and CSS), these days -- guess I'll add a note to my answer to that effect.
Alex Martelli
@Alex: What I meant by that was he wouldn't be able to do anything that must run on the server using JavaScript.
Lucas McCoy
+2  A: 

I've seen people try both approaches -- start with the more rigid and better-defined language first (here that would be Java), or start with the looser and more fluid one (here that would be Javascript). In my observation, which one works best depends on the learner: "left brained" personality types prefer stricter definition (start w/Java), "creative"/"right brained" ones prefer greater freedom of expression (start w/JS). So what's your personality?

Edit, to add...: Maybe you're (making up a personality) "center-brained", motivated by actually achieving small but neat/useful/cool results; in this case, and against "received wisdom", I suggest that, these days, there's actually a lot that you can achieve on the web with Javascript (and HTML and CSS). At Google I/O last week, Vic Gundotra showed something of what you can do with just these tools with the new HTML5 toys -- it's all over the web, search for it, but for example here's a summary with some further useful links.

That's definitely not to say that Java won't also be rewarding in terms of results you can achieve -- hey, just to stay in the Google arena, it's key to programming Android, it lets you "almost" (;-) avoid learning Javascript if you go with GWT, it can now be deployed to Google App Engine, etc, etc -- the sky's the limit! However, most people can probably achieve small results on the web faster (widgets, mashups, opensocial apps, etc, etc) with Javascript, especially in conjunction with a powerful toolkit such as dojo or jquery.

Then one could start talking about server-side JS, but that's a pretty controversial subject, and this answer is already pretty long, so I won't;-).

Alex Martelli
+1 Good answer, plus great links.
Lucas McCoy
Wow, I didn't even know SSJS existed :-O
Lucas McCoy
+2  A: 

Beyond some of the basic syntax, they are not very similar at all.

Go with whichever you find most interesting first.

Tom
A: 

Those two are very different techonologies. They have similar C-like syntax, but thats all that they have in common. Go for JavaScript if you want to make websites and Java if you want desktop/enterprise appliactions.

Darth
A: 

What do you want to be able to do first? There are any number of languages which could be a first language and it really depends on what you want to do.

Peter Lawrey
+9  A: 

Apart from some superficial syntax and the name, the two have very little in common as languages. That being said, you can write useful (if not very "modern") webapps without JavaScript, but not without a server-side language like Java, so it might be better to start on that side; it's also the overall more complex one, since it includes database access.

Then again, there is Server-side JavaScript which would allow you to do everything in one language, but it's not a very common choice.

Michael Borgwardt
A: 

Java and JavaScript are two different programming languages and technologies.

Don't be mistaken by "Java" in both names.

Java Script is mainly used for dynamic front-end website development although can be used for application scripting (for example Photoshop) or MS Windows scripting (JScript). There is also project that uses JavaScript as back-end server language: Jaxer

Java can be used for building desktop applications (Java Standard Edition), mobile devices applications (Java Micro Edition), back-end website development (Java Enterprise Edition) and also front-end development for websites using Applets. There is also new Java platform called JavaFX that joins development for desktop, mobile devices and internet browsers under one technology

JavaScript is usually interpreted whereas Java is compiled.

Raf
This way it looks like you are saying that JavaScript is not a programming language at all :(
Rene Saarsoo
Indeed. The distinction between "scripting" and "programming" is ill defined and not useful.
David Dorward
Thanks for pointing that out. Edited.
Raf
+1  A: 

Java first, because you will be learning better programming habits that will be useful whatever second language you want to learn after. And it's less traumathic to make the transition from a static type system to a dynamic one than the reverse.

fortran
A: 

I would recommend start with Java. It would give you good basics in programming. With Java knowledge you can learn JavaScript, C# and other languages more easily. I don't think that would be the case if you would start with javascript.

Andrija
+11  A: 

Javascript is a prototype-based scripting language, with weak and dynamic typing which is usually hosted in a browser.

Java is an object-oriented programming language, with strong and static typing which runs on the Java Virtual Machine.

What does that mean?

From Greg Hewgill's answer to the question What’s the difference between JavaScript and Java?:

Java and Javascript are similar like Car and Carpet are similar.

As the others have already pointed out, both Java and Javascript superficially have similar syntax which is influenced by C, but most of the similarity ends there. Under the hood, the two languages are completely different beasts.

Between the two, getting started may be a little bit easier with Javascript than Java, as it is more forgiving in terms of things which can be performed. However, this can also mean that it might serve as a way to pick up some bad habits, such as overlooking the concept of data types.

At the end of the day, it will come down to what one wants to get accomplished first. Either performing tasks in the browser to manipulate webpages (Javascript), or writing programs that will run as applications on clients and servers (Java).

coobird
Yeah, I wondered about the name coincidence. I guess I’ll let the project dictate which one gets the most focus. You are correct about the infrastructure needs (jvm vs web) that each needs.Thanks y’all
Naming is not a coincidence. It was a marketing decision. And JavaScript and Java are more similar than they might have been. The C syntax wasn't something Brendan Eich started with. He did make the language more Java-like as a result of the desire to have a "Java-like" syntax. I think that what we got with JavaScript (a functional language with C syntax) is really cool.
Nosredna
+2  A: 

IMO, learn JavaScript first. You can be near guaranteed that you will come across a project/task where you need it. Definitely take a look at jquery, a great library for javascript.

In terms of the application layer, if you are just learning now, Java is an OK decision to learn first, so is C#. Personally, I prefer the open source stack, Perl, Python or PHP as I believe there are a lot more resources out there to help you learn them. PHP will have the most resources, but Python is a better choice.

chadl
A: 

I would recommend learning a few different languages before learning JavaScript. Java for class-based object orientation; LISP or similar for functional programming. JavaScript can accomodate several different paradigms and it's easier if you are already familiar with them.

JavaScript does functional programming better than Python or Java, but not as easily as the "real" funcional programming languages. JavaScript has its own variety of prototype-based object orientation and does it well. You can force it to do object oriented programming in a Java-like way, but you're better off not calling functions "classes" and just calling them "prototypes". It's difficult to model subclasses inheriting from base classes; it's much easier to just accept the concept of objects inheriting from prototypes.

JavaScript is much easier to learn and use if you are already familiar with the basic concepts. For instance, you should know about HashMaps from Java or the equivalent Dictionaries in Python or Property Lists in LISP. In JavaScript every object is a really super-efficient HashMap, so if your design can make use of that fact, use it.

Mark Lutton