Object Oriented Concepts
VerifiedAdded 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.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
![Document Page](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/8f4ba3b6-3cd2-43a3-9a9d-6f0e5f3f4a94-page-1.webp)
Object Oriented Concepts
SWE 4201
1
SWE 4201
1
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
![Document Page](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/fb3cf08d-7d29-4cb4-9031-ae4771938de1-page-2.webp)
Agenda
• Programming
• Procedural programming
• Object oriented programming.
• Features of OOP
• OOP concepts (Object and Class)
• Programming
• Procedural programming
• Object oriented programming.
• Features of OOP
• OOP concepts (Object and Class)
![Document Page](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/9dae587d-40e0-43f2-ab33-ce07b6448488-page-3.webp)
Programming
• Programming is the craft of transforming requirements into
something that computer can execute.
• Programming is the craft of transforming requirements into
something that computer can execute.
![Document Page](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/8cdd32d8-2e76-4fe0-bc17-1360f671fec3-page-4.webp)
Procedural programming
• Programmer implements requirement by breaking down them to
small steps (functional decomposition).
• Programmer creates the “recipe” that computer can understand and
execute.
• Programmer implements requirement by breaking down them to
small steps (functional decomposition).
• Programmer creates the “recipe” that computer can understand and
execute.
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
![Document Page](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/c2a878c2-58fd-42c3-baa5-8e76a74eaa53-page-5.webp)
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.
• 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](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/1e7a96a0-a9ed-4fcd-8920-07d962b5da6f-page-6.webp)
Worst thing is that
Requirement
always change
Requirement
always change
![Document Page](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/2bbe99d1-3378-4e1d-bdcf-e9ed74f17fa0-page-7.webp)
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.
• 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.
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
![Document Page](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/38359f91-6570-446c-a7d7-d77453e2e5cc-page-8.webp)
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
• 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](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/444402b9-9ce2-4bfa-aaee-fad1fa080112-page-9.webp)
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.
• 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](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/043a594f-3f99-4915-bc0f-6fa2570c2921-page-10.webp)
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
• 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
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
![Document Page](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/7bdc702b-149d-4550-a90b-590ad6382248-page-11.webp)
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
• 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](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/400ff425-a923-4dff-806b-079ae514eff0-page-12.webp)
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
• 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](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/6bec8854-a3eb-426f-8298-bce1be58e36c-page-13.webp)
Object and Class
13
13
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
![Document Page](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/dc689f59-4a26-4237-b271-6773dc7c168d-page-14.webp)
Example
Class Object
14
Class Object
14
![Document Page](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/22012d33-9b0c-42bc-80f1-815e43397f94-page-15.webp)
Example
Class
• University
• Player
• Author
• Employee
Object
• IUT, DU
• Shakib Al Hasan, Mashrafe Mortaza
• Humayun Ahmed, Muhammed Zafar
Iqbal
• John, Mary
15
Class
• University
• Player
• Author
• Employee
Object
• IUT, DU
• Shakib Al Hasan, Mashrafe Mortaza
• Humayun Ahmed, Muhammed Zafar
Iqbal
• John, Mary
15
![Document Page](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/ad806a44-cdf1-4c28-a295-69fbec5a8905-page-16.webp)
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
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
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
![Document Page](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/deafb2f1-f16d-4567-8f91-d125b14cd949-page-17.webp)
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
• 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](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/facc0bae-86fe-48ea-9999-3c262b03e7c7-page-18.webp)
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
• 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](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/c3305ef9-2e50-4d9e-aeb3-842adcc064f9-page-19.webp)
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
• 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
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
![Document Page](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/f1d3f111-d4d0-42cb-bb61-ef03afe993e1-page-20.webp)
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
• 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](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/3c979ebc-7a51-4d0a-b15d-38e7b03418f1-page-21.webp)
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
• 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](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/2ea6842a-dc87-4500-8675-ddd79845b8b1-page-22.webp)
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
• 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
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
![Document Page](https://desklib.com/media/document/docfile/pages/object-oriented-concepts-swe-4201-9fd2/2024/09/10/e189b0bc-1016-43ed-8478-9456faff94ce-page-23.webp)
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
• 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
1 out of 23
Related Documents
![[object Object]](/_next/image/?url=%2F_next%2Fstatic%2Fmedia%2Flogo.6d15ce61.png&w=640&q=75)
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
© 2024 | Zucol Services PVT LTD | All rights reserved.