Object Concept

This is Java's conception of an Object.

In its simplest embodiment, an object is an allocated region of storage. An object is sometimes called a member* Since programming languages use variables to access objects, the terms object and variable are often used interchangeably. However, until memory is allocated, an object does not exist.

All programming languages present objects. The presence of objects should not be confounded with the concept of object-orientation.

In procedural programming, an object may contain data or instructions, but not both. (Instructions may take the form of a procedure or function). In object-oriented programming, an object may be associated with both the data and the instructions that operate on that data.

How an object is created varies among language. In prototype-based languages (e.g., JavaScript) an object can be created from nothing, or can be based on an existing object. In class-based languages (e.g., Java), objects are derived from classes, which can be thought of as blueprints for constructing objects.

Characteristics Edit

When observing real-world objects (a basketball, tuna fish, phone, etc), two distinct characteristics are common:stateandbehavior.[1] The state of an object describes properties of the object; a basketball has radius, pressure, flat, bouncing, etc. The behavior of an object describes what actions the object can perform.[1] When observing real-world objects, one should ask "What possible states this object be in?" and "What possible behavior can this object perform?".[1]

In comparison, a software object is similar to a real-world object.[1] In terms of Java, states of an object are stored infields(similar to variables in other languages) and behaviors of an object are defined bymethods(similar to function in other languages).[1] By using methods, objects communicate state with one another. In order to achieve data encapsulation, an object must hide its state from other objects by limiting access through only using its behaviors.[1]

Benefits Edit

When defining procedures was first introduced in the 1960s[2], creating reusable code is a coveted goal in programming. Objects are distinct units of code. Specifically, Oracle lists the benefits of using objects as units of code include:[1]

  1. Modularity: code can be maintained independently of other source code
  2. Information-hiding: specific implementations are unknown from the outside world
  3. Code reuse: code already implemented, tested, and case-specific may be used within another program
  4. Pluggability and debugging ease: problems can be traced to specific instances of code and may be replaced with another object

See Also Edit

Links Edit

Wikipedia Definition

Java Sun Definition

Java Sample Codes

Notes Edit

*I think so. Find Out!

Smallwikipedialogo.png This page uses content from Wikipedia. The original article was at Object (computer science). The list of authors can be seen in the page history. As with Java Wiki, the text of Wikipedia is available under the GNU Free Documentation License.


Cite error: <ref> tags exist, but no <references/> tag was found

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.