Slide 1

Slide 1 text

Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.info o ffi ce: 14 -227 CSC 508/9 Software Engineering (Design & Deployment) Lecture 06. Quality Metrics

Slide 2

Slide 2 text

Previously

Slide 3

Slide 3 text

Assignment 3 •Create a Desktop Application •Using Java SDK 20 (verbose programming language) •Java Swing for Graphics •User Experience (from installation configuration to using it)

Slide 4

Slide 4 text

1. Java Desktop Application Eye Tr a cking Simul a tor (size, speed) 4

Slide 5

Slide 5 text

2. Java Desktop Application A ff ect Recognition (speed) 5

Slide 6

Slide 6 text

3. Java Desktop Application He a d Movement 6

Slide 7

Slide 7 text

4. Java Desktop Application Cobot Simul a tor 7

Slide 8

Slide 8 text

5. Java Desktop Application Hub 8

Slide 9

Slide 9 text

Quality Metrics

Slide 10

Slide 10 text

Clean Code Re a d a bility • DRY • KIS • SRP • Comments • Error H a ndling with a Logger 10 Metrics • LOC (eLOC, lLOC) • CC • A • I • D

Slide 11

Slide 11 text

Complexity Number Meaning 1-10 Structured and well written code High Testability Cost and Effort is less 10-20 Complex Code Medium Testability Cost and effort is Medium 20-40 Very complex Code Low Testability Cost and Effort are high >40 Not at all testable Very high Cost and Effort Cyclomatic Complexity 11

Slide 12

Slide 12 text

Cyclomatic Complexity • a round 20 is perfect, • up to 50 is f ine, • up to 100 is a cept a ble, • a bove 150 is prob a bly a “b a d” choice, a nd • more th a n 250 is 😖 12

Slide 13

Slide 13 text

Distance 13 Abstract Concrete Stable Hard to Change Only incoming dependencies Unstable Changeable Only outgoing dependencies the m ain sequence Painful Useless 0 1 1 0 Instability Abstractness

Slide 14

Slide 14 text

Instability • Indic a tes whether: ( a ) the item is m a inly used by others (st a ble – h a rd to ch a nge); or (b) it m a inly depends on other items (in-st a ble – ch a nge a ble). • It is a v a lue between 0 a nd 1: • 0 only incoming dependencies to • 1 (only outgoing dependencies). 14

Slide 15

Slide 15 text

Example 15 Write the Source Code

Slide 16

Slide 16 text

Patterns

Slide 17

Slide 17 text

GoF Patterns 17

Slide 18

Slide 18 text

Eric Gamma 18

Slide 19

Slide 19 text

Download Eclipse Modeling Tools 19

Slide 20

Slide 20 text

Factories and Sinletons package myModel; public interface MyModelFactory extends EFactory { MyModelFactory eINSTANCE = myModel.impl.MyModelFactoryImpl.init(); Course createCourse(); Student createStudent(); Computer createComputer(); MyModelPackage getMyModelPackage(); } public interface MyModelPackage extends EPackage { String eNAME = "myModel"; String eNS_URI = "https://org/eclipse/example/myModel"; String eNS_PREFIX = "org.eclipse.example.myModel"; MyModelPackage eINSTANCE = myModel.impl.MyModelPackageImpl.init(); // more ... } 20

Slide 21

Slide 21 text

Observers and Observables package myModel.impl; public class CourseImpl extends MinimalEObjectImpl.Container implements Course { protected static final String NAME_EDEFAULT = null; protected String name = NAME_EDEFAULT; protected EList students; protected CourseImpl() { super(); } @Override protected EClass eStaticClass() { return MyModelPackage.Literals.COURSE; } @Override public String getName() { return name; } @Override public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, MyModelPackage.COURSE__NAME, oldName, name)); } // continue ... 21

Slide 22

Slide 22 text

To be Continued…

Slide 23

Slide 23 text

Questions 23

Slide 24

Slide 24 text

CSC 509 Software Engineering Javier Gonzalez-Sanchez, Ph.D. [email protected] Fall 2024 Copyright. These slides can only be used as study material for the class CSC509 at Cal Poly. They cannot be distributed or used for another purpose.