I have invented a new programming language called SJS which stands
for Simplified Java Syntax which provides a
learning path that is a less steep learning curve for learning Java
than learning Java from scratch. The SJS language has a similar
syntax to Delphi, Pascal and BASIC and is therefore easier to learn
than Java itself. For many reasons you might even prefer to program
in SJS rather than Java. The following tutorials on this web page
will guide you through the process of writing code in the SJS
language. Funnily enough the acronym SJS coincides with the acronym
for the University of Canterbury
Student Job Search organisation which suggests
that if you learn SJS, you will land a good job!
Why learn to use SJS?
The SJS language is supported by a parser that troubleshoots
problematic SJS code with clear error messages.
The SJS language compiles to Java in a natural and
straightforward way so it is easy to learn Java once you know SJS,
making for a less steep learning curve than learning Java from
scratch.
Pascal-style begin...end constructs are supported instead
of C-style { ... } constructs which is more sensible especially
for novices.
A simple syntax for the main function: beginMain...endMain rather than some horrible crud: public static void
main(lousy[]code[]).
Class variables, properties, functions, methods and constructors
are declared as such much like Delphi which makes your code look
clearer.
The Delphi/Pascal/Javascript keyword var for clearer local
variables.
The Pascal/BASIC keyword then for clearer if statements.
The BASIC keywords and and or rather than some horrible crud:
&& and ||.
These tutorials are released subject to the
Gnu Free Documentation
License, which is the same license used by the popular website
called Wikipedia.
Click here to access the answers to these tutorials. A password
is required.
For the purpose of completing these tutorials it is highly recommended
that you use
Davin's version
of the
GNU Emacs text
editor so that you get
syntaxhighlighting of SJS constructs
and integrated support for editing and debugging SJS code. Please ask
me (Davin) for more information. My home phone number is 351-3943.
SJS Tutorial 1:
Your first program and introducing
functions, parameters, arguments, strings,
System.out.println and comments to give you enough basic SJS
to get you started.
SJS Tutorial 2:
Introducing chars, the difference
between == and =, booleans, the if ... else
construct, local variables, ints, the for construct and
teaching you how to call existing methods of the string class
but not teaching you how to write your own methods until
Tutorial 9.
SJS Tutorial 3:
Introducing System.out.print
for printing without a trailing carraige return, revising
loops that use the for construct, introducing doubles
and revising ints and chars.
SJS Tutorial 4:
Other types of loops such as do
... while and while, and revising if statments and for
loops. Learning what is the best of these three looping constructs.
SJS Tutorial 5:
Using all of the SJS constructs
that you have learnt so far to rewrite a song to be more
efficient and general-purpose.
SJS Tutorial 6:
Introducing class variables which are
different from variables that are local to functions.
SJS Tutorial 7:
Introducing non-object arrays that are
either single dimensional or multi-dimensional using two
different initialisation syntaxes and introducing function name
overloading.
SJS Tutorial 8:
Learning how to access class variables
and functions from another class and introducing boolean
arrays.
class variables →instance variables
(which are better known as properties), and
functions →methods
to allow for more than one object per class. This gives you the
full power of OOP (Object Oriented Programming) classes.
Introducing getter methods and references for accessing
objects. Introducing the null keyword for representing no
object and introducing the toString method, while explaining
why this method is better than any other method or property for
debugging your code.
SJS Tutorial 10:
Introducing object arrays that are
either single dimensional or multi-dimensional. Revising
two different initialisation syntaxes from Tutorial 7
on non-object arrays.
SJS Tutorial 11:
When classes have references to objects of
other classes in their properties then you can set up
relationships between different classes.
SJS Tutorial 12:Overloading methods, swapping the
properties of two objects, and converting methods to functions
and vice-versa.
SJS Tutorial 14:
When a class has a reference to itself
as a property then you can build linked lists out of objects of
this class. WARNING: Linked lists are tricky for novice
programmers to grasp.
SJS Tutorial 15:
Introducing inheritance,
polymorphism, getter and setter methods, the
instanceof keyword for run-time type enquiry, the Object
class and explaining in more depth why the toString method is
useful for debugging.
SJS Tutorial 16:
Showing you how inheritance can be used
to reduce the amount of duplication of code.
SJS Tutorial 17:
Arrays, inheritance and polymorphism.
Also teaches why in most cases it is better to use polymorphism
rather than run-time type enquiry.