Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
This lecture was delivered by Dr. Jameel Ahmad at Quaid-i-Azam University for Object Oriented Programming course. It includes: Object, Paradigm Oriented, Programming, Testing, Debugging, Algorithms, Formal, Logic Data, Fields
Typology: Slides
1 / 22
Course Instructor: Mr. Shahzad Rafiq Office: Room 113, 1 st Floor, Block A, Email: [email protected] Teacher Assistant: Ms. Tehreem Zainab
Computer programming (often shortened to programming or coding ) is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs. This source code is written in one or more programming languages. The purpose of programming is to create a set of instructions that computers use to perform specific operations or to exhibit desired behaviors. The process of writing source code often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic. - http://en.wikipedia.org/wiki/
http://en.wikipedia.org/wiki/
http://en.wikipedia.org/wiki/
Four major elements:
Abstraction - Encapsulation - Modularity - Hierarchy
Three minor elements:
Typing - Concurrency - Persistence
A simplified description of a system that emphasizes some of the systems details while suppressing others - Good abstraction will emphasize details that are significant to the user
A concept qualifies as abstract only if it can be described, understood, and analyzed independently of the mechanism that will eventually be used to realize it
An abstraction denotes the essential characteristics of an object that distinguishes it from all other kinds of objects and thus provide crisply defined conceptual boundaries, relative to the perspective of the viewer
Entity
Represents a useful model of a problem ‐ domain entity - Action - Provides a generalized set of operations all of which perform the same kind of function
Virtual ‐ machine
Groups together operations that are all used by some superior level of control or operations that all use the same junior level set of operations
Packages a set of unrelated operations
Controlling the cabin of a plane
Key abstraction is a sensor - Anything we will measure must be associated with - a sensor (pressure, temp, moisture, smoke) - Actions the sensor would need to perform: - Calibrate - Test - Report - Set
Once the level and type of abstraction is selected the implementation that defines the abstraction should remain a secret
No part of a complex system should depend on the internal details of any other part - Encapsulation permits programs to change with out impacting other objects and models - Abstractions gives the outside view to the user while encapsulation insulates the user from the details
Also known as information hiding
For abstraction to work, encapsulation must be present
distinct parts defined now:
Interface
The act of partitioning a program into individual components can reduce the complexity to some degree
Even more powerful is the modular partitioning of a system creating well
defined and documented boundaries.
Each boundary has an interface - This leads to greatly increased comprehension of a program
» In C++ the interface is often declared in a header file and the implementation is hidden
Modularity, Encapsulation, and Abstraction
Abstraction is good, but a system with many distinct abstractions becomes difficult to understand
In most systems, a set of abstractions will form a hierarchy - By identifying hierarchies in the design, we greatly reduce the complexity - We can say that a hierarchy is an ordering of abstractions
Single inheritance
Multiple inheritance Employee Salary Hourly Executive Flowering plant Fruit Vegetable
Deriver from theories of abstract data types - The enforcement of the class of an object, such that objects of different types may not be interchanged, or at the most, they may be interchanged only in very restricted ways
Typing allows us to express abstractions so that the programming language on which we implement them can be made to enforce design decisions