Download presentation
Presentation is loading. Please wait.
Published byLillian Hubbard Modified over 8 years ago
1
1 Introduction
2
2 Administrative ~80% Exam, ~20% Homeworks Must pass exam 4-5 Homeworks Homework grades: 80 is easy, 100 is hard 1-2 Class exercises Lecture in tutorial slot Office hours: by e-mail appointment imaman@cs
3
3 How to Approach this Course Hard to emulate the “real world” Requirements/scope No clear finish line Months & years You need to treat the material differently Extrapolation Wide but not deep Every decisions has pros and cons Result You will write slower!
4
4 Context OOP Mostly static typing Performance is not issue
5
5 “Design” => “Better” software Define: Design Define: Quality in software
6
6
7
7 What Jeremy Lin Teaches Us About Talent? Lin was eventually signed by the Warriors, but he was soon placed on the inactive list … Lin was waived by the Warriors, picked up and then waived by the Rockets, before finally being claimed by the Knicks as a backup point guard. “Frontal Cortex” (Jonah Lehrer)
8
8 Statistical Correlation Once: Pick properties that are easy to measure Measure “success” indicators Correlate properties and indicators Repeatedly: Predict future success by measuring properties Didn’t work in the case of Jeremy Lin “Success” indicators in s/w are harder to measure (than in sports)
9
9
10
10 “A fly with no legs cannot hear”
11
11
12
12 Analysis Fixes in earlier stages are cheaper => Better to detect mistakes earlier => “Measure twice, cut once” How about Cost of fix rises with amount of knowledge needed to be processed by the fixer => Less decisions, cheaper fixes => Feedback about what’s not working makes fixes cheaper
13
13 (Jeremy Lin, Repair Cost Chart) Pre-estimation of success will not work Intensive pre-planning will not work Actually, we already know that (Computability 101) Try it! Get real feedback Similar to physical checks, planning a city
14
14 A One-Line Summary Write test!
15
15 A Two-Line Summary Rule #1:Write test! Rule #2:Programming is a process of trial-and-error process
16
16 Axioms Entropy Discontinuity Long tail Super-linearity
17
17 Burn Charts Time is important. let’s describe our progress vs. time Vertical axis: tasks completed Horizontal axis: time line
18
18 Burn Up
19
19 Burn Up Example
20
20 Quality in Software High-quality: A software whose burn curve is linear We don’t care about the slope. As long as it’s constant Similar to Big-O notation of algorithms Flattening is the #1 risk Can be experienced even in student assignments Result oriented Unlike code metrics whose correlation with the net result is indirect (at best) Requires constant feedback, short iterations Past is measurable Provides some confidence for the future
21
21 Quality in Software (cont.) High-quality: A software whose burn curve is linear A s/w dev. technique must optimize delivery time “Plan for X months and code for X weeks” does not work A s/w dev. technique that requires, at iteration N+1, work that is O(N), does not work
22
22 What is Design (I) Sufficient information for a craftsman of typical skill to be able the build the artifact without excessive creativity. (Guy Steele)
23
23 public class Calculator { int x; public A(int n) { x = n; } public int add(int y) { return x + y; } public int sub(int y) { return x – y; } }
24
24 Using a Calculator Object Compute 5 + 9, put result in x int x = 5 + 9; int x = new Calculator(5).add(9); Protocols induce a new programming language
25
25 Class IndentingPrinter public class IndentingPrinter { private String indentation = ""; private final StringBuilder sb = new StringBuilder(); public void inside() { indentation += " "; } public void outside() { indentation = indentation.substring(2); } public void print(String s) { sb.append(indentation).append(s).append('\n'); } @Override public String toString() { return sb.toString(); } }
26
26 Using IndentingPrinter’s Language public class Book { private String name; public Book(String name) { this.name = name; } public void print(IndentingPrinter p) { p.print("Book: " + name); } } public class Library { private String name; private List books = new ArrayList (); public Library(String name) { this.name = name; } public void add(Book b) { books.add(b); } public void print(IndentingPrinter p) { p.print("Library: " + name); for (Book b : books) b.print(p); }
27
27 Class IndentingPrinter (II) public static class IndentingPrinter { private final String indentation; private StringBuilder sb = new StringBuilder(); public IndentingPrinter() { this("", new StringBuilder()); } private IndentingPrinter(String indentation, StringBuilder sb) { this.indentation = indentation; this.sb = sb; } public IndentingPrinter inside() { return new IndentingPrinter(indentation + " ", sb); } public void print(String s) { sb.append(indentation).append(s).append('\n'); } @Override public String toString() { return sb.toString(); } }
28
28 New Protocol => New Language // Book remains the same... public static class Library { private String name; private List books = new ArrayList (); public Library(String name) { this.name = name; } public void add(Book b) { books.add(b); } public void print(IndentingPrinter p) { p.print("Library: " + name); for (Book b : books) b.print(p.inside()); }
29
29 Which Version do you like better?
30
30 What is Design (II) Design is the language induced by the protocols of the objects that are available at a certain context
31
31 “Design, by nature, is a series of trade-offs. Every choice has a good and bad side, and you make your choice in the context of overall criteria defined by necessity. Good and bad are not absolutes, however. A good decision in one context might be bad in another. If you don't understand both sides of an issue, you cannot make an intelligent choice; in fact, if you don't understand all the ramifications of your actions, you're not designing at all. You're stumbling in the dark” Allen Holub, “Why getter and setter methods are evil”, http://www.javaworld.com
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.