SlideShare a Scribd company logo
2
Most read
5
Most read
Programming Style
Chapter 14
Part 3: Implementation
Object-Oriented Modeling and Design
Byung-Hyun Ha
bhha@pusan.ac.kr
Sumber dari: ike.ie.pusan.ac.kr/w/images/c/cc/08sal_ch014.ppt
Lecture Outline
 Introduction
 Object-Oriented Style
 Reusability
 Extensibility
 Robustness
 Programming-in-the-large
Introduction
 The experienced programmer follows principles to
make readable programs that live beyond the
immediate need
 Good style is important in all programming, but it is
even more important in OO design and programming
because much of the benefit of the OO approach is
predicated on producing reusable, extensible,
understandable programs
Object-Oriented Style
 Reusability
 Extensibility
 Robustness
 Programming-in-the-large
Reusability
 Kind of reusability
 Sharing of newly-written code within a project
 Reuse of previously-written code on new projects
 Style rules for reusability
 Keep methods coherent
 Keep methods small
 Keep methods consistent
 Separate policy and implementation
 Provide uniform coverage
 Broaden the method as much as possible
 Avoid global information
 Avoid modes
Reusability
 Using inheritance
 Subroutines
 Factoring
 Delegation
 Encapsulate external code
Extensibility
 OO principles for extensibility
 Encapsulate classes
 Hide data structures
 Avoid traversing multiple links or methods
 Avoid cast statements on object type
 Distinguish public and private operations
Robustness
 Guidelines for robustness
 Protect against errors
• User errors and low-level system errors
• Programming bugs
 Optimize after the program runs
 Validate arguments
 Avoid predefined limits
 Instrument the program for debugging and performance
monitoring
Programming-in-the-large
 Guidelines
 Do not prematurely begin programming
 Keep method understandable
 Make methods readable
 Use exactly the same names as in the object model
 Choose name carefully
 Use programming guidelines
 Package into modules
 Document classes and methods
 Publish the specification
Appendix: OO and Programming
 We already discussed…
 Farm
 toString() and priority queue
 Window programming
 They cannot be possible without inheritance and
polymorphism
 If you want to prepare those functionalities in the examples, you
should consider the use of OO concepts
 Otherwise, your program will never be understandable (even for
yourself), extensible, and reusable
Appendix: OO and Programming
 Inventory example
 Inventory simulation
 Assumptions
• Two types of suppliers
• Three types of demands
• Two types of policies
• Two ways of displaying results
 If you want to carry out simulation for every possible combination
of settings, you have to write 24 (= 2x3x2x2) programs
• Too complex to write and manage
 Let’s make them using one program (Inv_manage1.java)
• How about it?
• Could you understand?
• Do you think you can easily extend the program?
Appendix: OO and Programming
 Inventory example (cont’)
 Let’s use OO concepts (Inv_manage2.java, …)
 First of all, easy to understand
 Coherent, small, clear, consistent, extendible, reusable, …
Inv_manage
Supplier Demand Policy Display
put_order
today_deliever
today_demand today_order show
Appendix: OO and Programming
 Tree example
 Tree traversal with different purposes
 Structural way (Tree1.java)
• We should implement traversal algorithm every time we need
 OO way (Tree2.java)
• Don’t care about how to traverse, only need to write what to do
4 5 6
2 3
1 2
5 7
1 32

More Related Content

What's hot (20)

PPTX
Message passing ( in computer science)
Computer_ at_home
 
PPTX
Software design patterns ppt
mkruthika
 
PPT
Unit 4 designing classes
gopal10scs185
 
PDF
Design and Implementation in Software Engineering
Kourosh Sajjadi
 
PPTX
Basic Structural Modeling
AMITJain879
 
PDF
Aneka platform
Shyam Krishna Khadka
 
PPTX
Introduction to Distributed System
Sunita Sahu
 
PPTX
the Concept of Object-Oriented Programming
Aida Ramlan II
 
PPTX
Advanced Structural Modeling
AMITJain879
 
PPTX
Design Pattern in Software Engineering
Manish Kumar
 
PPT
Software Design Patterns
Satheesh Sukumaran
 
