All the programming language consists of code and data. Code is meant here is the logical process of the program, while the data can be either variable or constant. Furthermore,
code and data are arranged in such a way that they can work together to
produce output according to the desired process.
In procedural programming model, all data and code are combined into a single part in a program. For simple programs that only requires a few lines of code, the use of this model is still relevant for use. But
for extremely complex problems, which may require hundreds or even
thousands of code, procedural programming has become largely irrelevant.
For this reason then developed a new programming method, known as object-based programming (Object Oriented Programming).
Object oriented programming (OOP) is a programming form of the problem with the approach object model. The point is that everything is made on the program both visual and non-visual will be seen as an object. An example is the C programming language and Java.
The concept of Object Oriented Programming.The
basic concepts of object-oriented programming is a Class, Packaging
(encapsulation), Inheritance (Inheritence), polymorphisms (Overloading
and overriding), Package, Interface.
1. Class
Class
is one of the fundamental concepts of object-oriented programming, a
class can be illustrated as a blueprint (blueprint) or prototype that is
used to create the object. A
class defines a set of data elements (which are usually called
attributes) and behavior or function (called the method) is used to
manipulate objects or perform inter-object interaction. This method attributes and together are known as members of the object.Class
is at the core of Java programming, because Java is a programming
language that supports and implements the fully OOP concepts. Every Java program is a class, this means that each concept or cases that will be implemented in Java, to be wrapped in a class.The following will explain the concepts that exist in a class: method, constructor and object.
a. Method is the implementation of the class how they work. The
things that can be done in the method is the manipulation of data,
mathematical calculations, and to monitor the occurrence of an event.
b. Konstructor is a special method that is used to set the initial state when the object was created. There are some important notes that must be considered in the declaration konstructor. First, the name must match the name konstructor class. second, konstructor argument may have more than one or none at all. Third, konstructor must not return a value.
c. Object is the basic entity at runtime. At the time of program code executable, object interact with each other without having to know the details of the data or code. Interaction between objects is carried out using a message. Object has a life cycle, that is created, manipulated and destroyed.
2. Inheritance (Inheritance)
Inheritance
is the inheritance which means a class can inherit attributes and
methods of another class that was similar, in a real-world example is
the class nature of the animal and its ability to lower the class of
mammals, vertebrate class etc, Animal class as superclass and inherited
attributes as well his method to a subclass of mammals.We can define a new class inherits from another class that already exists. The decline of these properties can be performed stratified, so getting to the bottom of the class to be more specific. Sub-class specification allows us to perform detailed and specific behavior of class superclass. With
the concept of inheritance, a programmer can use a code that has been
written on the super class repeatedly on derivatives classes without
having to rewrite all the code it.
3. Polymorphisms (Overloading and overriding)
Polymorhpisme means the ability to take on several forms. In a programming concept, it means the ability of a given type variable to refer to a different object types. In practice, there are two types of polimorphisme, namely overloading and overiding. Overloading is the process of defining methods with the same name as instance variables. While overiding Occurs when a subclass method declaration with method of superclassnya
4. Package
Package can be illustrated as a place where the folder is stored all the classes and interfaces that are interconnected. Usability is the main package to avoid any similarity to the name of the classes to be made.
5. InterfaceIn English, the interface is defined as a device or system that is used by other entities to interact with each other. In OOP, protocol or interface is defined as a liaison between the actual object memilliki no relation. An object can implement more than one interface.Technically, the interface is a container of a set of abstract method, or no implementation at all.
Minggu, 31 Maret 2013
Langganan:
Posting Komentar (Atom)
Diberdayakan oleh Blogger.
0 komentar:
Posting Komentar