Archive for May 22, 2007

Sun Names New Language JavaFX Script – Is this some sick joke?

Posted in JavaScript, Software, Web, internet, programming on May 22, 2007 by Joey

As if it weren’t confusing enough explaining the difference between Java and JavaScript (which are unrelated), Sun Microsystems has muddied the waters further with the introduction of JavaFX Script. To quote from Sun’s website: “[JavaFX Script is] a highly productive scripting language that enables content developers to leverage the enormous popularity of Java to create rich applications and services for deployment on the widest range of platforms.”

OK, so that is fine that Sun has come up with this new programming language to use Java to build Rich Internet Applications. But to name it JavaFX Script? They seriously have to be kidding. This has to be the worst possible name that could have given to the language. Developers everywhere will now have the joy of having conversations such as this:

Manager: ‘You can code this interface in Java.’
Developer: ‘You mean JavaScript?’
Manager: ‘They are the same, right?’
Developer: [Explains difference between JavaScript and Java]
Manager: ‘OK, then go ahead and use JavaFX Script’
Developer: ‘You mean JavaScript?’
…grrrrrrrrr

Related Articles:
JavaScript Versus Java

JavaScript Versus Java: Differences and Similarities

Posted in JavaScript, Software, Web, internet, programming on May 22, 2007 by Joey

What is the difference between JavaScript and Java? Actually, there is not much point in even discussing the similarities and differences because JavaScript and Java are unrelated languages.

JavaScript received it’s name from Netscape, who had originally developed the language using the name LiveScript, and changed its name at the last minute as a marketing move. Due to its name, it is often confused with Java, with many people thinking it’s a more simple form of Java.

JavaScript Switch Case Statement Example

Posted in JavaScript, Software, Web, internet, programming on May 22, 2007 by Joey

The switch statement is used in JavaScript to evaluate cases for a variable and is used as follows:

var intTest = 1;
switch(intTest)
{
case 0:
document.write('0');
break;
case 1:
document.write('1');
break;
default:
document.write('unknown');
break;
}

The break statement exits the switch. If it is not used, subsequent cases will execute if also valid. For example, if no break was used in the case of 1 in the example above, both 1 and unknown would print.

The switch statement is preferable to multiple if statements as the tested value doesn’t have to be evaluated repeatedly.

String datatype example:

var strTest = 'a';
switch(strTest)
{
case 'a':
document.write('a found');
break;
case 'b':
document.write('b found');
break;
default:
document.write('unknown');
break;
}