PPT
Introduction to design patterns
Amit Kabra
 
PPTX
Fault tolerance
Aman Balutia
 
PPTX
unit 4.pptx of hash function in cryptography
NithyasriA2
 
PPT
Ooad
gantib
 
PPTX
Design pattern-presentation
Rana Muhammad Asif
 
PPT
Unit 1( modelling concepts & class modeling)
Manoj Reddy
 
PPT
Consistency protocols
ZongYing Lyu
 
PDF
Object-oriented Programming-with C#
Doncho Minkov
 
PPT
Uml - An Overview
Raj Thilak S
 
Message passing ( in computer science)
Computer_ at_home
 
Software design patterns ppt
mkruthika
 
Unit 4 designing classes
gopal10scs185
 
Design and Implementation in Software Engineering
Kourosh Sajjadi
 
Basic Structural Modeling
AMITJain879
 
Aneka platform
Shyam Krishna Khadka
 
Introduction to Distributed System
Sunita Sahu
 
the Concept of Object-Oriented Programming
Aida Ramlan II
 
Advanced Structural Modeling
AMITJain879
 
Design Pattern in Software Engineering
Manish Kumar
 
Software Design Patterns
Satheesh Sukumaran
 
Introduction to design patterns
Amit Kabra
 
Fault tolerance
Aman Balutia
 
unit 4.pptx of hash function in cryptography
NithyasriA2
 
Ooad
gantib
 
Design pattern-presentation
Rana Muhammad Asif
 
Unit 1( modelling concepts & class modeling)
Manoj Reddy
 
Consistency protocols
ZongYing Lyu
 
Object-oriented Programming-with C#
Doncho Minkov
 
Uml - An Overview
Raj Thilak S
 

Similar to Programing Style (20)

DOCX
Mit3033 software architecture
smumbahelp
 
PDF
Code Craftsmanship Checklist
Ryan Polk
 
PPTX
Structured programming & Programming methodologies.pptx
Ritu Sachdeva
 
PDF
Introduction to Object Oriented Programming.pdf
ManishBej3
 
PPTX
Design Patterns - General Introduction
Asma CHERIF
 
PDF
Software Engineering with Objects (M363) Final Revision By Kuwait10
Kuwait10
 
PPTX
Object Oriented Programming Part 2 of Unit 1
VigneshkumarPonnusam1
 
PDF
Cse 6007 fall2012
rhrashel
 
PPTX
Object Oriented Approach for Software Development
Rishabh Soni
 
PPT
Software development effort reduction with Co-op
lbergmans
 
PPTX
Pair Programming with a Large Language Model
Knoldus Inc.
 
PPTX
test.pptx
Stacia7
 
PPT
Advanced Software Engineering.ppt
Rvishnupriya2
 
PDF
Optimizing Development_ Leveraging OOP Principles and Paired Programming for ...
Stackify
 
PDF
The I in PRIMM - Code Comprehension and Questioning
Sue Sentance
 
PDF
The LAST Coding Coding Course you Will Ever Need
AFFFILIATE
 
PDF
Feeling Overwhelmed & Uninspired? Become Teacher 2.0. Master Agile Teaching f...
AFFFILIATE
 
PDF
520_DevOps Engineer Master Program Curriculum.pdf
AniruddhNain1
 
PDF
International Journal of Computational Engineering Research(IJCER)
ijceronline
 
PDF
System Development Overview Assignment 3
Ashley Fisher
 
Mit3033 software architecture
smumbahelp
 
Code Craftsmanship Checklist
Ryan Polk
 
Structured programming & Programming methodologies.pptx
Ritu Sachdeva
 
Introduction to Object Oriented Programming.pdf
ManishBej3
 
Design Patterns - General Introduction
Asma CHERIF
 
Software Engineering with Objects (M363) Final Revision By Kuwait10
Kuwait10
 
Object Oriented Programming Part 2 of Unit 1
VigneshkumarPonnusam1
 
Cse 6007 fall2012
rhrashel
 
Object Oriented Approach for Software Development
Rishabh Soni
 
