Anda di halaman 1dari 31

Introduction to ObjectOriented Programming

History
The terms "objects" and "oriented" in
something like the modern sense of objectoriented programming seem to make their
first appearance at MIT in the late 1950s and
early 1960s. In the environment of the
artificial intelligence group, as early as
1960, "object" could refer to identified items
(LISP atoms) with properties (attributes).
Alan Kaywas later to cite a detailed
understanding of LISP internals as a strong
influence on his thinking in 1966.

History
Another early MIT example was
Sketchpad created by Ivan
Sutherland in 1960-61; in the
glossary of the 1963 technical report
based on his dissertation about
Sketchpad, Sutherland defined
notions of "object" and "instance"
(with the class concept covered by
"master" or "definition"), although
specialized to graphical interaction.

History
Also, an MIT ALGOL version, AED-0,
linked data structures ("plexes", in
that dialect) directly with procedures,
anticipating what were later termed
"messages", "methods" and
"member functions".

History
Objects as a formal concept in
programming were introduced in the
1960s in Simula 67, a major revision
of Simula I, a programming
language designed for discrete event
simulation, created by Ole-Johan
Dahl and Kristen Nygaard of the
Norwegian Computing Center in Oslo.

History
Simula 67 was influenced by SIMSCRIPT and
Charles Antony Richard (CAR) "Tony"
Hoare's proposed "record classes". Simula
introduced the notion of classes and instances
or objects (as well as subclasses, virtual
methods, coroutines, and discrete event
simulation) as part of an explicit programming
paradigm. The language also used automatic
garbage collection that had been invented
earlier for the functional programming
language Lisp.

History
Simula was used for physical
modeling, such as models to study
and improve the movement of ships
and their content through cargo
ports. The ideas of Simula 67
influenced many later languages,
including Smalltalk, derivatives of
LISP (Common LISP Object System
CLOS), Object Pascal, and C++.

History
The Smalltalk language, which was
developed at Xerox PARC (by Alan
Kay and others) in the 1970s,
introduced the term object-oriented
programming to represent the
pervasive use of objects and
messages as the basis for
computation.

History
Smalltalk creators were influenced by
the ideas introduced in Simula 67,
but Smalltalk was designed to be a
fully dynamic system in which
classes could be created and
modified dynamically rather than
statically as in Simula 67.

History
In the mid-80s there was a
resurgence of interest in objectoriented methodologies. Specifically,
OOP languages such as C++ and
Eifle became popular with
mainstream computer programmers.

History
Object-oriented programming
developed as the dominant
programming methodology in the
early and mid 1990s when
programming languages supporting
the techniques became widely
available.

History
OOP continued to grow in popularity in
the 90s, most notably with the advent
of Java and the huge following it
attracted. And in 2002, in conjunction
with the release of the .NET
Framework, Microsoft introduced a
new OOP language, C# (pronounced
C-sharp) and revamped Visual Basic
so that it is truly an OOP language.

What is OOP?
Object-Oriented Programming (OOP)
It is a programming paradigm that uses
"objects, data structures consisting of
data fields and methods together with
their interactions.
Programming techniques may include
features such as data abstraction,
encapsulation, messaging, modularity,
polymorphism, and inheritance.

The Characteristics of
OOP
Data Abstraction
Encapsulation
Messaging
Modularity
Polymorphism
Inheritance
Garbage Collection

Data Abstraction
It is the process by which data and
programs are defined with a
representation similar in form to its
meaning (semantics), while hiding
away the implementation details.
It tries to reduce and factor out
details so that the programmer can
focus on a few concepts at a time.

Encapsulation
A language mechanism for restricting
access to some of the object's
components.
A language construct that facilitates
the bundling of data with the
methods (or other functions)
operating on that data

Messaging
Message Passing
It is a form of communication used
object-oriented programming.
Processes or objects can send and
receive messages (comprising zero
or more bytes, complex data
structures, or even segments of
code) to other processes.

Modularity
Modular programming
It is a software design technique that
increases the extent to which
software is composed of separate,
interchangeable components called
modules by breaking down program
functions into modules, each of
which accomplishes one function and
contains everything necessary to
accomplish this.

Polymorphism
It is the ability to create a variable, a
function, or an object that has more
than one form.

Inheritance
It is a way to reuse code of existing
objects, or to establish a subtype
from an existing object, or both,
depending upon programming
language support.

Garbage Collection
It is a form of automatic memory
management.
It attempts to reclaim garbage, or
memory occupied by objects that are
no longer in use by the program.
It was invented by John McCarthy
around 1959 to solve problems in
Lisp.

Parts of OOP Program


The Program Architecture of
C#

The Program
Architecture of C#
A C# program may contain one or more files. Any
file can contain any of the following elements
Directives
Namespaces
Classes
Structs (structures)
Interfaces
Delegates
Enums (enumerations)
Function members (such as methods, properties,
indexers, and so forth)

Programming
Fundamentals of C#

Data Types
Two (2) Types of Data Types in C#:
Value types
Variables that store data values on the stack

Reference types
Variables that store memory addresses of
the data stored on the heap

Built-in Data Types

Value Types

Data Types Range

Arithmetic,
Assignments, Logical
and Relational
Operators

Operators
The Basic Arithmetic Operators (+, ,
*, /)
The Modulus Operator (%)
The Assignment Operators

Operators
Increment and Decrement Operators
(++, --)
Relational Operators( >,<,!
=,==,>=,<=)
Logical Operators (&&, ||)
Bitwise Operators (&, |, !, ^)

Anda mungkin juga menyukai