Object Oriented Concepts

Verified

Added on  2023/02/01

|23
|1237
|77
AI Summary
This document provides an overview of object oriented programming (OOP) and its concepts. It explains the features of OOP, the difference between objects and classes, and how to identify classes, properties, and methods. The document also includes examples and scenarios to help understand the concepts. The content is relevant to the course SWE 4201.
tabler-icon-diamond-filled.svg

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
Object Oriented Concepts
SWE 4201
1
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Agenda
Programming
Procedural programming
Object oriented programming.
Features of OOP
OOP concepts (Object and Class)
Document Page
Programming
Programming is the craft of transforming requirements into
something that computer can execute.
Document Page
Procedural programming
Programmer implements requirement by breaking down them to
small steps (functional decomposition).
Programmer creates the “recipe” that computer can understand and
execute.
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Procedural programming …..
What’s wrong with procedural programming language?
When requirements change
It hard to implement new feature that were not planned in the beginning.
Code blocks gets bigger and bigger.
Changes in code introduce many bugs.
Code gets hard to maintain.
Document Page
Worst thing is that
Requirement
always change
Document Page
Object oriented programming
Break down requirements into objects with responsibilities, not into
functional steps.
Embraces change of requirements.
By minimizing changes in code.
Lets you think about object hierarchies and interactions instead of
program control flow.
A completely different programming paradigm.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Why OOPS?
To modularize software development, just like any other engineering
discipline.
To make software projects more manageable and predictable.
For better maintainability, since software maintenance costs were
more than the development costs.
For more re-use code and prevent ‘reinvention of wheel’** every
time.
**reinventing the wheel is a phrase that means to duplicate a basic method that has already previously
been created or optimized by others
Document Page
Features of OOP
Emphasis on data rather on procedure.
Programs are divided into what are known as “objects”.
Functions that operate on data of an object are tied together in a data
structure.
Object may communicate with each other through functions.
New data and functions can be added easily whenever necessary.
Document Page
Object
Anything that we see in real life is an object.
Ex: Car, Man, Pencil
Sometimes immaterial things can also be objects.
Ex: Project, Process, Ghost
In a class based object-oriented programming, object is an instance
of a class that is created dynamically.
When an object is instantiated, it is allocated with a block of
memory and configured as per the blueprint provided by the class
underlying the object.
10
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Class
Classes are about defining an object. It consists of attributes and
behaviors.
Simply, Class is a blueprint of an object or template for an object.
We can consider a Class as a new data type.
11
Document Page
Object and Class
Class is a template for an object and an object is an instance of a
class
Class is just a logical framework, object is the physical reality.
12
Document Page
Object and Class
13
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Example
Class Object
14
Document Page
Example
Class
University
Player
Author
Employee
Object
IUT, DU
Shakib Al Hasan, Mashrafe Mortaza
Humayun Ahmed, Muhammed Zafar
Iqbal
John, Mary
15
Document Page
Class and Object
class Dog {
String color;
String eyeColor;
double height;
double length;
double weight;
void sit(){
}
void layDown(){
}
void shake(){
}
void come(){
}
}
Dog bobby = new Dog();
bobby.color = "Yellow";
bobby.eyeColor = "Brown";
bobby.height = "17";
bobby.length = "35";
bobby.weight = "24";
bobby.come();
bobby.sit();
bobby.layDown();
16
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Find out Class, it's properties and metho
Given a problem/requirement scenario..
Find out Noun to consider as a Class/Attribute candidate.
[Not all noun of a scenario will be a class/attribute]
If a noun requires other things(aka nouns) to define it, consider this
as a Class
If a noun has only value consider this as properties of a Class.
Find out Verb to consider as a method
17
Document Page
Find out Class, it's properties and metho
A canvas displays different shapes like line, triangle, rectangle,
square, circle etc. Each shape has different color. User can get the
area, and perimeter of each shape.
Class
Point x, y, color draw()
Line array Point, color draw()
Triangle array Line / array Point draw(), calculateArea(),
calPeri()
Rectangle array Line/ array Point
Square
Circle Point, radius 18
Document Page
Find out Class, it's properties and metho
A canvas displays different shapes like line, triangle, rectangle,
square, circle etc. Each shape has different color. User can get the
area, and perimeter of each shape.
19
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Find out Class, it's properties and metho
CSE of IUT offers two programs. Each program has many semesters.
Each semester consists of many courses. A student can enroll to
/withdraw from a course. A course has a name, code, and credit.
CSE can add and/or remove program/semester/course. During
enrollment, a student provides her name, age, date of birth, etc.
20
Document Page
Find out Class, it's properties and metho
CSE of IUT offers two programs. Each program has many semesters.
Each semester consists of many courses. A student can enroll to
/withdraw from a course. A course has a name, code, and credit.
CSE can add and/or remove program/semester/course. During
enrollment, a student provides her name, age, date of birth, etc.
Student name, age, DoB
Course name, code, credit
Semester array Course, add(), delete()
Program 21
Document Page
Find out Class, it's properties and metho
An electronics store needs to maintain an inventory of electronic
equipment which might be found there. You should include audio as
well as video equipment. Keep information on all equipment such as
manufacturer, cost, date purchased, and serial number. For the
audio equipment, keep track of whether it is a cassette player, a CD
player, or a radio. Video equipment should be categorized as VHS,
8MM, or video disk.
22
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Find out Class, it's properties and metho
An electronics store needs to maintain an inventory of electronic
equipment which might be found there. You should include audio as
well as video equipment. Keep information on all equipment such as
manufacturer, cost, date purchased, and serial number. For the
audio equipment, keep track of whether it is a cassette player, a CD
player, or a radio. Video equipment should be categorized as VHS,
8MM, or video disk.
23
chevron_up_icon
1 out of 23
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]