Water Vs Java Vs Javascript

When it comes to programming languages, the choices can be as varied as the depths of the ocean.

In the vast sea of coding options, three languages stand out as titans of the trade: Water, Java, and JavaScript.

Each has its own unique characteristics, strengths, and areas of application. In this blog post, we’ll dive deep into the nuances of Water, Java, and JavaScript, comparing their features, syntax, and use cases to help you navigate the waters of programming language selection.

So, grab your life jacket and let’s set sail into the world of coding comparisons!

Comparison with Java

Some of Water’s features provide fixes for inconsistencies and other unnecessary complexities in Java that will probably never be fixed in Java due to its momentum and lack of vision.

– Unlike Java, all Water data types are full-fledged objects. There are no “ints” and “Integers”, just “integers”.

– Unlike Java, Water has true multiple inheritance. There is no extra “interface” mechanism.

– Unlike Java, Water supports both a prefix syntax and an infix syntax–automatically. Water does not need precedence rules or parentheses.

– Unlike Java, the types of fields and method return values need not be declared. They default to the most general type of object.

However, type declarations are encouraged as they help declare the programmer’s intent and can be used by programs to find inconsistencies in the programmer’s intent as well as speedup execution.

– Unlike Java, the “init” method is just like a regular method. Its body returns a value [usually but not necessarily a subobject of the called object]. It’s syntax is just like a regular method, rather than Java’s “constructor” syntax.

– Unlike Java, instance variables can be created or removed within an object at run time.

– Unlike Java, you can add methods to a “class”, extending its behavior without having to edit and recompile the original source.

Water gives the programmer more flexibility in modularity so that a method for a class need not reside in the same file as the class definition if that’s what the programmer chooses.

– Unlike Java, Water’s evaluation kinds permit the easy construction of high-level code manipulation methods which in many cases reduce the complexity of packaging up and calling advanced functionality.

-Unlike Java, there is rarely a need to create a “singleton”, ie a class with one instance object. That’s because in Water, a “class” object can be treated just like an instance object.

You can call its methods directly using the “class” as “this”. There is no need to have a distinction between static variables and instance variables, nor static and instance methods.

And each “instance” object in Water can get its own special version of a method, if the programmer so chooses, to distinguish its behavior from that of its sibling objects. “Static” is another concept you just don’t have to know about in Water.

– Compared to Java, Water is much more consistent with itself. For example, Java has three different syntaxes for programatically determining the length of an array, a vector and a string. Water has one.

Water Vs Javascript

Water has a lot in common with Javascript:

– Water and Javascript can be embedded in HTML

– Water and Javascript are interpreted

– Water and Javascript both have “eval” though Javascript doesn’t have a “parsed but not evaled” representation using for programs that manipulate code.

– Water and Javascript objects can both have fields added dynamically, after an object is created.

But there’s a lot of differences as well:

– Water can be “more” embedded than Javascript within HTML. Generally speaking, Javascript can only be attached to certain control attributes of HTML tags. Water permits active code just about anywhere within HTML.

– Water’s syntax is much more like HTML than Javascript’s.

– The object system in Javascript is designed to be a “prototype” object system. Yet it is, at the very best, poorly documented. Water’s prototype object system is easier to use.

– Water permits (but does not force) the declaration of types for arguments and object fields. Javascript does not permit type declarations.

– Water has much more flexible argument definitions which can take default values and “evaluation kinds” in addition to names and types.

– Water has a simple, concise syntax for referencing objects through long paths in the object hierarchy and interconnected field values.

Scroll to Top