Kenia Álava
The programmer must establish the association between the machine model "solutionspace" that is where to deploy the soluti...
The object-oriented approachReference is made to the elements in the problem space called "objects" to theirrepresentation...
What is an interfaceAlso, each object can satisfy only certain requests. Requests can be made to an object aredefined by i...
Upcoming SlideShare
Loading in...5
×

Class 4

96

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
96
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Class 4"

  1. 1. Kenia Álava
  2. 2. The programmer must establish the association between the machine model "solutionspace" that is where to deploy the solution, such as a computer, and the problem is whatyou 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 anobject, the first object-oriented language that was successful and one of the languagesthat is based on JAVA. These characteristics represent a pure approach to object-orientedprogramming.1. Everything is an object. Think of an object as a variable stores data, allows you "raiserequests" asking him to perform operations on itself. In theory, you can take anyconceptual 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. Tomake 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 particularobject.3. Each object has its own memory made up of other objects. Put another way, you cancreate a new class of Obeto defining a package containing existing objects. Therefore, itmay 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 acase where "class" synonymous with "type." The most important distinguishingcharacteristic 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, thisstatement 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 canwrite code to communicate with objects of type form and automatically control anythingthat fits the description of a form. This capability is one of impersonation most importantconcepts 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 (toprovide a behavior) and each object can be uniquely distinguished from other objects, ie,each object has a unique memory address . Kenia Álava
  3. 3. The object-oriented approachReference is made to the elements in the problem space called "objects" to theirrepresentations in the solution space. The idea is that the program can adapt by itself tothe lingo of the problem by adding new types of objects so that when you read the codedescribing the solution, you are reading words that also express the problem. Thus OOPallows you to describe the problem in terms of the problem rather than in terms of thecomputer. 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 floatingpoint number also has a set of characteristics and performance . The difference is that theprogrammer defines a class to fit a problem rather than force the use of an existing datatype that was designed to represent a storage unit in a machine. You can extend theprogramming language by adding new data types specific to suit your needs. Theprogramming system supports the new classes and provides all combinations of typeproviding defined types. Creating abstract data types (classes) is a fundamental concept inobject-oriented programming. What is an object?Once a class has been defined, you can create as many objects of that class as desired andthese 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 wayto make an application in order to do something, such as complete a transaction, drawsomething on screen or a switch. Kenia Álava
  4. 4. What is an interfaceAlso, each object can satisfy only certain requests. Requests can be made to an object aredefined by its interface and is the type that determines the interface. An example with therepresentation of a light bulb:The interface determines the applications that can be done to a certain object, so theremust 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, andwhen a specific request is made to a objesto, this method is called. This process issummarized by saying that the developer "send a message" (make a request) to an objectand 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 lzLight and applications that can be done to an object light is on, off, or dim glow. It hascreated a light object defining a "reference" (lz) for that object and calling new to requesta new object of that type. To send a message to the object, defined the object name andis related to the application of the message by a point. From the point of view of the userof a predefined class, that is the ultimate programming objects.The diagram above follows the format of UML (UnifiedModelingLanguage, UnifiedModeling Language). Each class is represented by a box by typing the name of the guy atthe top, the data members in the intermediate zone and methods (functions of said objectreceiving any message sent to the developer that object) in the bottom . Often in thesediagrams only show the name of the class and public method, not including the bufferzone, as in this case. If you are only interested in the class name, it is not necessary toinclude the bottom. Kenia Álava

×