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

PPT
Unit 1 - Introduction to Software Engineering.ppt
PPTX
Loader and Its types
PPTX
Reusibility vs Extensibility in OOAD
PPT
Object Oriented Design in Software Engineering SE12
PPTX
Dynamic and Static Modeling
PPT
Distributed computing
PPTX
Eucalyptus cloud computing
PPTX
ADDRESSING MODES
Unit 1 - Introduction to Software Engineering.ppt
Loader and Its types
Reusibility vs Extensibility in OOAD
Object Oriented Design in Software Engineering SE12
Dynamic and Static Modeling
Distributed computing
Eucalyptus cloud computing
ADDRESSING MODES

What's hot (20)

PPT
Operating system.ppt (1)
PPT
System software
PPTX
Cloud Resource Management
PDF
operating system structure
PPT
Organization and team structures
PPT
Software design, software engineering
PPTX
Software Engineering.pptx
PDF
CSI-503 - 11.Distributed Operating System
PPTX
Object oriented modeling and design
PPTX
Fault tolerance in distributed systems
PPTX
Architectural structures and views
PPTX
Chapter-4 Enhanced ER Model
PPTX
Off the-shelf components (cots)
PPTX
Introduction to Software Engineering
PPT
System engineering
PPT
Object oriented analysis
DOCX
Cloud computing notes unit II
PPTX
Data security in cloud computing
PPTX
Fundamental Concepts-and-Models Cloud Computing
Operating system.ppt (1)
System software
Cloud Resource Management
operating system structure
Organization and team structures
Software design, software engineering
Software Engineering.pptx
CSI-503 - 11.Distributed Operating System
Object oriented modeling and design
Fault tolerance in distributed systems
Architectural structures and views
Chapter-4 Enhanced ER Model
Off the-shelf components (cots)
Introduction to Software Engineering
System engineering
Object oriented analysis
Cloud computing notes unit II
Data security in cloud computing
Fundamental Concepts-and-Models Cloud Computing
Ad

Similar to Programing Style (20)

PDF
Object Oriented Programming in Swift Ch0 - Encapsulation
PDF
Software Reuse and Object-Oriented Programming
PPT
Coding
PDF
II BCA JAVA PROGRAMMING NOTES FOR FIVE UNITS.pdf
PPTX
Object Oriented Programming Part 2 of Unit 1
PDF
2.oop concept
PPT
1. oop with c++ get 410 day 1
PPT
Introduction.ppt JAVA SCRIPT PROGRAMMING AND
DOCX
Unit1 jaava
PPT
01-introductionto Object ooriented Programming in JAVA CS.ppt
PPTX
Networking chapter jkl; dfghyubLec 1.pptx
PPT
01-introduction OOPS concepts in C++ JAVA
PPTX
Clean code
PDF
Object oriented programming
PPTX
Software_Engineering_Presentation (1).pptx
PPTX
ProgrammingPrimerAndOOPS
PPTX
Object-oriented programming
PPTX
Ooad presentation
PDF
Designing Object Oriented Software - lecture slides 2013
PPTX
OOPS in Java
Object Oriented Programming in Swift Ch0 - Encapsulation
Software Reuse and Object-Oriented Programming
Coding
II BCA JAVA PROGRAMMING NOTES FOR FIVE UNITS.pdf
Object Oriented Programming Part 2 of Unit 1
2.oop concept
1. oop with c++ get 410 day 1
Introduction.ppt JAVA SCRIPT PROGRAMMING AND
Unit1 jaava
01-introductionto Object ooriented Programming in JAVA CS.ppt
Networking chapter jkl; dfghyubLec 1.pptx
01-introduction OOPS concepts in C++ JAVA
Clean code
Object oriented programming
Software_Engineering_Presentation (1).pptx
ProgrammingPrimerAndOOPS
Object-oriented programming
Ooad presentation
Designing Object Oriented Software - lecture slides 2013
OOPS in Java
Ad

Recently uploaded (20)

PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
master seminar digital applications in india
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Complications of Minimal Access Surgery at WLH
PDF
RMMM.pdf make it easy to upload and study
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Cell Structure & Organelles in detailed.
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Lesson notes of climatology university.
PDF
Computing-Curriculum for Schools in Ghana
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Presentation on HIE in infants and its manifestations
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
master seminar digital applications in india
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Complications of Minimal Access Surgery at WLH
RMMM.pdf make it easy to upload and study
Anesthesia in Laparoscopic Surgery in India
Cell Structure & Organelles in detailed.
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Microbial disease of the cardiovascular and lymphatic systems
Chinmaya Tiranga quiz Grand Finale.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Lesson notes of climatology university.
Computing-Curriculum for Schools in Ghana
A systematic review of self-coping strategies used by university students to ...
STATICS OF THE RIGID BODIES Hibbelers.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Presentation on HIE in infants and its manifestations

Programing Style

  • 1. 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
  • 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