Slide 1

Slide 1 text

jgs CSC 308 Software Engineering 1 Lecture 07: Clean Coding 1 Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.com Building 14 -227 Office Hours: By appointment

Slide 2

Slide 2 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 2 § Construction or Coding § Testing (Unit, UI, Integration, Stress, Regression) Activities

Slide 3

Slide 3 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 3 Java API + Tutorials

Slide 4

Slide 4 text

jgs More About GUI Calculator

Slide 5

Slide 5 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 5 Lab 04 0

Slide 6

Slide 6 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 6 Key Ideas DRY KIS Readable (comments, names, spaces,…)

Slide 7

Slide 7 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 7 import javax.swing.*; public class Example extends JFrame{ public static void main(String[] args) { Example frame = new Example(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(500,500); frame.setVisible(true); } } Method main()

Slide 8

Slide 8 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 8 import javax.swing.*; public class Example extends JFrame{ public Example() { super("Hello World Swing"); GridLayout layout = new GridLayout(3,2); setLayout(layout); JLabel label = new JLabel("Hello World"); add(label); JButton button = new JButton("Click Me"); add(button); JTextField text = new JTextField("Text", 10); add(text); JCheckBox check = new JCheckBox("Option"); add(check); } public static void main(String[] args) { Example frame = new Example(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(500,500); frame.setVisible(true); } } Layouts

Slide 9

Slide 9 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 9 import javax.swing.*; public class Example extends JFrame{ public Example() { super("Hello World Swing"); BorderLayout layout = new BorderLayout(); setLayout(layout); JLabel label = new JLabel("Hello World"); add(label, BorderLayout.CENTER); JButton button = new JButton("Click Me"); add(button , BorderLayout.SOUTH); JTextField text = new JTextField("Text", 10); add(text , BorderLayout.NORTH); JCheckBox check = new JCheckBox("Option"); add(check , BorderLayout.EAST); } public static void main(String[] args) { Example frame = new Example(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(500,500); frame.setVisible(true); } } Layouts

Slide 10

Slide 10 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 10 JPanel 2

Slide 11

Slide 11 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 11 Pseudo Calculator

Slide 12

Slide 12 text

jgs More About GUI Graphing calculator

Slide 13

Slide 13 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 13 Extending JPanel

Slide 14

Slide 14 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 14 Extending JPanel

Slide 15

Slide 15 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 15 Questions

Slide 16

Slide 16 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 16 Office Hours Tuesday and Thursday 3 - 5 pm But an appointment required Sent me an email – [email protected]

Slide 17

Slide 17 text

jgs

Slide 18

Slide 18 text

jgs CSC 308 Software Engineering 1 Lab 07: Clean Coding Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.com Building 14 -227 Office Hours: By appointment

Slide 19

Slide 19 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 19 Lab 0

Slide 20

Slide 20 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 20 Lab Program a Calculator in Java • Basic Functionality • Take care of your code – Readability, DRY, KIS

Slide 21

Slide 21 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 21 Ideas

Slide 22

Slide 22 text

jgs CSC 308 Software Engineering I Javier Gonzalez-Sanchez, Ph.D. [email protected] Winter 2022 Copyright. These slides can only be used as study material for the class CSC308 at Cal Poly. They cannot be distributed or used for another purpose.