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

SER516 Lecture 10

SER516 Lecture 10

Software Agility
Technical Skills II
(202102)

Javier Gonzalez-Sanchez
PRO

February 14, 2019
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. jgs
    SER 516
    Software Agility
    Lecture 10: Technical Skills II
    Dr. Javier Gonzalez-Sanchez
    [email protected]
    javiergs.engineering.asu.edu | javiergs.com
    PERALTA 230U
    Office Hours: By appointment

    View Slide

  2. jgs
    516 00001010
    Announcement
    § Backlog (Product and Spring) including stories
    § Burndown Chart
    § Product (Source Code)
    § Retrospective
    § Review
    § Due Friday February 19, 11:59 PM AZ time (No extensions)

    View Slide

  3. jgs
    516 00001010
    Hints
    http://gameinternals.com/post/2072558330/understanding-pac-man-ghost-behavior

    View Slide

  4. jgs
    516 00001010
    Hints

    View Slide

  5. jgs
    516 00001010
    Hints
    Timer
    ActionListener JFrame MouseListener
    Game
    Cell
    Grid
    Drawable
    JPanel
    Thread

    View Slide

  6. jgs
    Note

    View Slide

  7. jgs
    516 00001010
    Note

    View Slide

  8. jgs
    Previously

    View Slide

  9. jgs
    516 00001010
    Clean Code Principles
    1. Readability
    e.g., Coding guidelines.
    2. Simplification and Specification
    e.g., KISS (Keep It Simple by K. Johnson).
    3. Decoupling
    e.g., LOD (Law of Demeter).
    4. Avoid Code Bloat
    e.g., DRY (Do not Repeat Yourself).

    View Slide

  10. jgs
    Do your projects have clean code?
    Simple

    View Slide

  11. jgs
    516 00001010
    Where are the variables?

    View Slide

  12. jgs
    516 00001010
    Simplification

    View Slide

  13. jgs
    516 00001010
    Simplification

    View Slide

  14. jgs
    516 00001010
    Simplification
    Where should
    the name be?

    View Slide

  15. jgs
    Do your projects have clean code?
    Avoid Code Bloat

    View Slide

  16. jgs
    516 00001010
    Bloat

    View Slide

  17. jgs
    516 00001010
    Bloat

    View Slide

  18. jgs
    516 00001010
    How many lines in a method?
    … … …
    500 LOC in a method… it is to much!

    View Slide

  19. jgs
    516 00001010
    Methods
    Create code Elegant and Efficient

    View Slide

  20. jgs
    516 00001010
    Case 15
    !

    View Slide

  21. jgs
    Recomendations

    View Slide

  22. jgs
    516 00001010
    Minimum Guidelines
    § Follow standard conventions
    https://google.github.io/styleguide/javaguide.html
    § Be consistent. If you do something a certain way, do all similar things in the
    same way.
    § Use explanatory variables.
    § Don't write methods which works correctly depending on something else in
    the same class.
    § Keep lines short.

    View Slide

  23. jgs
    516 00001010
    Minimum Guidelines
    § Always try to explain yourself in code, i.e., avoid comments if possible.
    § Don't be redundant.
    § Don't add obvious noise.
    § Don't comment out code. Just remove.
    § Use comments as (1)explanation of intent, (2) clarification of code, (3)
    warning of consequences.
    § JavaDoc

    View Slide

  24. jgs
    516 00001010
    Think About It
    § “The ratio of time spent reading vs writing is well over 10:1”
    § Will you be able to read your classmate code?
    § Will your classmate be able to read your code?

    View Slide

  25. jgs
    516 00001010
    References
    § Java Style Guide
    https://google.github.io
    /styleguide/javaguide.html
    http://www.oracle.com
    /technetwork/java/codeconvtoc-136057.html
    § Read Chapter 1. Clean code. Robert Martin.

    View Slide

  26. jgs
    SER 516 Software Agility
    Javier Gonzalez-Sanchez
    [email protected]
    Spring 2021
    Disclaimer. These slides can only be used as study material for the class SER516 at ASU. They cannot be distributed or used for another purpose.

    View Slide