Thursday 12 November 2015

Object Oriented Programming

What the PBO?

          OOP / PBO is a programming paradigm that is popular today that has replaced the procedure-based programming techniques. Object Oriented Programming which also means Object-oriented programming has been discovered around 1960 and was developed in the early 1970s.

Object-Oriented Programming (Object Oriented Programming / OOP) is the object-oriented programming, where all the data and functions are wrapped in classes or objects. Each object can receive messages, process data, sending, storing and manipulating data. Some objects interact with each other to provide information to one another.
          Each object must contain information about itself and can be connected with another object. Object-oriented programming is different from procedural programming using only one page down to do a lot of commands or statements. The use of object-oriented programming is very benyak once, for example: java, php, perl, C #, COBOL, and others.

          In the Object Oriented Programming concept known some common terms, namely:

- Attribute

Attribute Definition and Overview

           The attributes of a class is a global variable that is owned by a class, an attribute may have the right to access private, public or protected.
An attribute that is declared as private may only be accessed directly by the class wraps, while other classes can not access these attributes directly.

           An attribute that is declared as public can be accessed directly by other classes outside the classroom are wrapped.
An attribute that is declared as protected can not be accessed directly by other classes outside the classroom are wrapped, except that access class is a subclass of class wrapping.
           Attributes are also commonly called state / properties / fields is part owned by a class that does not do surgery, but her surgery is performed so as to change the value of the attribute.

Characteristics Attributes

          In class, the attribute referred to as a variable. Attributes can differentiate between one object with another object. For example, in the class: the students, the students are the object A and object of the student B.
          The only difference between the A and the object B is its NPM (student identification number) that is an attribute of the object. In the attributes, there are also two variable term, namely Class Instance Variables and Variable.
Where each variable has its own characteristics, including:
In the Instance Variables instance à each object has its own variables and store values.

          While the Class Variables à attributes shared by all objects that come from the same class, as well as all objects have the same value of the variable class. attributes of the object of the same class.

- Method

Method Definitions and Overview

          Method is a function or procedure that is created by a programmer in a Class. In other words, the method in a class similar in function or procedure in procedural programming.
          On a method in a class also have access permissions as well as the attributes of the class, the access permissions that include private, public and protected who has the same meaning to permit access to the attributes that have been discussed previously. A class may have more than one method with the same name as long as it has a different input parameters so that the compiler or interpreter can recognize where the method is invoked.

          This is called overloading. In a classroom, there is also the so-called static methods or attributes that have the keyword static. The purpose of the static here is a method that can be accessed to share with all other objects without having to create an object which has a static method before (without the new), but a static method has limitations that can only access attributes or other methods in the class that wrap which is also static. Static method is usually implemented for the main method.

Characteristic Method

          Within a class, the behavior is stored in the form of Method. Method is a series of statements / commands (command = line program) in a class that handles a specific task. Method are things that can be done by objects of a class.
Method is defined in the class but invoked through the object. Method has a role include:
- Change the value attribute of an object,
- Receives information from other objects, and
- Send information to another object to perform a task (how objects communicate with another object is to use the method).

- Class

          Is a model that contains a set of attributes and methods in a unit for a particular purpose. For example, humans have the class attribute weight, height, age and then have a method to eat, drink, sleep. Methods in a class can change the attributes possessed by the class. A class is the basis of modularity and structures in object oriented programming.

Definitions and Overview Class

          Class is defined as a blueprint (plan), or prototype, which defines the variables and methods common to all objects of a certain type n (n means a certain amount). A class resembles a structure that is the data type itself, eg point data type that consists of x and y coordinates. Java language has been used a class to declare the type of data point because the Java programming language is a pure object-oriented programming language that does not know the structure, but to know what is called a class.

          Difference in a classroom with a structure is a class can stand alone and can be used for various purposes other classes, whereas a structure can not stand alone. A more flexible classes to be used by another class without having to disassemble the code of the main program, whereas if it is used, the structure must be demolished transform program code copied parts of the structure to another main program code.

          A file can consist of a variety of classes, but usually in the Java programming language file consists of only one class that is stored with the class name, eg List.java file containing the class list. However, if the class is made for example nama_kelas public class, then that class should be stored in a single file for one class only. After compiling then on there will be a Java .class file that contains bytecode of any class.

          If a file consists of two classes, then after compilation will produce the two .class files which will be read by the Java interpreter when the program is executed. A class when the program is executed and the new command is executed, it will be made an object. Class is a template for the creation of objects. Class also has members, including: the attributes and methods.
