OOP

this time , I'll explain Object Oriented Programming Concept(OOP Concept), structure class, package, access control, inheritance, polymorphism, and little example of array and how to manipulate it.

OOP
The Object Oriented paradigms suggest we should model instructions in a computer program with the data they manipulate and store these as components together. One advantage of doing this is we get reusable software components. OOP paradigm aims to help overcome these problems by helping with the analysis and design tasks during the initial software development phase and by ensuring software is robust and maintanable.

Abstraction and encapsulation are fundamental principles of Object Oriented approach to software development. Abstraction allow us to consider complex ideas while ignoring irrelevant detail that would confuse us. Encapsulation allow us to focus on what something does without considering the complexities of how it works. Others fundamental principles of Object Orientation are Generalization/specialization ( which allow us to make use of inherintace ) and Polymorphism.
Generalisation allow us to consider general categories of objects which have common properties and then define specialised sub classes that inherit properties of the general categories. Polymorphism which is the ability to interact with a object as it's generalized category regardless of it's more specialised category.

Class
Class are the basic components of any object oriented software system. A class should typically be recognizable by a non-programmer domain even if associated with exixting problems and code contained in a class should be relatively independent

Package
A package is not just a visual representation of a group of classes instead a 'package' is a directory containing a group of related classes(and interfaces). Package allow us to provide a level of organisation and encapsulation above that of individual classes.

Access Control
OOP provides several types of access rights to the variable (attributes), the method and even class. Type of access rights, which are Public, Private, or Protected. This is one of the most important part of OOP, so that programmers who want to learn OOP required to understand the concept of accessing this data in OOP.

Inheritance
Giving the properties of a major class(super-class) to the other classes(sub-class) that have similiar properties. The main class is usually a genereal/global, while the sub-classes are specific/special

Polymorphism
The ablity of variables to be used as reference or a reference object of different type, and automatically can call the method specific to each type

Array
Substansial program would require a lot of variables. We can only declare variables one by one. Suppose that we need five variables with integer types, we can declared with int x,y,z.
This is still very small, what if we need 500 variables?
This would be inefficient. Thus we need or used arrays.
But before we decide to used array, we must also examine whether the data will be accessed sequentially? if yes then we can use arrays,  but the data will not be accessed sequentially, should declare itself .
 int [] arr = new int[100];

Source : OOP

0 comments

Posting Komentar