Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (491)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  The Differences between Java and JavaScript.  (Read 1581 times)
0 Members and 1 Guest are viewing this topic.
Offline AirTime

Senior Newbie


Exp: 4-6 months


Not a glitch, just a misplaced curly brace.


« Posted 2014-04-27 15:37:42 »

Today, I will describe to you the differences and similarities between Java and JavaScript.

Similarities:

1. Keywords: Both languages have for and while loops, bitwise operations (OR, AND, ect.), and use the same symbols for basic math (+, -, * , /).
2. Name (Sorta): This is where many people may get the languages mixed up. They both have the word "Java" in the name.

Differences:

1. Games: Java comes with classes that you can use to make games with. JavaScript, however, does not.
2. Purpose: Java's purpose was to be for everyday applications such as calculators. JavaScript was meant for websites.
3. Structure: Java is a OO (Object Oriented) language. JavaScript is.. you guessed it! Not! EDIT: Not as much. (As some of you have pointed out)

These are only a few of the differences between Java and JavaScript. Now I hope people don't say "Java is the same as JavaScript" anymore. Have a nice day.

Nothing's gonna change my world.. well, at least until the next syntax error appears Tongue
Online trollwarrior1
« Reply #1 - Posted 2014-04-27 15:39:13 »

Get ready to face the hate..

EDIT-
I haven't use much of javascript, but from my experience, you can do this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
function doSomething() {
     var Object obj=new Object();
     obj.parameter1=5;
     obj.parameter1=6;
}

function Object() {
     int parameter1=0;
     int parameter2=1;
}


This is object oriented programming right there for you.
Offline BurntPizza
« Reply #2 - Posted 2014-04-27 16:39:16 »

I honestly can't tell if OP is serious.

Better trolling Java vs JavaScript: What's the difference between JavaScript and Java?
Also has some informative replies if someone is actually curious.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Roquen
« Reply #3 - Posted 2014-04-27 16:52:44 »

If you want to be a dork then it's easy to argue that JavaScript is more OO than Java.
Offline AirTime

Senior Newbie


Exp: 4-6 months


Not a glitch, just a misplaced curly brace.


« Reply #4 - Posted 2014-04-27 16:56:38 »

This is object oriented programming right there for you.

Well, JavaScript is not AS OO as Java.

Nothing's gonna change my world.. well, at least until the next syntax error appears Tongue
Online trollwarrior1
« Reply #5 - Posted 2014-04-27 17:00:49 »

This is object oriented programming right there for you.

Well, JavaScript is not AS OO as Java.

What are you talking about? Object oriented means object oriented.
Offline AirTime

Senior Newbie


Exp: 4-6 months


Not a glitch, just a misplaced curly brace.


« Reply #6 - Posted 2014-04-27 17:07:26 »

Yes. I'm talking about Object Oriented.

Nothing's gonna change my world.. well, at least until the next syntax error appears Tongue
Online trollwarrior1
« Reply #7 - Posted 2014-04-27 17:08:20 »

Yes. I'm talking about Object Oriented.

There is no such thing as more object oriented. It is either object oriented or it is not. There is no middle ground.. How is java more object oriented than javascript?
Offline SHC
« Reply #8 - Posted 2014-04-27 17:08:32 »

You can use classes (sort of) in javascript. The following code in Java is

1  
2  
3  
4  
5  
6  
7  
8  
9  
public class Foo
{
    public void bar()
    {
        // Do something
   }
}

new Foo().bar();

is equivalent to the following in JavaScript.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
(function () 
{
    var Foo = function(){};

    Foo.prototype = {
        bar: function()
        {
            // Do Something
       }
    };
})
();

new Foo.bar();

They both does the same.

Offline AirTime

Senior Newbie


Exp: 4-6 months


Not a glitch, just a misplaced curly brace.


« Reply #9 - Posted 2014-04-27 17:09:30 »

However, the keywords are not the same. That's my point.

Nothing's gonna change my world.. well, at least until the next syntax error appears Tongue
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Cero
« Reply #10 - Posted 2014-04-27 17:17:58 »

You can do all sorts of things that make it seem like its very OO on the surface - that was what Roquen was referring to.

