An Introduction to a Nice Programming Language

Extending and Simplifying Java with Nice

© Mark Alexander Bain

Jul 2, 2009
An Introduction to a Nice Programming Language, Mark Alexander Bain
Nice is a programming language that extends Java and Java classes, but it is very simple to use. It can even add methods to a class without touching the source code.

Many new programmers who are wanting to start object oriented programming may feel that languages like Java are just too complex. And, as well as being object oriented, they may want this nice programming language to:

  • be free
  • use existing Java libraries
  • be able to add methods to classes without access to their source code
  • use tuples (which allow methods to return multiple results)
  • improve on Java's error handling
  • accept optional parameters for functions

If that's the case then that's exactly what the programmer needs - the Nice Programming Language.

Getting Started with the Nice Programming Language

The compressed Nice compiler can be downloaded from the Nice web site. Once it's been uncompressed and the system path updated to include the new Nice directory then it's just a matter of creating text files containing Nice code. The compiler can then be used to create executable files.

A Simple Nice Program

The key point for the programmer to remember about Nice is that it compiles from packages and not individual files. And a package is simply a directory that contains the Nice files (which are identified by a .nice file extension). The first step, therefore, is to create the folder that is going to be the new package, and then move into the directory:

mkdir HelloWorld
cd HelloWorld

The next stage is to create the package's source code. The package must contain at least one .nice file and that file must be named main.nice. This can be created with any text editor, for example:

notepad main.nice

And it's contents will be recognizable to any Java programmer:

void main(String[] args)
{
System.out.println("Hello, World!");
}

Once this file has been saved then the package is ready for compilation.

Compiling and Running a Nice Application

The easiest way to compile a Nice application is to move back into the parent directory and then use nicec:

cd ..
nicec -a HelloWorld.jar HelloWorld

This will compile the package into a Java jar file, and this can now be run:

java -jar HelloWorld.jar

In this case a simple a simple “Hello, World!” statement is displayed on the screen (as shown in figure 1 at the bottom of this article).

Alternatively, if the programmer has gcj (The GNU Compiler for Java Programming Language) installed then they can create an executable:

nicec -o Hello HelloWorld

However, Windows users must note that in order to access gcj they will also need Cygwin installed (and for that they should read Cygwin: a Linux-like Environment for Windows).

Of course, this has not touched on any of the object oriented programming aspects of Nice, its ability to handle optional inputs, or the ease with which it can be used to extend existing classes. However, it is obvious that the Nice programming language is very easy to use both for the experienced Java programmer and the complete novice.


The copyright of the article An Introduction to a Nice Programming Language in Computer Programming Languages is owned by Mark Alexander Bain. Permission to republish An Introduction to a Nice Programming Language in print or online must be granted by the author in writing.


An Introduction to a Nice Programming Language, Mark Alexander Bain
Figure 1: Compiling and Running a Nice Program, Mark Alexander Bain
     


Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo