2. The programmer must establish the association between the machine model "solution
space" that is where to deploy the solution, such as a computer, and the problem is what
you really want to solve "problem space" that is where the problem exists, the business.
What is an abstraction? Alan kayresumion the five basic characteristics of Smalltalk for an
object, the first object-oriented language that was successful and one of the languages
that is based on JAVA. These characteristics represent a pure approach to object-oriented
programming.
1. Everything is an object. Think of an object as a variable stores data, allows you "raise
requests" asking him to perform operations on itself. In theory, you can take any
conceptual component of the problem that is being addressed.
2. A program is a bunch of objects that tell each other what to do by sending messages. To
make a solicitude to an object, you must send a message to that object. More specifically,
you can think of a message is a request to call a method that belongs to a particular
object.
3. Each object has its own memory made up of other objects. Put another way, you can
create a new class of Obeto defining a package containing existing objects. Therefore, it
may increase the complexity of a program hiding behind the simplicity of the objects.
4. Every object has an associated type. As the saying goes, every object is an instance of a
case where "class" synonymous with "type." The most important distinguishing
characteristic of a class is "the set of messages that can be sent."
5. All objects of a particular type can receive the same messages. As discussed below, this
statement is really important. Since an object of type "circle" is also an object of type
"shape," a circle can be guaranteed to accept shape messages. This means that you can
write code to communicate with objects of type form and automatically control anything
that fits the description of a form. This capability is one of impersonation most important
concepts of OOP.
Booch offers an even more succinct description of object:
- An object has state, behavior and identity.
This means that an object can have internal data (which provides state), methods (to
provide a behavior) and each object can be uniquely distinguished from other objects, ie,
each object has a unique memory address .
Kenia Álava
3. The object-oriented approach
Reference is made to the elements in the problem space called "objects" to their
representations in the solution space. The idea is that the program can adapt by itself to
the lingo of the problem by adding new types of objects so that when you read the code
describing the solution, you are reading words that also express the problem. Thus OOP
allows you to describe the problem in terms of the problem rather than in terms of the
computer.
Why use classes?
Since a class describes a set of objects having characteristics (data elements) and behavior
(functionality) identical actually a class is a type of data because, for example, a floating
point number also has a set of characteristics and performance . The difference is that the
programmer defines a class to fit a problem rather than force the use of an existing data
type that was designed to represent a storage unit in a machine. You can extend the
programming language by adding new data types specific to suit your needs. The
programming system supports the new classes and provides all combinations of type
providing defined types. Creating abstract data types (classes) is a fundamental concept in
object-oriented programming.
What is an object?
Once a class has been defined, you can create as many objects of that class as desired and
these objects can be handled as if the elements of the problem that is being addressed.
But how do you make a object do useful work for the programmer? There must be a way
to make an application in order to do something, such as complete a transaction, draw
something on screen or a switch.
Kenia Álava
4. What is an interface
Also, each object can satisfy only certain requests. Requests can be made to an object are
defined by its interface and is the type that determines the interface. An example with the
representation of a light bulb:
The interface determines the applications that can be done to a certain object, so there
must be a code somewhere to satisfy that request. This, along with the hidden data,
define what it calls the implementation. From the standpoint of procedural programming,
this is not complicated. One type has a method associated with each possible request, and
when a specific request is made to a objesto, this method is called. This process is
summarized by saying that the developer "send a message" (make a request) to an object
and the object knows what to do with this message (it executes the code).
In this example, the name of the type / class is Light, the name of this particular object is lz
Light and applications that can be done to an object light is on, off, or dim glow. It has
created a light object defining a "reference" (lz) for that object and calling new to request
a new object of that type. To send a message to the object, defined the object name and
is related to the application of the message by a point. From the point of view of the user
of a predefined class, that is the ultimate programming objects.
The diagram above follows the format of UML (UnifiedModelingLanguage, Unified
Modeling Language). Each class is represented by a box by typing the name of the guy at
the top, the data members in the intermediate zone and methods (functions of said object
receiving any message sent to the developer that object) in the bottom . Often in these
diagrams only show the name of the class and public method, not including the buffer
zone, as in this case. If you are only interested in the class name, it is not necessary to
include the bottom.
Kenia Álava