Friday, January 24, 2014

Introduction

In this blog post, you will gather up the basics you need to start learning to program. After a brief introduction to computer hardware, software, and programming in general, you will learn how to write and run your first Java program. You will also learn how to diagnose and fix programming errors.

Computer Programs:

  • Computers execute very basic instructions in rapid succession.
    • Computers can carry out a wide range of tasks because they execute different programs, each of which directs the computer to work on a specific task.

  • A computer program is a sequence of instructions and decisions.
    • A computer program tells a computer, in minute detail, the sequence of steps that are needed to fulfill a task.
    • The physical computer and peripheral devices are collectively called the hardware.
    • The programs the computer executes are called the software.

  • Programming is the act of designing and implementing computer programs.
Anatomy of a Computer:


To understand the programming process, you need to have a rudimentary understanding of the building blocks that make up a computer.

At the heart of the computer lies the central processing unit (CPU).
  • The central processing unit (CPU) performs program control and data processing.
    • That is, the CPU locates and executes the program instructions; 
    • it carries out arithmetic operations such as addition, subtraction, multiplication, and division; 
    • it fetches data from external memory or devices and places processed data into storage.

There are two kinds of storage
  • Primary Storage - usually a RAM
    • made from memory chips: electronic circuits that can store data, provided they are supplied with electric power. Volatile memory
  • Secondary Storage - usually a hard disk
    • provides slower and less expensive storage that persists without electricity. Non-volatile storage
The computer stores both data and programs. 
  • They are located in secondary storage and loaded into RAM memory when the program starts. 
  • The program then updates the data in RAM memory and writes the modified data back to secondary storage.

To interact with a human user, a computer requires peripheral devices.
  • The computer transmits information (called output) to the user through a display screen, speakers, and printers.
  • The user can enter information (called input) for the computer by using a keyboard or a pointing device such as a mouse.
Java Programming Language

A computer program consists of a large number of simple CPU instructions, and it is tedious
and error-prone to specify them one by one by humans. So is the high level programming language.

In a high-level language, you specify the actions that your program should carry out in human readable format. A compiler translates the high-level instructions into the more detailed instructions required by the CPU.

A brief Java History:

In 1991, a group led by James Gosling and Patrick Naughton at Sun Microsystems designed a programming language, code-named “Green”, for use in consumer devices, such as intelligent "set-top" boxes.
"Java was originally designed for programming consumer devices, but it was first successfully used to write Internet applets."
Java was designed to be simple, secure and portable, benefiting both Internet users and students.

Java was introduced to an enthusiastic crowd at the SunWorld exhibition in 1995, together with a browser that ran applets—Java code that can be located anywhere on the Internet.

In addition, Java has a rich library that makes it possible to write portable programs.

Because Java was designed for the Internet, it has two attributes that make it very

suitable for beginners: safety and portability.

Safety - because java runs within JVM (Java Virtual Machine)

Portability - Java compiler does not translate Java programs directly into CPU instructions. Instead, compiled Java programs contain instructions for the Java virtual machine - a program that simulates a real CPU.
"Java programs are distributed as instructions for a virtual machine, making them platform independent."
You cannot hope to learn all of Java in one course. The Java language itself is relatively simple, but Java contains a vast set of library packages that are required to write useful programs.

There are packages for graphics, user-interface design, cryptography, networking, sound, database storage, and many other purposes.

                                         Table 1 Java Versions
Version                Year                 Important New Features
1.0                      1996
1.1                      1997                 Inner classes
1.2                      1998                 Swing, Collections framework
1.3                      2000                 Performance enhancements
1.4                      2002                 Assertions, XML support
5                         2004                 Generic classes, enhanced for loop, auto-boxing,enumerations, annotations
6                         2006                 Library improvements
7                         2011                 Small language changes and library improvements

Java 1.2, 1.3, and 1.4 usually referred as Java 2.
Since Java 1.5, they changed convention and started calling it as Java 5.

Java - 

  • easy programming language and is object-oriented
  • a high-quality execution environment JVM
  • a vast library
OOP Features: Inheritance, Polymorphism, Encapsulation, Abstract Data Types


Java also has editions to cater to the particular need.

Java 5 SE (Standard Edition) - for writing desktop applications.
Java 5 EE (Enterprise Edition) - for writing enterprise applications.
Java 5 ME (Micro Edition) - for portable small devices where memory is very less. Usually used with embedded devices.

Java Design Goals and Buzzwords:

  • Simple
  • Object-oriented
  • Interpreted
  • Architecture-neutral
  • Secure
  • Robust
  • Network-savvy
  • Multi-threaded
  • Portable
  • Dynamic
  • High-performance

In the next post, we will learn the programming environment for Java and write our first java program.

No comments:

Post a Comment