Wednesday, 14 March 2012

THATS THE WORLD OF JAVA

Java's strengths:

  • Good object-oriented model
  • Cross-platform language
  • Hard to make mistakes that cause a program to crash
  • Large standard library of code you can use in your program
  • Many non-standard libraries available for free
  • Popular (easy to find other programmers to talk to)

Java's weaknesses:

  • Because the program runs on a virtual machine, it may be slightly slower than a natively compiled program.
  • Because the standa
  • The virtual machine needs to be running alongside your application. This increases the amount of memory your program needs.
  • rd code libraries are designed to be cross-platform, you cannot easily take full advantage of all features unique to a given platform.

INTRODUCTION TO JAVA

Java
Java is an object-oriented language developed by Sun Microsystems in the early 1990s and released in 1995.  Java combined many of the best ideas from Pascal, C and various other object-oriented languages.

The principal design goals were to have a relatively simple and “safe” language.  At the time, C++ was (and probably still is) the dominant object-oriented language, and Java's creators deemed it too complex and error-prone for non-expert programmers.

Java was designed as a cross-platform language.  The same compiled code can (theoretically) run on any computer.  Java accomplishes this feat by running your program within a Java Virtual Machine (JVM).  The JVM is another program that simulates a computer that has Java bytecode as its instruction set.  The Java compiler translates your Java program into the bytecodes needed by the virtual machine.  So when you run a Java program it actually runs on a "computer" being simulated by your computer.  Today, Java Virtual Machines are available for most modern computers.

Java's initial popularity was because of its concept of applets. These are small downloadable programs that run within a web browser.  It was the cross-platform nature of Java that made this feasible.  While applets are still in use today,  Java's success is now more in general-purpose programming and server-side programming (i.e., programs running on a web server that generate dynamic web pages).  Java is one of the fastest-growing languages around today.

GIVING A START TO PROGRAMING WITH JAVA

Welcome to the world of Java programming...
These lessons will introduce you to the main concepts needed to start programming in Java.  Because the full Java language is quite extensive

A brief overview of programming and programming languages:
Programming involves writing a set of instructions (called the program) to tell the computer how to accomplish some task.  The task could be something simple like reading a list of names from a file, alphabetizing them and writing them back out to the file.  However, it could be something much more complex, like displaying a complete graphical user interface (GUI) for your favorite game and implementing all the game's logic.

A program's instructions are written in a specific programming language.  Early programming languages required us to think like computers and write in a form very close to how the computers worked internally.  Over the years there has been steady development in computer languages to allow the computer to understand a language which is more natural for us.

A large number of programming languages have been developed over the years.  Like human languages, they have several families with many branches going off from them.  Each family may serve a different purpose, and there is no one best language.  Different languages are good for different things.  

Java is a relatively new object-oriented programming language that has achieved widespread popularity.  It is a general-purpose language that can be used for many types of programming tasks.

The evolutionary path to Java is roughly:

Machine language All computer's processors have a basic instruction set.  This is the set of operations the hardware directly knows how to perform (e.g., add, subtract, move data).  In digital computers, each instruction has a binary number assigned to it (e.g., 01101010 might mean "add the next two numbers"). 

Machine language was used on the first digital computers in the 1940s.  Here you are interacting with the computer in its own terms -- 1s and 0s.    When programming in machine language, programs were entered one instruction at a time by flipping a row of switches on the front of the computer.  An up switch would mean "1" and down would be "0."    The process was very tedious and the programs were intimately tied to the computer's specific instruction set.

Assembler
As opposed to working directly with machine language, assembly language assigns mnemonics (or short words) to the binary instructions.  The programmer would write a program using these mnemonics along with the data they were operating on.  The programmer still needed to think in the the computer's terms while programming, but it made life a lot simpler.  A separate program called an assembler would translate the mnemonics into the machine language that the computer ultimately needed.