







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
An introduction to Object-Oriented Programming (OOP), focusing on the principles, characteristics, and benefits of objects. Topics include constructors, destructors, inheritance, polymorphism, encapsulation, classes, and software engineering concepts. It also covers the evolution of programming techniques and the differences between unstructured, procedural, and modular programming.
Typology: High school final essays
Uploaded on 03/03/2022
8 documents
1 / 13
This page cannot be seen from the preview
Don't miss anything!








Basic knowledge of Programming required Read books and remember Read the books, remember the language Think Think in objects, think in classes Practice Do as many coding as possible and make them running Ask in classes
This programming technique can only be used in a very small program. For example, if the same statement sequence is needed at different locations within the program, the sequence must be copied. If an error needed to be modified, every copy needs to be modified. This has lead to the idea to extract these sequences(procedure), name them and offering a technique to call and return from these procedures.
With procedural programming, you are able to combine sequences of calling statements into one single place. A procedure call is used to invoke the procedure. After the sequence is processed, flow of control proceeds right after the position where the call was made. Main Program (^) Procedure
With parameters and sub-procedures (procedures of procedures) , programs can now be written more structured and error free. For example, if a procedure is correct, every time it is used it produces correct results. Consequently, in cases of errors you can narrow your search to those places which are not proven to be correct.
Now a program can be viewed as a sequence of procedure calls. The main program is responsible to pass data to the individual calls, the data is processed by the procedures and the resulting data is presented. Thus, the flow of data can be illustrated as a hierarchical graph, a tree.
Main Program(Also a module) Data Data Data 1 Module 2
Data Data 2 Module 1
Data Data 1 Procedure 1 Procedure 2 The main program coordinates calls to procedures in separate modules and hands over appropriate data as parameters. Procedure 3
Each module can have its own data. This allows each module to manage an internal state which is modified by calls to procedures of this module. Each module has its own special functionalities that supports the implementation of the whole program.
Also structured programming A subset of procedural programming that enforces a logical structure on the program being written to make it more efficient and easier to understand and modify. Certain languages such as Ada, Pascal, and dBASE are designed with features that encourage or enforce a logical program
Three Types of Structures in a structured program
In OOP data and operations on data (data manipulation) are brought together into a single entity called an object. Our programs then consist of one or more objects interacting with each other to bring about a desired result. The object is responsible for its data and its data can only manipulated by a predefined list of acceptable operations. Object orientation aims to emulate the way humans interact with the world around them. In other words there is presumption that the object oriented approach to problem solving is somewhat akin to the natural approach. Consider a typical day, get out of bed, have a cup of coffee, catch a bus to work, go to a restaurant for lunch, go to your flat, eat your dinner with a knife and fork, watch television etc. It is possible to look on life as a series of interactions with things. These things we call objects. We can view all of these objects as consisting of data (called properties) and operations that can be performed on them (called methods). This is thought to closely resemble the way humans perceive the world, thus it is thought that object oriented system models are easier to understand.
Tangible Things as a car, printer, ... Roles as employee, boss, ... Incidents as flight, overflow, ... Interactions as contract, sale, ... Specifications as colour, shape, … 20
An object represents an individual, identifiable item, unit, or entity, either real or abstract, with a well-defined role in the problem domain. Or An "object" is anything to which a concept applies. Etc. 21
Modularity - large software projects can be split up in smaller pieces. Re-useability - Programs can be assembled from pre- written software components. Extensibility - New software components can be written or developed from existing ones. 22
An object is an instance of a class Objects have the following qualities: Identity: Objects are distinguishable from one another Behavior: Objects can perform tasks State: Objects store information that can vary over time 123 245 12 245 Object Object Class
Objects -- packet containing data and procedures methods -- deliver service message -- request to execute a method Class -- template for creating objects Instance -- an object that belongs to a class Abstraction - emphasis on what rather than how Encapsulation -- information hiding by objects Inheritance -- allowing the reuse of class spec.s class Hierarchy -- tree structure inheritance relations Polymorphism -- to hide different implementations