Beruflich Dokumente
Kultur Dokumente
OBJECT-ORIENTED
PROGRAMMING
fundamentals of object-oriented programming
WHAT IS A COMPUTER?
COMPUTER
an electronic device for storing and processing data
according to instructions given to it in a variable program.
INPUT
PROCESSOR
MEMORY
OUTPUT
COMPUTER PROGRAMS
PROGRAM
a list of instructions that can be interpreted by a computer
that embodies an algorithm in computer-coded version
ALGORITHM
a procedure or formula for solving a problem
HOW DO WE WRITE
COMPUTER PROGRAMS?
COMPUTER PROGRAMMING
ELECTRONIC COMPUTERS HAVE INSTRUCTION SETS
basic operations that the computer can do
i.e., Turing Machine: MOVE head, READ, and WRITE
MACHINE LANGUAGES
the most primitive (baseline) language that we can use to write programs
machine language is messy and error-prone for humans
COMPUTER PROGRAMMING
HIGHER LEVEL PROGRAMMING LANGUAGES
instructions are human readable
programming platforms come with compiler and/or translators
PROGRAMMING PARADIGMS
STRUCTURED
top-down design; algorithmic
perspective; procedure,
function, or subroutine
FUNCTIONAL
treats computation as the
evaluation of mathematical
functions
LOGIC
declarative; uses
mathematical logic
OBJECT-ORIENTED
programs are treated as
objects that may be composed
of smaller objects
PROGRAMMING PARADIGMS
THE PROGRAMMING PARADIGM
DICTATES:
HOW YOU SHOULD APPROACH A PROBLEM
BIT OF HISTORY
SIMULATION LANGUAGE (SIMULA)
introduced object-oriented programming concepts such as object, class,
dynamic binding, etc
BIT OF HISTORY
ALAN KAY
(1970s) - led a team that developed
Smalltalk at Xerox PARC
coined the term object-oriented
programming
SMALLTALK
inspired by SIMULA
graphics-driven
used in Dynabook
BIT OF HISTORY
BJARNE STROUSTRUP
implemented C with Classes aka C++
C++ became the most widely used objectoriented language
JAMES GOSLING
1990s his team at Sun developed Java
Java rode with the popularity of the
Internet
simplified C++
PYTHON
OBJECTIVE-C
RUBY
MODULA-2
CLOS
OBERON
ENCAPSULATION
objects have an associated type (class)
INHERITANCE
types (classes) may inherit attributes from supertypes
(superclasses)
VISUALBASIC, JAVASCRIPT,
TYPESCRIPT, ETC.
TYPES OF OOPL
CLASS-BASED
makes use of class to define
objects
PURE
all data types are objects
PROTOTYPEBASED
define a prototype which
becomes the basis for new
objects
HYBRID
mix of primitives and objects
JAVA
JAVA PROGRAMMING LANGUAGE
originally developed by Sun Microsystems, which was
initiated by James Gosling
EASY TO USE
SECURE
RELIABLE
Java needed to reduce the likelihood of
fatal errors from programmer mistakes
PLATFORM INDEPENDENT
Java was written to be a portable language
OBJECT
an entity with well-defined boundary that encapsulates
state and behavior anything with which we store data
and the operations that manipulate those data
PROPERTIES OF OBJECTS
OBJECTS HAVE STATES
OBJECTS EXHIBIT BEHAVIOR
OBJECTS HAVE IDENTITY
OBJECTS HAVE RELATIONSHIPS WITH OTHER OBJECTS
OBJECT
STATE
the state of an object encompasses all the properties of the
object and the current values of each of these properties
NEW
CONTINUING
GRADUATING
GRADUATE
PROBATIONARY
DISMISSED
READMITTED
PERMANENTLY
DISMISSED
OBJECT
BEHAVIOR
how an object acts and reacts, in terms of its state
changes and message passing
OPERATIONS
defined actions of objects
aka methods
aka message (i.e., defined messages that objects respond to or understand)
OBJECT
IDENTITY
every occurrence of a particular type of object can be distinguished
from every other occurrence of the same type of object, as well as
object from other types
RELATIONSHIPS
KINDS OF RELATIONS
association
aggregation
inheritance (superclass subclass)
OBJECT
ABSTRACTION
denotes the essential characteristics of an object that distinguish it
from all other kinds of objects and provide a crisply-defined
conceptual boundary, relative to the perspective of the viewer
STUDENT REGISTRATION
SYSTEM
STUDENT
COURSE
RECOMMENDED
COURSE
SECTION
SLOT
LIBRARY PC USAGE
TRACKING
STUDENT
BAN LIST
USER ACTIVITY
CLASS
a structure that contains data and methods that
manipulate those data
TYPES OF CLASSES
CONCRETE CLASS
a set of entities with well-defined
attributes and behaviors
ENTITY/DATA CLASS
objects encapsulate the data used
in a system
ABSTRACT CLASS
a generalized class of objects where
some of its behaviors are left undefined
UTILITY CLASS
maintain utility methods and usually
not instantiatable
CLASS
WHAT IS INSIDE
A CLASS?
ATTRIBUTES OF THE OBJECTS THAT BELONG TO
THE CLASS
METHODS REPRESENTING THE BEHAVIORS OF THE
OBJECTS THAT BELONG TO THE CLASS
list of messages that objects of the class respond to
SPECIALIZED METHODS
constructors
destructors
CLASS DIAGRAM
describes the attributes and operations of a class (also the constraints)
shows a collection of: classes, interfaces, associations, and collaborations