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

CSC509 Lecture 06

CSC509 Lecture 06

Software Design
Quality Metrics
(202310)

Javier Gonzalez-Sanchez

October 14, 2024
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. 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
  2. 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)
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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<Student> 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
  10. 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.