Java As An Object Oriented Language Computer Science Essay

Published:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Java as an object-oriented language was designed from the outset to be platform independent, robust, and secure. Many of the concepts and syntax of Java are borrowed from C++, another object-oriented language. Java can be used to produce two types of programs. One type is an application, which is a standalone program that can be run by the Java interpreter. The other type is an apple, which is a mini-program that is typically built into World Wide Web pages.

Java (originally called Oak, until it was discovered that another company used Oak as a trademark) was developed at Sun Micro Systems in a forward-looking project to develop a new programming language. The primary design goal of Java was to provide code for programs that would run on many different hardware platforms. The second design goal was to produce robust programs-programs that would have as few bugs as possible. The third design goal was for the language to be easy to learn and use. Since the world of computers and application development was already populated with programmers who knew C++, the syntactical model of C++ was chosen along with some characteristics of Smalltalk. The effectiveness of Java as a programming language can be illustrated by considering how Java reduces bugs:

The most common source of difficult-to-track bugs in traditional programming languages is improper handling of dynamically allocated memory. These memory leaks are caused by programmers allocating memory, and then losing track of its location or simply not releasing it. Java handles all memory management issues on its own, rather than leaving them to the programmer. Java allocates memory when an object is instantiated and releases it automatically when the object goes out of existence, through a process called garbage collection.

Another frequent source of problems is out-of-range array indexing. C and C++ do not check for these errors, but Java does.

Java avoids the syntactical headaches that result from multiple inheritances, which is an object oriented feature (of controversial value) in C++. Java uses interface files to provide most of the benefits of multiple inheritance (and polymorphism) while avoiding their problems.

Competing Technologies

Just a few years ago, C++ was hailed as the computer language that would revolutionize computer programming and lead to bug-free programs. Unfortunately,

C++ was rather hard to learn and ended up creating many bug filled programs. Nevertheless, although C++ was hardly the first object-oriented language, it did expose many programmers to object-oriented programming.

Many programmers now feel that while the future belongs to object-oriented programming, C++ is not the best vehicle for it. Java's designers took the best features of C++ while rejecting its bad features. Languages such as Visual Basic do a terrific job designing GUIs. Yet, Visual Basic lacks many important Java features that are needed for WWW applications. Microsoft has introduced ActiveX technology which can be used with VBScript (a subset of Visual Basic) to provide many of the same user interaction features as Java applets. VBScripts are embedded in HTML documents between <SCRIPT> and </SCRIPT> tags.

Java Portability

A programming language is said to be portable if source code written in that language is readily compiled and run on a platform other than the originally intended target platform. The C programming language is portable in this sense, though most applications written in C rely on interfaces specific to a certain operating system or windowing system. The result of compiling C source code is machine code that runs on a particular type of processor. Thus, when we say C is portable, we refer to the source code, not the compiled binary code. The Java system is not merely source code portable-it is binary portable. The result of compiling Java source code is Java byte code that can be run only by a Java Virtual Machine (JVM). The JVM is usually an interpreter, a program that executes the byte code instructions as it reads them. The JVM is source code portable; that is, designed to run on many different platforms.

Advantages and Disadvantages

Java is a simple language. It borrows most of its syntax from C/C++, so it is easy for C/C++ programmers to understand the syntax of Java code. But that is where the similarities end. Java does not support troublesome features from C/C++, so it is much simpler than either of those languages. In fact, if you examine the features of Java, you'll see that it has more in common with languages like Smalltalk and Lisp.

Java is a statically typed language, like C/C++. This means that the Java compiler can perform static type checking and enforce a number of usage rules.

Java is fully runtime-typed as well. The Java runtime system keeps track of all the objects in the system, which makes it possible to determine their types at runtime. For example, casts from one object type to another are verified at runtime. Runtime typing also makes it possible to use completely new, dynamically loaded objects with some amount of type safety.

Java is a late-binding language, like Smalltalk, which means that it binds method calls to their definitions at runtime. Runtime binding is essential for an object-oriented language, where a subclass can override methods in its super class, and only the runtime system can determine which method should be invoked. However, Java also supports the performance benefits of early binding. When the compiler can determine that a method cannot be overridden by sub classing, the method definition is bound to the method call at compile-time.

Java takes care of memory management for applications, which is unlike C/C++, where the programmer is responsible for explicit memory management. Java supports the dynamic allocation of arrays and objects, and then takes care of reclaiming the storage for objects and arrays when it is safe to do so, using a technique called garbage collection. This eliminates one of the largest sources of bugs in C/C++ programs.

