|
I have invented a new programming language called J.T.W. which stands for Java Training Wheels which has all the power of Java but a simpler syntax that is similar to Delphi, Pascal and BASIC and is therefore easier to learn than Java itself. Once you have learned J.T.W., it is a small step to learn Java. The following tutorials on this Web page will guide you through the process of writing code in the J.T.W. language. For many reasons you might even prefer to program in J.T.W. rather than Java. Click on the following link for a book about the J.T.W. language. This document describes Version 2.2 of J.T.W. Since August 2016, J.T.W. has been accepted by Richard Stallman for inclusion into the Free Software Foundation's repository of Free software, so it is now known by the slightly longer name GNU J.T.W.
The GNU J.T.W. language is supported by a parser that troubleshoots problematic GNU J.T.W. code with clear error messages.
The GNU J.T.W. language compiles to Java in a natural and straightforward way so it is easy to learn Java once you know J.T.W., making for a less steep learning curve than learning Java from scratch.
As proof of concept, a superfor macro is provided for getting enhanced BASIC-style for loops.
Another proof of concept is that file inclusion is supported so that you can spread a class across several files. Natural divisions are methods. Different methods can be placed in different source files for those situations where methods become large and unwieldy.
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(crappy[]code[]).
Class variables, properties, functions, methods and constructors are declared as such much like Delphi which makes your code look clearer. Specifically there are new keywords classVar, property, function, method and constructor.
The Delphi/Pascal/Javascript keyword var for clearer local variables.
The Pascal/BASIC keyword then for clearer if statements.
The BASIC/P.H.P. keyword elseif (...) ... for replacing Java's cumbersome else if (...) ... construct.
The BASIC and C++ keywords and and or rather than some horrible crud: && and ||.
NEW! As of version 1.1, GNU J.T.W. now supports packages.
These tutorials are released subject to the GNU Free Documentation License, which is the same license used by the popular website called Wikipedia. The GNU J.T.W. language itself is released under the GNU General Public License. See the next section for the answers to the questions. Note that the answers are protected by a password. For the purpose of completing these tutorials it is mandatory that you have GNU Emacs installed on your system. See the download links page for other software that you must have installed on your system. It is recommended but not compulsory to use GNU Emacs as your editor although there are two advantages in doing this. The first is that syntax highlighting of GNU J.T.W. constructs and the second is that you get integrated support for indenting GNU J.T.W. code. If you choose to use GNU Emacs it is recommended that you use Davin’s Full Version of GNU Emacs or simply GNU Emacs plus Davin’s jtw-mode.el. Please phone me for more information. My phone number is a Christchurch local number: 339-1145. When calling this number, please ask to speak to Davin Pearson. When calling from elsewhere in New Zealand you will need to add an 03 prefix. When calling from elsewhere in the world you will need to add the following prefix +64-3.
GNU J.T.W. Tutorial 1: Your first program and introducing functions, parameters, arguments, strings, System.out.println() and comments to give you enough basic J.T.W. to get you started.
GNU J.T.W. Tutorial 2: Introducing chars, the difference between == and =, booleans, the if ... elseif (...) ... elseif (...) ... 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.
GNU J.T.W. Tutorial 3: Introducing System.out.print() for printing without a trailing carriage return, revising loops that use the for construct, introducing doubles and revising ints and chars.
GNU J.T.W. Tutorial 4: Other types of loops such as do ... while and while, and revising if statements and for loops. Learning what is the best of these four looping constructs.
GNU J.T.W. Tutorial 5: Using all of the GNU J.T.W. constructs that you have learned so far to rewrite a song to be more efficient and general-purpose.
GNU J.T.W. Tutorial 6: Introducing class variables which are different from variables that are local to functions.
GNU J.T.W. Tutorial 7: Introducing non-object arrays that are either single dimensional or multi-dimensional using two different initialization syntaxes and introducing function name overloading.
GNU J.T.W. Tutorial 8: Learning how to access functions and class variables from another class and introducing boolean arrays.
GNU J.T.W. Tutorial 9: Mapping:
to allow for more than one object per class. This gives you the full power of O.O.P. (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.
GNU J.T.W. Tutorial 10: Introducing object arrays that are either single dimensional or multi-dimensional. Revising two different initialization syntaxes from Tutorial 7 on non-object arrays.
GNU J.T.W. Tutorial 11: When classes have references to objects of other classes in their properties then you can set up relationships between different classes.
GNU J.T.W. Tutorial 12: Overloading methods, swapping the properties of two objects, and converting methods to functions and vice-versa. Also the keyword this is introduced. Sometimes the this keyword is optional as has been the case for all previously written methods and constructors, but other times it is essential, as you will see in this tutorial.
GNU J.T.W. Tutorial 13: More questions about references.
GNU J.T.W. 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.
GNU J.T.W. Tutorial 15: Introducing inheritance, polymorphism, getter and setter methods, the instanceof keyword for run-time type inquiry, the Object class and explaining in more depth why the toString method is useful for debugging.
GNU J.T.W. Tutorial 16: Showing you how inheritance can be used to reduce the amount of duplication of code.
GNU J.T.W. Tutorial 17: Arrays, inheritance and polymorphism. Also teaches why in most cases it is better to use polymorphism rather than run-time type inquiry.
GNU J.T.W. Tutorial 18: Mapping GNU J.T.W. to Java and the internal details of the GNU J.T.W. system, including a GNU Makefile. Also covers how to build a collection of class files and how to build an entire package. Also covers how to invoke javadoc on a package.
Back to Main Menu |
This page has the following hit count:
|