Está en la página 1de 2

Object-oriented programming (OOP) is a programming paradigm that represents concepts as "objects" that have data fields (attributes that

describe the object) and associated procedures known as methods. Objects, which are usually instances ofclasses, are used to interact with one another to design [1][2] applications and computer programs. C++, Objective-C, Smalltalk, Java and C# are examples of object-oriented programming languages.
Contents
[hide]

1 Overview 2 History 3 Fundamental features and concepts

3.1 Decoupling

4 Additional features 5 Formal semantics 6 OOP languages

6.1 OOP in dynamic languages

7 Design patterns

o o o o o o

7.1 Inheritance and behavioral subtyping 7.2 Gang of Four design patterns 7.3 Object-orientation and databases 7.4 Real-world modeling and relationships 7.5 OOP and control flow 7.6 Responsibility- vs. data-driven design

8 Criticism 9 See also 10 References 11 Further reading 12 External links

Overview[edit]
This section needs additional citations for verification.Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (June 2012) In programming languages an object is the composition of nouns (like data such as numbers, strings, or variables) and verbs (like actions, such as functions).

An object oriented program may be viewed as a collection of interacting objects, as opposed to the conventional model, in which a program is seen as a list of tasks (subroutines) to perform. In OOP, each object is capable of receiving messages, processing data, and sending messages to other objects. Each object can be viewed as an independent "machine" with a distinct role or responsibility. Actions (or "methods") on these objects are closely associated with the object. For example, OOP data structurestend to "carry their own operators around with them" (or at least "inherit" them from a similar object or class)except when they must be serialized. Simple, non-OOP programs may be one "long" list of commands. More complex programs often group smaller sections of these statements into functions or subroutineseach of which might perform a particular task. With designs of this sort, it is common for some of the program's data to be 'global', i.e., accessible from any part of the program. As programs grow in size, allowing any function to modify any piece of data means that bugs can have wide-reaching effects. In contrast, the object-oriented approach encourages the programmer to place data where it is not directly accessible by the rest of the program. Instead, the data is accessed by calling specially written functions, commonly called methods, which are bundled in with the data. These act as the intermediaries for retrieving or modifying the data they control. The programming construct that combines data with a set of methods for accessing and managing those data is called an object. The practice of using subroutines to examine or modify certain kinds of data was also used in non-OOP modular programming, well before the widespread use of object-oriented programming. An object-oriented program usually contains different types of objects, each corresponding to a particular kind of complex data to manage, or perhaps to a real-world object or concept such as a bank account, a hockey player, or a bulldozer. A program might contain multiple copies of each type of object, one for each of the real-world objects the program deals with. For instance, there could be one bank account object for each real-world account at a particular bank. Each copy of the bank account object would be alike in the methods it offers for manipulating or reading its data, but the data inside each object would differ reflecting the different history of each account. Objects can be thought of as encapsulating their data within a set of functions designed to ensure that the data are used appropriately, and to assist in that use. The object's methods typically include checks and safeguards specific to the data types the object contains. An object can also offer simple-to-use, standardized methods for performing particular operations on its data, while concealing the specifics of how those tasks are accomplished. In this way alterations can be made to the internal structure or methods of an object without requiring that the rest of the program be modified. This approach can also be used to offer standardized methods across different types of objects. As an example, several differen

También podría gustarte