CSE460 Lecture 12

CSE460 Lecture 12

Software Analysis and Design
Object-Oriented Principles
(202009)

B546a9b97d993392e4b22b74b99b91fe?s=128

Javier Gonzalez

July 12, 2020
Tweet

Transcript

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

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

    Key Concepts Encapsulation Abstraction Hierarchical Relationships Polymorphism Concurrency Persistency
  3. Javier Gonzalez-Sanchez | CSE460 | Fall 2020 | 3 jgs

    Abstraction § Reducing by focusing on the essential observable behavior § What will be outside? OOAD, Booch Textbook
  4. Javier Gonzalez-Sanchez | CSE460 | Fall 2020 | 4 jgs

    Encapsulation § Hiding the details of the implementation § What is inside? OOAD, Booch Textbook
  5. Javier Gonzalez-Sanchez | CSE460 | Fall 2020 | 5 jgs

    Hierarchical Relationships § Creating a hierarchy of abstractions § Who (is a…, uses a…, has a…) ? OOAD, Booch Textbook
  6. Javier Gonzalez-Sanchez | CSE460 | Fall 2020 | 6 jgs

    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?
  7. Javier Gonzalez-Sanchez | CSE460 | Fall 2020 | 7 jgs

    Concurrency § Having two o more events happening (objects acting) at the same time. § When to use it? OOAD, Booch Textbook
  8. Javier Gonzalez-Sanchez | CSE460 | Fall 2020 | 8 jgs

    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
  9. jgs Object-Oriented Coding Principles

  10. Javier Gonzalez-Sanchez | CSE460 | Fall 2020 | 10 jgs

    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
  11. Javier Gonzalez-Sanchez | CSE460 | Fall 2020 | 11 jgs

    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
  12. Javier Gonzalez-Sanchez | CSE460 | Fall 2020 | 12 jgs

    Readability? § JFrame frmClient § JToggleButton btnNewButton § JLabel lblToggle § class MainWindow Create code Simple and Direct –Grady Booch Readability
  13. Javier Gonzalez-Sanchez | CSE460 | Fall 2020 | 13 jgs

    Naming
  14. Javier Gonzalez-Sanchez | CSE460 | Fall 2020 | 14 jgs

    KISS? Create code Simple and Direct –Grady Booch This is a great idea; * make it easy to read. What name could be better? AbcAbcAbcException.java
  15. Javier Gonzalez-Sanchez | CSE460 | Fall 2020 | 15 jgs

    DRY? Create code Elegant and Efficient
  16. Javier Gonzalez-Sanchez | CSE460 | Fall 2020 | 16 jgs

    Where are the variables?
  17. jgs To be continued …

  18. Javier Gonzalez-Sanchez | CSE460 | Fall 2020 | 18 jgs

    Reference Chapter 2, 3
  19. 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.