OOp Microproject
OOp Microproject
ON
DIPLOMA IN
COMPUTER ENGINEERING
SUBMITTED TO
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION,
MUMBAI
SUBMITTED BY
Name of Student Enrollment Number
2109920106
Jadhav Shreya akshok 2109920160
Bhalerao shravani Shankar 2109920089
Kamble Mansi Satish 210992185
Thange Prerna Balasaheb
GUIDED BY
(Prof.Navale S.k.)
CERTIFICATE
This is to certify that the project report entitled “Object Oriented Programming(submitted in partion fulfilment requirement of
award of degree computer science” Was successfully completed by Student of Third semester Diploma in computer engineering.
In partial fulfillment of the requirements for the award of the Diploma in Computer engineering and submitted to the
Department of Computer of Samarth Polytechnic, Belhe work carried out during a period for the academic year 2021-22
as per curriculum
Chapter1 Preface 1
Chapter2 Introduction 2
Chapter6 Conclusion 10
.. Acknowledgement ..
I would like to thank respected Mr…….. and Mr. ……..for giving me such a
wonderful opportunity to expand my knowledge for my own branch and giving me
guidelines to present a seminar report. It helped me a lot to realize of what we study for.
Secondly, I would like to thank my parents who patiently helped me as i went through
my work and helped to modify and eliminate some of the irrelevant or un-necessary
stuffs.
Thirdly, I would like to thank my friends who helped me to make my work more
organized and well-stacked till the end.
Next, I would thank Microsoft for developing such a wonderful tool like MS Word. It
helped my work a lot to remain error-free.
Last but clearly not the least, I would thank The Almighty for giving me strength to
complete my report on time.
1. Preface
I have made this report file on the topic Object Oriented Programming; I have tried my best to
elucidate all the relevant detail to the topic to be included in the report. While in the beginning
I have tried to give a general view about this topic.
My efforts and wholehearted co-corporation of each and everyone has ended on a successful
note. I express my sincere gratitude to …………..who assisting me throughout the preparation
of this topic. I thank him for providing me the reinforcement, confidence and most importantly
the track for the topic whenever I needed it.
Object programming (Samarth Pollytecnic..)
2.Introduction
Object-Oriented Programming (OOP) is the term used to describe a programming approach based on objects
and classes. The objectoriented paradigm allows us to organise software as a collection of objects that consist
of both data and behaviour. This is in contrast to conventional functional programming practice that only
loosely connects data and behaviour.
Since the 1980s the word 'object' has appeared in relation to programming languages, with almost all
languages developed since 1990 having object-oriented features. Some languages have even had object-
oriented features retro-fitted. It is widely accepted that objectoriented programming is the most important and
powerful way of creating software.
The object-oriented programming approach encourages:
• Modularisation: where the application can be decomposed into modules.
• Software re-use: where an application can be composed from existing and new modules.
An object-oriented programming language generally supports five main features: • Classes
• Objects
• Classification
• Polymorphism
• Inheritance What is OOP?
OOP is a design philosophy. It stands for Object Oriented Programming. Object-Oriented Programming
(OOP) uses a different set of programming languages than old procedural programming languages (C,
Pascal, etc.). Everything in OOP is grouped as self sustainable "objects". Hence, you gain reusability by
means of four main object-oriented programming concepts.
In order to clearly understand the object orientation model, let’s take your “hand” as an example. The “hand”
is a class. Your body has two objects of the type "hand", named "left hand" and "right hand". Their main
functions are controlled or managed by a set of electrical signals sent through your shoulders (through an
interface). So the shoulder is an interface that your body uses to interact with your hands. The hand is a well-
architected class. The hand is being reused to create the left hand and the right hand by slightly changing the
properties of it.
What is an Object?
An object can be considered a "thing" that can perform a set of related activities. The set of activities that the
object performs defines the object's behavior. For example, the Hand (object) can grip something, or a
Student (object) can give their name or address.
In pure OOP terms an object is an instance of a class.
Object programming (Samarth Pollytecnic..)
clauses is one that rewrites clauses with the same name, allowing thus the redefinition of
clauses.
In the example, an object of class B has all the clauses defined in B more the clauses of A
with head different of the all clause of B are available. In the example, an object B has
one way of considering satisfactory student's final test: when the student passes the
exercise 4.
In the first alternative, a subclass can add new clauses with the same name, but it can
not redefine clauses; in the second, it is considered the alternative in which the subclass
redefine clauses with the same name, but it can not add clauses with the same name.
The examples above show two possibilities of combining logical modules by means of
inheritance: the first alternative was adopted by SPOOL [Fukunaga, 1986] and the
second by SCOOP [Vaucher, 1988]. Both combinations of logical formulae are useful in
the programming of object-oriented applications.
Extension of object oriented programming with concepts of logic programming
The object-oriented programming has certain advantages over other paradigms. These
advantages are information hiding, inheritance and modularity. However, in some
applications is necessary to manipulate knowledge responding to some kind of logic that
logic languages provide. For this reason, the possibility to add knowledge in a
declarative form to an objectoriented program became relevant. Examples of languages
that integrate knowledge in objects are shown in [Ishikawa, 1986] and [Amaral, 1993].
These languages allow the creation of a knowledge base in each object and the
management of it through a set of facilities.
Both of the extensions presented in this paper are in this last category. The reason is
that agents behave as objects from an action point of view and internally manage logical
relationships for making intelligent decisions.
Object programming (Samarth Pollytecnic..)
planning(Domain, #links#, #constraints#). %} This integration of objects and logic requires the
existence of the following variables in the scope where the embedded Prolog is located:
• A variable named prologResult of type boolean. • An instance of the Prolog interpreter in
prolog.
• All Java variables declared between “#”.
Another use of Prolog does not preprocess the code. It consists of the inclusion of atoms with the form
$i in the Prolog program, where $i denotes the i-th array element composed of Java objects. When $i is
used in the Prolog program, the i-th array element is taken and it is converted to a Prologcompatible
object.
The example below shows a Prolog predicate that returns true if it can successfully send the message
size to the object in the location $0 (an instance of Person class) and the predicate stores its result in
the Prolog variable X. In this example, the variable X=’Ann’, the name of the person that is sent as
argument.
...
Object obj[] = {new Person}; prolog.call( ''send($0,age,[],X)'', obj );
...
Object programming (Samarth Pollytecnic..)
There is an intelligent agent that needs to use a planning algorithm to generate a plan to achieve its
goals. The planning algorithm has been written in Prolog, using all its capabilities in unification and
backtracking. The result of the algorithm is a plan, that is, a set of partially ordered actions that the
agent has to follow. The plan is represented by a directed graph. The planning algorithm uses another
graph to detect when a newly introduced action interferes with past decisions.
In the described situation, a typical representation for a graph using Prolog is a list containing the
edges. Each element of the list is a pair [ai,bi]that represents an edge (ai,bi) in the graph. The
algorithm needs to known the existence of an edge. This action involves a search over all the list of
edges. In Java, in contrast, the same results can be achieved by using an adjacency matrix, in which an
edge (ai,bi) appears in the matrix as an element in the position i, j. Thus, to know the existence of an
edge in the graph using an adjacency graph it is only necessary to read one position of the matrix.
By using JavaLog it is possible to implement the planning algorithm in Prolog taking advantages of
preconditions matching and backtracking and to use Java for implementing the action graph taking
advantageous of the Java efficiency achieved in the representation and searching in graphs.
The usage of Java objects in a Prolog program requires a special treatment, since an object with an
associated wrapper does not have the same behavior than standard Prolog atoms. A Prolog variable
can change its state only once; on the other hand, a Java object can change its state every time that it
receives a message. It affects the normal way of Prolog programs since objects changes their state
during the normal recursion. The cause of this is that a Java object with a wrapper associated is only a
reference to a Java object.
The existence of Java objects inside Prolog clauses has one important implication: in a recursive
Prolog clause that uses Java objects the programmer has to consider the necessity to save/restore Java
objects at the beginning and end of a clause respectively.
Two implementations of the POP [Weld, 1994] planning algorithm have been made to measure the
improvements of JavaLog over traditional Prolog. One of the experiences has been made using only
Prolog. The other experience has been implemented using JavaLog in which Prolog was used for
implementing the general planning algorithm and Java was used to manage the action graph of
restrictions.
These two versions of the algorithm have been tested using the Sussman anomaly problem as input.
The implementations were executed using the following resources: Pentium 233 Mhz, 32 MB of RAM,
JDK 1.1.3 on GNU/Linux 2.0 and JavaLog.
After ten iterations, the results show the potentiality of the integration offered by JavaLog:
• Using only Prolog: 20.124 sec.
• Using JavaLog: 4.047 sec.
The difference in performance is due to the representation of the directed graph of restrictions in Java
by using an adjacency matrix. In this way, the time O(n) (n is the number of restrictions) that takes the
process of consistency check in the Prolog version of the algorithm is reduced to O(1) by combining
Java and Prolog.
Object programming (Samarth Pollytecnic..)
módulos lógicos
Figure 2 shows how an object may have multiple instance variables with logic knowledge and how this
object can be combined using the plus operator. The addKnowledge() message make available the logic
module sent as argument in knowledge meta-object associated with the base object. This knowledge
can be queried from this moment.
finalTest({anStudent}, unpassed),
exercises({anStudent}, passed).}
Object programming (Samarth Pollytecnic..)
5. Conclusions
In this paper the basis for the development of software intelligent agents from the programming point
of view has been presented. Two alternatives were presented. The difference between the presented
options is based on the typed characteristics of programming languages used. Smalltalk allows the easy
usage of dynamic structures such meta-objects. Java in contrast involves code preprocessing and the
necessity to consider types compatibility.
On the other hand, the fact of that the Prolog interpreter was implemented in the proper language
allows extensions to this interpreter. These extensions can supports the management of mental
attitudes.
6. References
1. www.google.com
2. www.wikipedia.org
3. www.studymafia.org
4. www.pptplanet.com
Object programming (Samarth Pollytecnic..)
..ANNEXURE II ..
( Prof.Navale S.K )