Software development effort reduction with Co-op
lbergmans
 
Pair Programming with a Large Language Model
Knoldus Inc.
 
test.pptx
Stacia7
 
Advanced Software Engineering.ppt
Rvishnupriya2
 
Optimizing Development_ Leveraging OOP Principles and Paired Programming for ...
Stackify
 
The I in PRIMM - Code Comprehension and Questioning
Sue Sentance
 
The LAST Coding Coding Course you Will Ever Need
AFFFILIATE
 
Feeling Overwhelmed & Uninspired? Become Teacher 2.0. Master Agile Teaching f...
AFFFILIATE
 
520_DevOps Engineer Master Program Curriculum.pdf
AniruddhNain1
 
International Journal of Computational Engineering Research(IJCER)
ijceronline
 
System Development Overview Assignment 3
Ashley Fisher
 
Ad

Recently uploaded (20)

PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PDF
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
community health nursing question paper 2.pdf
Prince kumar
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
Ad

Programing Style

  • 1. Programming Style Chapter 14 Part 3: Implementation Object-Oriented Modeling and Design Byung-Hyun Ha [email protected] Sumber dari: ike.ie.pusan.ac.kr/w/images/c/cc/08sal_ch014.ppt
  • 2. Lecture Outline  Introduction  Object-Oriented Style  Reusability  Extensibility  Robustness  Programming-in-the-large
  • 3. Introduction  The experienced programmer follows principles to make readable programs that live beyond the immediate need  Good style is important in all programming, but it is even more important in OO design and programming because much of the benefit of the OO approach is predicated on producing reusable, extensible, understandable programs
  • 4. Object-Oriented Style  Reusability  Extensibility  Robustness  Programming-in-the-large
  • 5. Reusability  Kind of reusability  Sharing of newly-written code within a project  Reuse of previously-written code on new projects  Style rules for reusability  Keep methods coherent  Keep methods small  Keep methods consistent  Separate policy and implementation  Provide uniform coverage  Broaden the method as much as possible  Avoid global information  Avoid modes
  • 6. Reusability  Using inheritance  Subroutines  Factoring  Delegation  Encapsulate external code
  • 7. Extensibility  OO principles for extensibility  Encapsulate classes  Hide data structures  Avoid traversing multiple links or methods  Avoid cast statements on object type  Distinguish public and private operations
  • 8. Robustness  Guidelines for robustness  Protect against errors • User errors and low-level system errors • Programming bugs  Optimize after the program runs  Validate arguments  Avoid predefined limits  Instrument the program for debugging and performance monitoring
  • 9. Programming-in-the-large  Guidelines  Do not prematurely begin programming  Keep method understandable  Make methods readable  Use exactly the same names as in the object model  Choose name carefully  Use programming guidelines  Package into modules  Document classes and methods  Publish the specification
  • 10. Appendix: OO and Programming  We already discussed…  Farm  toString() and priority queue  Window programming  They cannot be possible without inheritance and polymorphism  If you want to prepare those functionalities in the examples, you should consider the use of OO concepts  Otherwise, your program will never be understandable (even for yourself), extensible, and reusable
  • 11. Appendix: OO and Programming  Inventory example  Inventory simulation  Assumptions • Two types of suppliers • Three types of demands • Two types of policies • Two ways of displaying results  If you want to carry out simulation for every possible combination of settings, you have to write 24 (= 2x3x2x2) programs • Too complex to write and manage  Let’s make them using one program (Inv_manage1.java) • How about it? • Could you understand? • Do you think you can easily extend the program?
  • 12. Appendix: OO and Programming  Inventory example (cont’)  Let’s use OO concepts (Inv_manage2.java, …)  First of all, easy to understand  Coherent, small, clear, consistent, extendible, reusable, … Inv_manage Supplier Demand Policy Display put_order today_deliever today_demand today_order show
  • 13. Appendix: OO and Programming  Tree example  Tree traversal with different purposes  Structural way (Tree1.java) • We should implement traversal algorithm every time we need  OO way (Tree2.java) • Don’t care about how to traverse, only need to write what to do 4 5 6 2 3 1 2 5 7 1 32