But no, javascript has no OO at all, none.
Its all fake, and if you try to do things that would normally go well with actual objects and pointers you will have some frustrating days debugging :D

Quote
object-based but not object-oriented

http://www.engfers.com/2008/08/29/javascript-is-not-truly-object-oriented/

Offline Roquen
« Reply #11 - Posted 2014-04-27 17:39:02 »

Java is general purpose and fail-fast, javascript is a DSL an fault tolerant.  Java is class-based OO and Javascript is prototype based OO.  I could go on...but my real point is comparing the two doesn't make any sense.
Offline opiop65

JGO Kernel


Medals: 154
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #12 - Posted 2014-04-27 17:48:54 »

However, the keywords are not the same. That's my point.
This means nothing. Are you trying to tell me that C++ isn't OO because it has different keywords than Java?

Java isn't the standard for OO, its just another language which utilizes the idea of OO.

Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #13 - Posted 2014-04-27 18:02:17 »

1. Games: Java comes with classes that you can use to make games with. JavaScript, however, does not.
Errr... no language comes with classes that you can make games with, actually. What you're talking about is suns/oracles java standard library. It's so closely bundled to the JVM that people think the JVM would die without it Cheesy
On a serious note again: On android you don't have the standard java library, you have the android library. Something like Swing/AWT doesn't exist in Android's Standard libarary, even though you can use Java to for coding on Android.
Also, you can't write games 'without libraries' (what's the difference between including the code of a library (or writing the exact same code) and installing a library?) with nodejs, for example, but in web browsers it's easily possible. See modifying the DOM / using HTML 5 Canvas and all the HTML 5 games that exist out there.

2. Purpose: Java's purpose was to be for everyday applications such as calculators. JavaScript was meant for websites.
Roughly true Smiley

3. Structure: Java is a OO (Object Oriented) language. JavaScript is.. you guessed it! Not! EDIT: Not as much. (As some of you have pointed out)
I know we already discussed it here, but look at MooTool's Class, and you'll see that you can IMPLEMENT something like java's class system with inheritance and public / private methods and fields in javascript. It's pretty amazing if you think about it actually: They didn't implement it in the compiler / interpreter, but you can actually code it in the language itself. You could also modify it, or write your own version if you wanted Smiley If you like this simplicity, maybe try out the programming languages scheme or lisp (argh, I did it again!) Cheesy

These are only a few of the differences between Java and JavaScript. Now I hope people don't say "Java is the same as JavaScript" anymore. Have a nice day.
Guys, he's not a troll, he just doesn't want people to call Java and JavaScript the same ^^ He just wants to do something good.

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline AirTime

Senior Newbie


Exp: 4-6 months


Not a glitch, just a misplaced curly brace.


« Reply #14 - Posted 2014-04-27 18:04:22 »

I'm not claiming that Java sets the standard, but this is Java Gaming, not C++ gaming. I know full well that other languages are Object-Oriented, I'm just focusing on one.

Nothing's gonna change my world.. well, at least until the next syntax error appears Tongue
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #15 - Posted 2014-04-27 18:07:28 »

Nothing good can become of this topic.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Online Gibbo3771
« Reply #16 - Posted 2014-04-27 18:29:00 »

This is just going to turn into a big cock waving contest, its pointless.

"This code works flawlessly first time and exactly how I wanted it"
Said no programmer ever
Offline kpars

JGO Wizard


Medals: 77
Projects: 4
Exp: 3 years


Extreme Typist.


« Reply #17 - Posted 2014-04-27 18:49:35 »

Java and JavaScript are two completely different things. There's no reason to compare the two.

- Jev

Offline Endos
« Reply #18 - Posted 2014-04-27 18:51:28 »

There are a lot of differences between both, but the most notable difference IMO is that Java is strongly typed while Javascript is not.
It's a nightmare to make big programs with a weak typed language.

Bored Birds - End with your boredom for Android
Retroships - Space Shooter for Android
Ultimate - 2D Side-Scrolling Platformer project
Offline AirTime

Senior Newbie


Exp: 4-6 months


Not a glitch, just a misplaced curly brace.


« Reply #19 - Posted 2014-04-27 18:56:58 »

I never meant to start such a controversial topic. I just wanted to inform coding newbies that Java and JavaScript are not the same.