Understanding of brevity:
• Class is a pattern / template that describes a collection of objects that have similar properties and behavior.
• Class is a data structure of the object (the blueprint of an object), and the process of making an object of a class is also called instantiation.
• Class is the definition of data and functionality of a thing (object, concept, etc.).
• In the class declared variables and method owned by object

Characteristics Class

          Class has several characteristics, including: members of the class consists of attributes and methods. Each member class has its own access control, the point is whether the members of the class can be accessed freely (with the type of public) or only accessible through an interface.
          In this case, the interface is a device used for communication between different objects that do not have any relationship. Interface can be regarded as the communication protocol between the object.

- Object

          Is the embodiment of class, every object will have the attributes and methods that are owned by his class, for example: amir, Ahmad, minister to an object of class man. Each object can interact with other objects in spite of coming from a different class.

Object Definition and Overview

          Object is something that has an identity (name), generally also have data about himself or another object and have the ability to do something and be able to work together with other objects. Basically all objects in the world can be regarded as an object. Houses, cars, motorcycles, desks, and computers are examples of objects that exist in the real world. Object is the implementation class. In simple, it can be said to consist of properties (attributes) and methods.
Understanding of brevity:
• The object is a special object that is used to access members of the object (attribute or method) of the object itself.
• If there are other variables that have the same name as the name attribute inside the object, "this" can be used to refer to object attributes.

Object Characteristics

          Each object has two main characteristics, namely its attributes and behavior. A status object attributes and behavior is the behavior of the object.
          A simple example is the bicycle. Bicycle object has attributes: pedals, wheels, and gears, speed as well as having behavior such as runway and brakes. Just like the depiction in the real world, the development of programs with OOP concept also uses an object model that will store in a variable attributes and behavior in the methods or functions / procedures. The description:
Object instance: Bicycles
- Bicycles have attributes (state): pedals, wheels, spokes, and color.
- Bicycles have behavior (behavior): ascending speed, the speed decreases, and the gearshift bicycle.
In object-oriented software development, object in the software will store their state in a variable and store information behavior (behavior) in those methods or functions / procedures.

Concepts in OOP / PBO:

- Abstraction

          Is a way to look at an object in a simpler form. For example, we did not see a car as thousands of electronic components, mechanical systems with four tires, seats, steering wheel and so on. By Abstraction, a complex system can be viewed as a collection of subsystems that more simple, like a car is a system consisting of various subsystems, such as steering subsystem, subsystem braking and so on.

          Abstraction is the ability of a program to bypass aspects of information processed by it, namely the ability to focus on the core. Every object in the system serves as a model of the "perpetrators" abstract that can do the work, reports and changes in circumstances, and communicate with other objects in the system, without revealing how this excess is applied.
          Processes, functions or methods can also be made abstract, and some of the techniques used to develop a pengabstrakan.

- Encapsulation

          Is a mechanism to hide or protect a process from possible external interference or abuse of the system and also simplifies use of the system.
          Ensure the user an object can not change the state of an object in a way that is not feasible. Only methods in such objects are given permission to access the situation. Each object access interface that specifies how other objects can interact with it. Other objects will not know and rely on the representation of the object.

- Inheritance

          An attribute inherited concepts and methods that are owned by a class to class derivatives. With this draft class who made quite define specific attributes and methods therein, while the attribute and the more common method will be obtained from the parent class.
          Adjusting polymorphism and encapsulation by allowing the object is defined and created with a special type of object that has been ada.Objek-object can divide (and extend) their behavior without emotion implement the behavior of the (language-based objects do not always have inheritas.)

- Polymorphism

          Is a concept which enables the use of an interface similar to govern an object in order to perform an act that may in principle be the same but different.
Called object-oriented data model can provide more flexibility, ease of changing programs and is widely used in large-scale software engineering. Furthermore, supporters of OOP claim that OOP is easier to learn for beginners compared with previous approaches besides OOP approach easier to develop and maintain.
          Polymorphism via messaging. Does not depend on calling subroutines, object oriented language can send messages, some methods of dealing with a messaging depends on the specific object in which the message is sent.

          For example, if a bird receive "fast motion", he will move his wings and fly. When the lion received the same message, he would move his feet and ran. They said a similar message, but in accordance with the ability of these animals. This is called polymorphism as a variable in the program tungal can hold different types of objects while the program is running, and the text of the same program can call several different methods at different times in the same calling. This is contrary to achieve polymorphism functional language through the use of first-class functions.

No comments:

Post a Comment