SlideShare a Scribd company logo
1 of 21
Download to read offline
Objects & Data Structure
Md. MaksudAlamChowdhury
ObjectVs Data
ObjectVs Data
Data Structure
 Exposes data
 Usually No behavior
 Referred as POJO or POPO in java and python respectively
 Can have private fields with public accessors
 Can have navigational methods ( ORM, Active Records )
 Should not have business logic
Object
 Encapsulates
 Hides data structures behind Abstraction
 Expose functions on that data
ProsAnd Cons
ProceduralCode using
Data Structure
OO Code using
Polymorphism
Pros and Cons
ProceduralCode
 easy to add new functions
without changing the existing
data structures
 hard to add new data
structures because all the
functions must change.
OOCode
 easy to add new classes
without changing existing
functions.
 hard to add new functions
because all the classes must
change.
Hybrids
 Combining Data Structure & Object
 Worst of both worlds
 Dependencies on attributes
 Difficult to add function and class
 Difficult to refactor
How depth can we go ?
 Known as Law of Demeter
 A module should hide objects it manipulates
 A method ( f ) of class ( C ) can call:
→ method of ( C )
→ method of an object held as instance variable in ( C )
→ method of an object passed as argument in ( f )
→ method of an object created by ( f )
Example
References
 Clean Code: A Handbook of Agile Software Craftsmanship
by Robert C. Martin
 The Clean Coder: A Code of Conduct for Professional
Programmers by Robert C. Martin
Questions

More Related Content

What's hot

Introduction to oop
Introduction to oop Introduction to oop
Introduction to oop
Kumar
 

What's hot (20)

Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
 
1 Intro Object Oriented Programming
1  Intro Object Oriented Programming1  Intro Object Oriented Programming
1 Intro Object Oriented Programming
 
concept of oops
concept of oopsconcept of oops
concept of oops
 
Java Basic Oops Concept
Java Basic Oops ConceptJava Basic Oops Concept
Java Basic Oops Concept
 
Android MVVM
Android MVVMAndroid MVVM
Android MVVM
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
clean code book summary - uncle bob - English version
clean code book summary - uncle bob - English versionclean code book summary - uncle bob - English version
clean code book summary - uncle bob - English version
 
Introduction to oop
Introduction to oop Introduction to oop
Introduction to oop
 
[JWPA-1]의존성 주입(Dependency injection)
[JWPA-1]의존성 주입(Dependency injection)[JWPA-1]의존성 주입(Dependency injection)
[JWPA-1]의존성 주입(Dependency injection)
 
Object Oriented Programming Concepts for beginners
Object Oriented Programming Concepts for beginners Object Oriented Programming Concepts for beginners
Object Oriented Programming Concepts for beginners
 
4. Classes and Methods
4. Classes and Methods4. Classes and Methods
4. Classes and Methods
 
Introduction to OOP(in java) BY Govind Singh
Introduction to OOP(in java)  BY Govind SinghIntroduction to OOP(in java)  BY Govind Singh
Introduction to OOP(in java) BY Govind Singh
 
Introduction to Kotlin Language and its application to Android platform
Introduction to Kotlin Language and its application to Android platformIntroduction to Kotlin Language and its application to Android platform
Introduction to Kotlin Language and its application to Android platform
 
Object-Oriented Programming Concepts
Object-Oriented Programming ConceptsObject-Oriented Programming Concepts
Object-Oriented Programming Concepts
 
Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
 
Polymorphism in java
Polymorphism in java Polymorphism in java
Polymorphism in java
 
Applet and graphics programming
Applet and graphics programmingApplet and graphics programming
Applet and graphics programming
 
Clean coding-practices
Clean coding-practicesClean coding-practices
Clean coding-practices
 
Generics C#
Generics C#Generics C#
Generics C#
 
Class or Object
Class or ObjectClass or Object
Class or Object
 

Similar to Object Vs Data Structure - Clean code chapter6

C++Day-1 Introduction.ppt
C++Day-1 Introduction.pptC++Day-1 Introduction.ppt
C++Day-1 Introduction.ppt
citizen15
 
oops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdfoops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdf
ArpitaJana28
 

Similar to Object Vs Data Structure - Clean code chapter6 (20)

C++ programming introduction
C++ programming introductionC++ programming introduction
C++ programming introduction
 
M.c.a. (sem iv)- java programming
M.c.a. (sem   iv)- java programmingM.c.a. (sem   iv)- java programming
M.c.a. (sem iv)- java programming
 
Object oriented programming C++
Object oriented programming C++Object oriented programming C++
Object oriented programming C++
 
PHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxPHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptx
 
OBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptx
OBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptxOBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptx
OBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptx
 
C++Day-1 Introduction.ppt
C++Day-1 Introduction.pptC++Day-1 Introduction.ppt
C++Day-1 Introduction.ppt
 
Oops concepts in php
Oops concepts in phpOops concepts in php
Oops concepts in php
 
Oops
OopsOops
Oops
 
Interview preparation for programming.pptx
Interview preparation for programming.pptxInterview preparation for programming.pptx
Interview preparation for programming.pptx
 
JAVA - Oops Concept.pptx
JAVA - Oops Concept.pptxJAVA - Oops Concept.pptx
JAVA - Oops Concept.pptx
 
Lecture01
Lecture01Lecture01
Lecture01
 
MCA NOTES.pdf
MCA NOTES.pdfMCA NOTES.pdf
MCA NOTES.pdf
 
OODBMS Concepts - National University of Singapore.pdf
OODBMS Concepts - National University of Singapore.pdfOODBMS Concepts - National University of Singapore.pdf
OODBMS Concepts - National University of Singapore.pdf
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
 
Advance oops concepts
Advance oops conceptsAdvance oops concepts
Advance oops concepts
 
Entity Framework 4
Entity Framework 4Entity Framework 4
Entity Framework 4
 
Oop features java presentationshow
Oop features java presentationshowOop features java presentationshow
Oop features java presentationshow
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
 
Introduction to odbms
Introduction to odbmsIntroduction to odbms
Introduction to odbms
 
oops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdfoops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdf
 

Recently uploaded

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Recently uploaded (20)

%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 

Object Vs Data Structure - Clean code chapter6

  • 1. Objects & Data Structure Md. MaksudAlamChowdhury
  • 2.
  • 5. Data Structure  Exposes data  Usually No behavior  Referred as POJO or POPO in java and python respectively  Can have private fields with public accessors  Can have navigational methods ( ORM, Active Records )  Should not have business logic
  • 6. Object  Encapsulates  Hides data structures behind Abstraction  Expose functions on that data
  • 7.
  • 10.
  • 12.
  • 13. Pros and Cons ProceduralCode  easy to add new functions without changing the existing data structures  hard to add new data structures because all the functions must change. OOCode  easy to add new classes without changing existing functions.  hard to add new functions because all the classes must change.
  • 14.
  • 15.
  • 16. Hybrids  Combining Data Structure & Object  Worst of both worlds  Dependencies on attributes  Difficult to add function and class  Difficult to refactor
  • 17.
  • 18. How depth can we go ?  Known as Law of Demeter  A module should hide objects it manipulates  A method ( f ) of class ( C ) can call: → method of ( C ) → method of an object held as instance variable in ( C ) → method of an object passed as argument in ( f ) → method of an object created by ( f )
  • 20. References  Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin  The Clean Coder: A Code of Conduct for Professional Programmers by Robert C. Martin