Вы находитесь на странице: 1из 4

JOURNAL PAPER OF OOP 21, November 2019 1

Ministry of Higher Education


Kabul Polytechnic University
Faculty of Computer Engineering and Informatics
Department of Computer Engineering

Scientific Writing

Author: Rohullah_Asghari
Instructor: Bissmillah_Hussaini
Date 21, November 2019
JOURNAL PAPER OF OOP 21, November 2019 2

OOP Object oriented


programming
Rohullah_Asghari, student in, Computer Engineering Department
Faculty of Computer Engineering and Informatics
Kabul Polytechnic University
Instructor: Bismillah_Hussaini

Abstract—As you know today all program language use object oriented programming (OOP) because it causes up the efficiency of
one program. so now I describe some part of OOP in my article. OOP is best way for to solve and make readable complex and large
part of programming. In addition, it is helpful to write less code and prevent waste of memory. We use some OOP technique in
our program like polymorphism, encapsulation, inheritance, and abstraction, these techniques cause that we reuse our code,
prevent from code repetition and complexity of a program, that a program have a best efficiency.

Index Terms—Introduction to OOP, Class and Object, Inheritance, Polymorphism, Encapsulation, Abstract Class and Methods.

F
1 INTRODUCTION programming and to introduce a conceptual
foundation of object oriented programming.
O BJECT-oriented programming, also known as
OOP, is a required skill, that the most of
programming use it, because object-oriented
Another purpose of this paper is to introduce the
object oriented programming. To be able to write
programming allows you to maximize code reuse programs, knowledge of the components of object
and minimize the costs. However, learning object- oriented programs. We must learn the process of
oriented programming is challenging because it writing programs. We will present a brief
includes too many abstract concepts that require introduction to the object oriented programming in
real-life examples to make it easy to understand. this paper.
Thus, learning object oriented programming
language allows you to writing high quality reusable 2.1 What is a class and objects?
codes in a program. Your code will become easy to
understand. The two most important concepts in object oriented
21 November 2019 programming are the class and object. an object is a
thing, both tangible and intangible, that we can
imagine. A program written in object-oriented style
2 WHAT IS OBJECT ORIENTED PROGRAMMING? will consist of interacting objects. For example,
Before we begin to write actual programs, we need chair, animal, and many other types of objects. An
to introduce a few basic concepts of object object is comprised of data and operations that
manipulate these data, inside a program we write
instructions to create objects. For the computer to
• Rohullah_Asghari son of Mohammad Essa Student in Computer be able to create an object, we must provide a
Engineering
definition, called a class. A class is a kind of mold or
E-mail:asghari.rohullah72@gmail.com

template or a group of an object. An object is called
an instance of a class. An object is an instance of
Instructor: Bismillah _Hussaini
Date: 21, November 2019
exactly one class. An instance of a class belongs to
oriented programming (OOP), The purpose of this the class. Once a class is defined, we can create as
paper is to give you a feel for object oriented many instances of the class as a program.
JOURNAL PAPER OF OOP 21, November 2019 3

2.2 Inheritance programming terms it means the ability of a single


