Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSE460 Lecture 10

CSE460 Lecture 10

Software Analysis and Design
Object-Oriented Principles
(202102)

B546a9b97d993392e4b22b74b99b91fe?s=128

Javier Gonzalez
PRO

July 10, 2020
Tweet

Transcript

  1. jgs CSE 460 Software Analysis and Design Lecture 10: Object-Oriented

    Principles Dr. Javier Gonzalez-Sanchez javiergs@asu.edu javiergs.engineering.asu.edu | javiergs.com PERALTA 230U Office Hours: By appointment
  2. jgs Object-Oriented Principles Design

  3. jgs 460 00001010 Key Concepts Encapsulation Abstraction Hierarchical Relationships Polymorphism

    Concurrency Persistency
  4. jgs 460 00001010 Abstraction § Reducing by focusing on the

    essential observable behavior § What will be outside? OOAD, Booch Textbook
  5. jgs 460 00001010 Encapsulation § Hiding the details of the

    implementation § What is inside? OOAD, Booch Textbook
  6. jgs 460 00001010 Hierarchical Relationships § Creating a hierarchy of

    abstractions § Who (is a…, uses a…, has a…) ? OOAD, Booch Textbook
  7. jgs 460 00001010 Polymorphism § The condition of denoting different

    forms. § A single name may denote objects of many different classes that are related by some common superclass. § When to use it?
  8. jgs 460 00001010 Concurrency § Having two o more events

    happening (objects acting) at the same time. § When to use it? OOAD, Booch Textbook
  9. jgs 460 00001010 Persistency § Property by which an object

    continues to exist even after its creator ceases to exist § Object serialization: convert it to a byte stream so way that the byte stream can be reverted into a copy of the object. § Save data OOAD, Booch Textbook
  10. jgs Object-Oriented Principles Programming

  11. jgs 460 00001010 Global Ideas § Create code Elegant and

    Efficient –Bjarne Stroustrup § Create code Simple and Direct –Grady Booch § Create code looks like written by someone who cares – Michael Feathers
  12. jgs 460 00001010 Clean Code Principles § Readability Use Meaningful

    Names for Classes, Methods, and Variables Follow coding guidelines: e.g., read the Java Style Reference § KISS (Keep It Simple by K. Johnson) for your reader Small functions that do one thing § DRY (Do not Repeat Yourself): Avoid Code Bloat § Decoupling
  13. jgs 460 00001010 Readability? § JFrame frmClient § JToggleButton btnNewButton

    § JLabel lblToggle § class MainWindow Create code Simple and Direct –Grady Booch Readability
  14. jgs 460 00001010 Naming

  15. jgs 460 00001010 DRY? Create code Elegant and Efficient

  16. jgs 460 00001010 Where are the variables?

  17. jgs 460 00001010 Readability Naming Review Language Guidelines

  18. jgs 460 00001010 Readability Is the comment needed? Public vs

    Private?
  19. jgs 460 00001010 Readability

  20. jgs 460 00001010 Readability … … … 500 LOC in

    a method… it is to much!
  21. jgs 460 00001010 How many LOC per method? § around

    20 is perfect, § up to 50 is still fine, § up to 100 is critical, § above 150 is bad, and § more than 250 is !
  22. jgs 460 00001010 Reference Chapter 2, 3

  23. jgs CSE 460 Software Analysis and Design Javier Gonzalez-Sanchez javiergs@asu.edu

    Fall 2020 Disclaimer. These slides can only be used as study material for the class CSE460 at ASU. They cannot be distributed or used for another purpose.