Nothing's gonna change my world.. well, at least until the next syntax error appears Tongue
Offline jonjava
« Reply #20 - Posted 2014-04-27 18:58:49 »

I feel like the OP is testing his assumptions on the differences between Java and JavaScript by stating his opinions as fact and having the community point out his mistakes (which the community loves to do) instead of asking a question on what the difference are and getting "Google it" replies.

Other than that this topic has no logical purpose, I feel.

Offline quew8

JGO Coder


Medals: 29



« Reply #21 - Posted 2014-04-27 19:03:31 »

I think that what we should take away from this is that Java and JavaScript are both things and when lazy people do not read words past the 4th letter it is possible to become confused as to the nature of the two aforementioned things and more specifically whether or not these natures are in fact the same nature just spelled differently, not that we are aware of that because we have neglected to read beyond the 4th letter of words. In fact if you look carefully at the two things then it is quite possible to be unaware of the distinct lack of differences or similarities between the first of the non-things and the second of the before-things. Quite possible. So laziness or not you may become confused as to what the hell we are even talking about anymore. That is certainly my intention.

But seriously on the OO front. People say that Lua is an OO language because you can hack something that works exactly like a class but doesn't use any keyword at all similar to "class" or any syntax that is the slightest bit sensible. What I say to these people is "well done," what an achievement to write classes in a language without any support for classes. It is really very impressive. Does that make the language Object Orientated? I don't know but I'd rather call it Table Orientated personally. And I'd rather program in Lua without using "classes" personally. So again I have said nothing whilst actually writing a fairly substantial hunk of text.
Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #22 - Posted 2014-04-27 19:08:46 »

But seriously on the OO front. People say that Lua is an OO language because you can hack something that works exactly like a class but doesn't use any keyword at all similar to "class" or any syntax that is the slightest bit sensible. What I say to these people is "well done," what an achievement to write classes in a language without any support for classes. It is really very impressive. Does that make the language Object Orientated? I don't know but I'd rather call it Table Orientated personally. And I'd rather program in Lua without using "classes" personally. So again I have said nothing whilst actually writing a fairly substantial hunk of text.

I agree, it's not the language that is Object Oriented then, but usually that phrase is used when talking about code: "Write Object oriented code".
Here are some statements:
Java has language-level support for writing "Object Oriented code".
JavaScript doesn't have the above.
JavaScript allows the user to write "Object Oriented code" in a way that is readable and not obfuscated.
The above goes the same with Lua.

I hope you agree with that...

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Screem
« Reply #23 - Posted 2014-04-27 21:03:06 »

Java to Javascript is like ham to hamster.

Offline jonjava
« Reply #24 - Posted 2014-04-27 21:11:47 »

JavaScript allows the user to write "Object Oriented code" in a way that is readable and not obfuscated.

Readable and not obfuscated? It's possibly the most horrible and confusing experiences anyone can ever have in life.

ECMA6 is adding keywords like 'class' and stuff that mimics the conventional "readable" way of doing OO so that may change things. Many people don't like it since it hides what's really going on. Doesn't matter atm and for probably a few years still since it obviously won't be backwards compatible.

Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #25 - Posted 2014-04-27 21:31:32 »

Readable and not obfuscated? It's possibly the most horrible and confusing experiences anyone can ever have in life.
Err... Look at the examples: http://mootools.net/docs/core/Class/Class
I personally don't find this confusing at all Tongue

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline quew8

JGO Coder


Medals: 29



« Reply #26 - Posted 2014-04-27 21:38:14 »

Readable and not obfuscated? It's possibly the most horrible and confusing experiences anyone can ever have in life.
Err... Look at the examples: http://mootools.net/docs/core/Class/Class
I personally don't find this confusing at all Tongue

And I personally think that it is stupid, ugly and confusing to bloat syntax with unnecessary keywords like "then" in an if statement, others see that as making it readable. But I still love them.

Make code, not war.

