Download 1Introduction

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

C Sharp syntax wikipedia , lookup

Functional programming wikipedia , lookup

Falcon (programming language) wikipedia , lookup

Structured programming wikipedia , lookup

Stream processing wikipedia , lookup

C Sharp (programming language) wikipedia , lookup

Abstraction (computer science) wikipedia , lookup

Design Patterns wikipedia , lookup

Reactive programming wikipedia , lookup

Application Interface Specification wikipedia , lookup

Operational transformation wikipedia , lookup

Corecursion wikipedia , lookup

Object-relational impedance mismatch wikipedia , lookup

C++ wikipedia , lookup

Object-oriented programming wikipedia , lookup

Transcript
Object Oriented Programming
Spring Semester 2012-13
Dr. Malik Jahan Khan
Department of Computer Science
Namal College
1
Goals
• To introduce advance programming concepts
and techniques used in problem solving
including object oriented analysis, design and
implementation
• To enable object oriented modeling of any
unseen real life problem, and implementing
the solution
2
Pre-Requisites
• Introduction to Programming
• Good problem solving abilities
3
General Policies
• Additional to disciplinary policies of the institute /
university, plagiarism will be strictly dealt with.
Cheating any assignment, quiz or exam from any one
else may lead to severe penalty of grade. Violation of
rules / disturbance in class / involvement in plagiarism
may easily lead you to an “F” in the course. Both
parties involved in the plagiarism will be equally
punishable.
• Getting zero in a quiz, an exam problem or an
assignment is much better than cheating it from any
source. So avoid throwing yourselves in a very tensed
and harmful situation.
4
General Policies (Cont.)
• Quizzes will be unannounced
• Project Deadlines Policy
• Detailed policies or changes in policies (if
needed) will be communicated with passage
of time.
• Sleeping in class is optional (not compulsory)!
• Latecomers?
• General Attitude Concern
– Zero tolerance policy on disciplinary issues
5
Recommended Textbook
• Robert Lafore. “Object Oriented Programming
in C++”, 4th Edition, SAMS Publishing.
6
7
Grading Policy
•
•
•
•
Quizzes
Programming Projects
Midterm Exam
Final Exam
20%
20%
25%
35%
8
Structured Programming
• We write series of steps to solve a problem
– Take input
– Perform certain manipulations
– Throw output
• If complexity grows, divide the program into
functions
9
Shortcomings!
•
•
•
•
•
•
•
This project is too complex!
The schedule slips
More programmers added in team
Complexity increases
Costs skyrocket
Schedule further slips
And disaster ensues
….
....
….
10
Why All This Happens
• Functions have unrestricted access to all
global data
• Unrelated functions and data
• Poor model of the real world
– In real world, we have to deal with entities like
person, item, car, book, course, university etc
– None of these entities is like data
– None of these entities is like functions
11
Solution
Object Oriented Programming!
But Why and How???
12
Real World Modeling
• We deal with objects in real world like:
–
–
–
–
People
Vehicles
Computers
Inventory Items
• By now, we know about data attributes (variables and
arrays etc)
• We also know about functions
• But the real word objects are neither like attributes nor
functions
• In fact, real word objects have both attributes and
some behavior (functions)
13
Attributes
• Attributes are the characteristics of an object
• Examples
– People have eye color, name, job title, age, gender etc
– Cars have horsepower, number of doors, model, color
etc
• Attributes are like data members (variables etc.)
in a program, e.g.
– EyeColor (attribute) has value “blue”
– Age (attribute) has value “25”
– Model (attribute) has value “2003”
14
Behavior
• Behavior is something a real world object does in
response to some stimulus
• Examples
– If you ask your boss for a raise, she will generally say
“YES” or “NO”
– If you apply brakes in a car, it will stop
• Here, saying something and stopping are
examples of behavior of two objects “boss” and
“car” respectively
• Behavior is like function, you call a function to do
something (e.g. stop the car, find factorial etc)
15
So…..
• Attributes are represented by data like
variable, arrays, pointers etc
• Behavior is represented by functions
• But neither data nor functions, by themselves,
represent or model real world objects
16
Object-Oriented Approach
• Fundamental idea behind OO approach is to
combine into a single unit both data and
functions that operate on that data
• Such a unit is called “object”
• Group of similar objects is called “class”
17
How does a computer work?
• Hardware
– Central Processing Unit
•
•
•
•
Hard disk
Processor
RAM
ROM
– Keyboard / Mouse
– Monitor
• Software
– System Software
• Operating Systems (MS Windows, Linux, Android etc)
• Device Drivers
– Application Software
• MS Office, Games, Internet Explorer, Your Programs…