Java supports object references, which are like pointers in C/C++. However, Java does not allow any manipulation of references. For example, there is no way that a programmer can explicitly dereference a reference or use pointer arithmetic. Java implicitly handles dereferencing references, which means that they can be used to do most of the legitimate things that C/C++ pointers can do.

Java uses a single-inheritance class model, rather than the error-prone multiple-inheritance model used by C++. Instead, Java provides a feature called an interface (borrowed from Objective C) that specifies the behavior of an object without defining its implementation. Java supports multiple inheritances of interfaces, which provides many of the benefits of multiple inheritances, without the associated problems.

Java has a powerful exception-handling mechanism, somewhat like that in newer implementations of C++. Exception handling provides a way to separate error-handling code from normal code, which leads to cleaner, more robust applications.

Java is both a compiled and an interpreted language. Java code is compiled to Java byte-codes, which are then executed by a Java runtime environment, called the Java virtual machine. The specifications of the Java language and the virtual machine are fully defined; there are no implementation-dependent details. This architecture makes Java an extremely portable language.

What is J2ME ?

Java 2, Micro Edition is a group of specifications and technologies that pertain to Java on small devices. The J2ME moniker covers a wide range of devices, from pagers and mobile telephones through set-top boxes and car navigation systems. The J2ME world is divided into configurations and profiles, specifications that describe a Java environment for a specific class of device.

What is J2ME WTK ?

The J2ME Wireless Toolkit is a set of tools that provides developers with an emulation environment, documentation and examples for developing Java applications for small devices. The J2ME WTK is based on the Connected Limited Device Configuration (CLDC) and Mobile Information Device Profile (MIDP) reference implementations, and can be tightly integrated with Forte for Java .

What is CLDC ?

The Connected, Limited Device Configuration (CLDC) is a specification for a J2ME configuration. The CLDC is for devices with less than 512 KB or RAM available for the Java system and an intermittent (limited) network connection. It specifies a stripped-down Java virtual machine1 called the KVM as well as several APIs for fundamental application services. Three packages are minimalist versions of the J2SE java.lang, java.io, and java.util packages. A fourth package, javax.microedition.io, implements the Generic Connection Framework, a generalized API for making network connections.

What is configuration ?

In J2ME, a configuration defines the minimum Java runtime environment for a family of devices: the combination of a Java virtual machine (either the standard J2SE virtual machine or a much more limited version called the CLDC VM) and a core set of APIs. CDC and CLDC are configurations. See also profile, optional package.

What is MIDlet

A MIDlet is an application written for MIDP. MIDlet applications are subclasses of the javax.microedition.midlet.MIDlet class that is defined by MIDP.

What is MIDlet suite

MIDlets are packaged and distributed as MIDlet suites. A MIDlet suite can contain one or more MIDlets. The MIDlet suite consists of two files, an application descriptor file with a .jad extension and an archive file with a .jar file. The descriptor lists the archive file name, the names and class names for each MIDlet in the suite, and other information. The archive file contains the MIDlet classes and resource files.

What is MIDP

The Mobile Information Device Profile (MIDP) is a specification for a J2ME profile. It is layered on top of CLDC and adds APIs for application life cycle, user interface, networking, and persistent storage.

Writing Services

Essay Writing
Service

Find out how the very best essay writing service can help you accomplish more and achieve higher marks today.

Assignment Writing Service

From complicated assignments to tricky tasks, our experts can tackle virtually any question thrown at them.

Dissertation Writing Service

A dissertation (also known as a thesis or research project) is probably the most important piece of work for any student! From full dissertations to individual chapters, we’re on hand to support you.

Coursework Writing Service

Our expert qualified writers can help you get your coursework right first time, every time.

Dissertation Proposal Service

The first step to completing a dissertation is to create a proposal that talks about what you wish to do. Our experts can design suitable methodologies - perfect to help you get started with a dissertation.

Report Writing
Service

Reports for any audience. Perfectly structured, professionally written, and tailored to suit your exact requirements.

Essay Skeleton Answer Service

If you’re just looking for some help to get started on an essay, our outline service provides you with a perfect essay plan.

Marking & Proofreading Service

Not sure if your work is hitting the mark? Struggling to get feedback from your lecturer? Our premium marking service was created just for you - get the feedback you deserve now.

Exam Revision
Service

Exams can be one of the most stressful experiences you’ll ever have! Revision is key, and we’re here to help. With custom created revision notes and exam answers, you’ll never feel underprepared again.