Inheritance is a mechanism that we use in the object variable of a given type to be used to reference
oriented programming, in general, we can use only objects of different types and to automatically call
a single class to model two or more entities that are the method that is specific to the type of object the
similar but it is not good design. In object-oriented variable references. This enables a single method
programming, we use a mechanism called call to behave differently. With polymorphism, we
inheritance to design two or more entities that are can design and implement systems that are easily
different but share many common features. First we extensible.
define a class that contains the common features of
the entities. Then we define classes as an extension
of the common class inheriting everything from the 2.4 Encapsulation
common class. We call the common class the
superclass and all classes that inherit from it At this point we can introduce another mechanism
subclass. We also call the superclass an ancestor and encapsulation. Encapsulation refers to the hiding of
the subclass a descendant. Other names for items of data and methods within an object. This is
superclass and subclass are base class and derived achieved by specifying them as private in the
class, respectively. For the animal example, we can definition of the class. In the dog class, the instance
define a superclass animal and then define Sheep variables color, move was encapsulated. They were
and Dog as subclasses of animal. We represent the accessible only through the methods defined for the
superclass and its subclasses as we draw arrows class. Therefore, the only way to alter the values
from each subclass to its superclass because a they contain is to call a method that does that. Being
subclass can refer to items defined in its superclass, able to encapsulate members of a class in this way
but not vice versa. Inheritance is not limited to one is important for the security and integrity of class
level. A subclass can be a superclass of other classes, objects. By hiding the data members and forcing the
forming an inheritance hierarchy. use of a method to set or change the values, you can
ensure that only legal values are set. I mentioned
earlier another major advantage of encapsulation -
2.3 Polymorphism
the ability to hide the implementation of a class. By
We continue our study of object oriented allowing only limited access to the members of a
programming by explaining polymorphism with class. As long as the external characteristics of the
inheritance hierarchies. Polymorphism enables you methods that can be called from outside the class
to program in the general rather than program in remain unchanged, the internal code can be
the specific. In particular, polymorphism enables changed in any way that you, the programmer,
you to write programs that process objects that want. A particular object, an instance of dog
share the same superclass (either directly or incorporates, or encapsulates, the color , the move
indirectly); this can simplify programming. We of the object, and the status of the move in the
consider these classes sheep, dog and fish that each instance variable running. Only the constructor, and
class extends superclass Animal, which contains a the all methods can be accessed externally.
method move in super class animal. Each subclass
implements method Move. Each specific type of
2.5 Abstract Class and Methods
Animal responds to a move method in its own way,
a Fish might swim three feet, a dog might run five When we think of a class type, we assume that
feet and a sheep might run one feet. In response to programs will create objects of that type. In some
the same method call is the key concept of cases, however, it is useful to declare classes for
polymorphism. The same message (in this case, which the programmer never intends to instantiate
move) sent to a variety of objects has many forms of objects. Such classes are called abstract class.
results hence the term polymorphism. The word Because they are used only as superclass in
polymorphism generally means the ability to inheritance hierarchies, we refer to them as abstract
assume several different forms or shapes. In super class. These classes cannot be used to
JOURNAL PAPER OF OOP 21, November 2019 4

instantiate objects, because, as we will soon see,


abstract classes are incomplete. Subclasses must
declare the missing pieces. Concrete classes provide
the specifics that make it reasonable to instantiate
objects. Not all inheritance hierarchies contain
abstract classes. However, programmers often write
client code that uses only abstract superclass types
to reduce client codes dependencies on a range of
specific subclass types. For example, a programmer
can write a method with a parameter of an abstract
superclass type. When called, such a method can be
passed an object of any concrete class that directly
or indirectly extends the superclass specified as the
parameters type. Abstract classes sometimes
constitute several levels of the hierarchy.

3 CONCLUSION
After study this article we know about efficiency of
OOP in all program language. We can use one
method or function to different part of class or
program every time. And prevent time waste and
memory waste. And it makes our program logically.
We can even refactor existing code to take
advantage of object-oriented programming in order
to prepare the code for future requirements, reduce
maintenance costs, and maximize code reuse. Once
you start working with object-oriented code and
follow its best practices, it is difficult to stop writing
code that works with objects. Objects are
everywhere in real-life situations; therefore, it
makes sense to code plenty of objects. Now that you
have learned to write object-oriented code, you are
ready to use everything you learned in real life
applications that will not only rock, but also
maximize code reuse and simplify maintenance.

REFERENCES
[1] Caston.C Hillar / Learning object-oriented programming
[2] Thomas Wu / An introduction to object oriented programming
with Java Fifth Edition
[3] Stephen R. Schach / Object oriented software Engineering
[4] Rudolf Pecinovsky / Learn object-oriented Thinking and
programming

Вам также может понравиться