img
An Overview of Java
A
s in all other computer languages, the elements of Java do not exist in isolation.
Rather, they work together to form the language as a whole. However, this
interrelatedness can make it difficult to describe one aspect of Java without
involving several others. Often a discussion of one feature implies prior knowledge of
another. For this reason, this chapter presents a quick overview of several key features
of Java. The material described here will give you a foothold that will allow you to write
and understand simple programs. Most of the topics discussed will be examined in greater
detail in the remaining chapters of Part I.
Object-Oriented Programming
Object-oriented programming (OOP) is at the core of Java. In fact, all Java programs are to at
least some extent object-oriented. OOP is so integral to Java that it is best to understand its
basic principles before you begin writing even simple Java programs. Therefore, this chapter
begins with a discussion of the theoretical aspects of OOP.
Two Paradigms
All computer programs consist of two elements: code and data. Furthermore, a program can
be conceptually organized around its code or around its data. That is, some programs are
written around "what is happening" and others are written around "who is being affected."
These are the two paradigms that govern how a program is constructed. The first way is
called the process-oriented model. This approach characterizes a program as a series of linear
steps (that is, code). The process-oriented model can be thought of as code acting on data.
Procedural languages such as C employ this model to considerable success. However, as
mentioned in Chapter 1, problems with this approach appear as programs grow larger and
more complex.
To manage increasing complexity, the second approach, called object-oriented programming,
was conceived. Object-oriented programming organizes a program around its data (that is,
objects) and a set of well-defined interfaces to that data. An object-oriented program can be
characterized as data controlling access to code. As you will see, by switching the controlling
entity to data, you can achieve several organizational benefits.
Search WWH :
Custom Search
Previous Page
Java SE 6 Topic Index
Next Page
Java SE 6 Bookmarks
Home