Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

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)

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

jgs 516 00001010 Hints

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

jgs Note

Slide 7

Slide 7 text

jgs 516 00001010 Note

Slide 8

Slide 8 text

jgs Previously

Slide 9

Slide 9 text

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).

Slide 10

Slide 10 text

jgs Do your projects have clean code? Simple

Slide 11

Slide 11 text

jgs 516 00001010 Where are the variables?

Slide 12

Slide 12 text

jgs 516 00001010 Simplification

Slide 13

Slide 13 text

jgs 516 00001010 Simplification

Slide 14

Slide 14 text

jgs 516 00001010 Simplification Where should the name be?

Slide 15

Slide 15 text

jgs Do your projects have clean code? Avoid Code Bloat

Slide 16

Slide 16 text

jgs 516 00001010 Bloat

Slide 17

Slide 17 text

jgs 516 00001010 Bloat

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

jgs 516 00001010 Methods Create code Elegant and Efficient

Slide 20

Slide 20 text

jgs 516 00001010 Case 15 !

Slide 21

Slide 21 text

jgs Recomendations

Slide 22

Slide 22 text

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.

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

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?

Slide 25

Slide 25 text

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.

Slide 26

Slide 26 text

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.