(That is someone's tag but I can't remember who so I can't credit them. Sorry mystery (wo)man)
Offline ctomni231

JGO Wizard


Medals: 99
Projects: 1
Exp: 7 years


Not a glitch. Just have a lil' pixelexia...


« Reply #27 - Posted 2014-04-28 01:45:06 »

<a href="http://www.youtube.com/v/I9u-MgPOaNk?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/I9u-MgPOaNk?version=3&amp;hl=en_US&amp;start=</a>

Okay, okay, I'll try to take this topic seriously..

To be honest, the major difference between these two languages is that Java has to be compiled, and JavaScript doesn't (dynamically typed).

Java

Incredibly strict and very verbose. This language was created so people do not have to compile code into 3 different OS's (Windows, Mac, Linux). The power behind that lies in the JVM which, for a small price in memory, allows you to run the same code in any Unix or Windows based system. Java was designed for Object Oriented Programming from the ground up with only a few primitives not being an Object (though there are Objects for all primitives).

Java's biggest strength lies in its structure and documentation, as the strict syntax also promotes good coding practices. Heavily used by businesses, and had its foothold in mobile devices for a while. Recently has lost its foothold in website applications due to security breaches and strict entry to Applet and Webstart. Main competitors include C, C# and C++.

JavaScript

Very loose typed object oriented language. At its start, JavaScript (LiveScript) was used primarily to give developers the ability to react to user responses in a webpage. As developers wanted more power, JavaScript then grew to include more functionality to allow greater control over the web page with the strongest being AJAX, which allows direct control over any part of a web page in real-time without refreshing the browser.

However, JavaScript is a "browser" language and functions best when within a browser. It is a jack of all trades when it comes to languages, having aspects of imperative (like C), procedural (like Haskell), and Object Oriented (like Java). However, when trying to do any of those techniques outside simple web page edits the language becomes very ungainly and extremely verbose.

Despite this, JavaScript is a very dynamic language with a lot of flexibility. As of HTML5, it has gained a much needed speed boost that allows it to compete very evenly with Flash. It gives access to the WebGL interface which allows some 3D programming within a browser. Since JavaScript is built into every modern browser, it pretty much works right off the bat with anything that has one. (The only flaw is that JavaScript may be disabled on browsers at any time, and that usually breaks a lot of functionality (Google) since it isn't guaranteed.) JavaScript pretty much owns a monopoly on client based web applications with no real competitors that don't need a plugin.

What's Better?

Apples to Oranges. The reason JavaScript was named JavaScript in the first place was because the people at Netscape said "Java" programming language was catchy due to its rising popularity. So they renamed LiveScript to JavaScript. However, I can't say that is bad because it arises to topics like this so.

Generally, if you are designing for web... JavaScript is going to find its way into your code somewhere. It is pretty hard to design a fluid experience on the web without JavaScript these days. If you are designing for desktop, then Java is the language I choose. It is a lot easier to write code in Java opposed to JavaScript. I would argue that JavaScript really sets you up well for spaghetti code as everything gets so much more verbose as you move along. Java's OO nature avoids this.

I've coded in both quite a lot, and they each have their strengths and weaknesses. But, I enjoy coding in Java a lot more than in JavaScript because it has a self-organizing structure. In JavaScript, I feel like I have to force structure in order for it to have structure. You can tell that even though it is Object Oriented (everything in JavaScript can be quantified to an Object), it is very disjointed and lacks organization.

There, see, something good can come out of this thread....  Grin

Offline HeroesGraveDev

JGO Kernel


Medals: 246
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #28 - Posted 2014-04-28 01:50:04 »

Similarities:

1. Keywords: Both languages have for and while loops, bitwise operations (OR, AND, ect.), and use the same symbols for basic math (+, -, * , /).

You've got to be kidding me...

Next thing people are going to start confusing C and Java.

Offline Roquen
« Reply #29 - Posted 2014-04-28 05:30:13 »

The arguments used to say this or that is or isn't OO are pretty much always, ya know, freaking stupid.  The original point of the OO experiment wasn't about encapsulation nor polymorphic dispatch.  These were both long existing techniques which everybody knew about.  If that was the point then Smalltalk could have been written in an afternoon as a C frontend.  The big point was have no types.  Therefore all typed (or worse strongly typed) OO languages are oxymorons.
Pages: [1] 2
  ignore  |  Print  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (29 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (39 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (25 views)
2014-08-16 06:20:21

Tekkerue (36 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!