1
17-214
Principles of Software Construction: Objects, Design, and Concurrency Part 1: Introduction Course overview and introduction to software design
Josh Bloch Charlie Garrod
Josh Bloch Charlie Garrod 17-214 1 Software is everywhere 17-214 - - PowerPoint PPT Presentation
Principles of Software Construction: Objects, Design, and Concurrency Part 1: Introduction Course overview and introduction to software design Josh Bloch Charlie Garrod 17-214 1 Software is everywhere 17-214 2 Growth of code and complexity
1
17-214
Principles of Software Construction: Objects, Design, and Concurrency Part 1: Introduction Course overview and introduction to software design
Josh Bloch Charlie Garrod
2
17-214
Software is everywhere
3
17-214
Growth of code and complexity over time
4
17-214
Blackout of 2003 Normal night-time image
5
17-214
6
17-214
6
7
17-214
Principles of Software Construction: Objects, Design, and Concurrency Part 1: Introduction Course overview and introduction to software design
Josh Bloch Charlie Garrod
8
17-214
binary tree graph search sorting primes GCD
9
17-214
Our goal: understanding both the building blocks and the design principles for construction of software systems
From programs to systems
Writing algorithms, data structures from scratch Functions with inputs and outputs Sequential and local computation Full functional specifications Reuse of libraries, frameworks Asynchronous and reactive designs Parallel and distributed computation Partial, composable, targeted models
10
17-214
Principles of Software Construction: Objects, Design, and Concurrency Part 1: Introduction Course overview and introduction to software design
Josh Bloch Charlie Garrod
11
17-214
Objects in the real world
12
17-214
Object-oriented programming
that contain both data and methods
public class Bicycle { private final Wheel frontWheel, rearWheel; private final Seat seat; private int speed; … public Bicycle(…) { … } public void accelerate() { speed++; } public int speed() { return speed; } }
13
17-214
Principles of Software Construction: Objects, Design, and Concurrency Part 1: Introduction Course overview and introduction to software design
Josh Bloch Charlie Garrod
14
17-214
Semester overview
– Design goals, principles, patterns
– Design for change – Design for reuse
– Design for robustness – Design for change (cont.)
– Modern development tools: IDEs, version control, build automation, continuous integration, static analysis – Modeling and specification, formal and informal – Functional correctness: Testing, static analysis, verification
15
17-214
Sorting with a configurable order, version A
static void sort(int[] list, boolean ascending) { … boolean mustSwap; if (ascending) { mustSwap = list[i] > list[j]; } else { mustSwap = list[i] < list[j]; } … }
16
17-214
Sorting with a configurable order, version B
interface Order { boolean lessThan(int i, int j); } class AscendingOrder implements Order { public boolean lessThan(int i, int j) { return i < j; } } class DescendingOrder implements Order { public boolean lessThan(int i, int j) { return i > j; } } static void sort(int[] list, Order order) { … boolean mustSwap =
… }
17
17-214
Sorting with a configurable order, version B'
interface Order { boolean lessThan(int i, int j); } final Order ASCENDING = (i, j) -> i < j; final Order DESCENDING = (i, j) -> i > j; static void sort(int[] list, Order order) { … boolean mustSwap =
… }
18
17-214
Which version is better?
static void sort(int[] list, boolean ascending) { … boolean mustSwap; if (ascending) { mustSwap = list[i] > list[j]; } else { mustSwap = list[i] < list[j]; } … } interface Order { boolean lessThan(int i, int j); } final Order ASCENDING = (i, j) -> i < j; final Order DESCENDING = (i, j) -> i > j; static void sort(int[] list, Order order) { … boolean mustSwap =
… }
Version A: Version B':
19
17-214
20
17-214
Software engineering is the branch of computer science that creates practical, cost-effective solutions to computing and information processing problems, preferably by applying scientific knowledge, developing software systems in the service of mankind.
Software Engineering for the 21st Century: A basis for rethinking the curriculum Manifesto, CMU-ISRI-05-108
21
17-214
Software engineering is the branch of computer science that creates practical, cost-effective solutions to computing and information processing problems, preferably by applying scientific knowledge, developing software systems in the service of mankind. Software engineering entails making decisions under constraints of limited time, knowledge, and resources… Engineering quality resides in engineering judgment… Quality of the software product depends on the engineer’s faithfulness to the engineered artifact… Engineering requires reconciling conflicting constraints… Engineering skills improve as a result of careful systematic reflection on experience… Costs and time constraints matter, not just capability…
Software Engineering for the 21st Century: A basis for rethinking the curriculum Manifesto, CMU-ISRI-05-108
22
17-214
Goal of software design
programs
– What are the differences between the variants? – Which variant should we choose? – How can we create a variant with desired properties?
23
17-214
Metrics of software quality, i.e., design goals
Functional correctness Adherence of implementation to the specifications Robustness Ability to handle anomalous events Flexibility Ability to accommodate changes in specifications Reusability Ability to be reused in another application Efficiency Satisfaction of speed and storage requirements Scalability Ability to serve as the basis of a larger version of the application Security Level of consideration of application security
Source: Braude, Bernstein, Software Engineering. Wiley 2011
24
17-214
A typical Intro CS design process
1. Discuss software that needs to be written 2. Write some code 3. Test the code to identify the defects 4. Debug to find causes of defects 5. Fix the defects 6. If not done, return to step 1
25
17-214
Better software design
– Maintainability, extensibility, performance, …
– Make explicit design decisions
26
17-214
Using a design process
27
17-214
Preview: Design goals, principles, and patterns
– e.g. maintainability, reusability, scalability
– e.g. high correspondence to real-world concepts
– e.g. template method pattern
28
17-214
Principles of Software Construction: Objects, Design, and Concurrency Part 1: Introduction Course overview and introduction to software design
Josh Bloch Charlie Garrod
29
17-214
Concurrency
30
17-214
Summary: Course themes
31
17-214
Software Engineering (SE) at CMU
– Extensibility, reuse, concurrency, functional correctness
– Requirements, teamwork, scalability, security, scheduling, costs, risks, business models
analysis, SE for startups, API design, etc.
– https://isri.cmu.edu/education/undergrad
32
17-214
33
17-214
These are not normal times…
34
17-214
Preconditions
– Two semesters of programming – Knowledge of C-like languages
– Familiarity with basic discrete math concepts
– Basic programming skills – Basic (formal) reasoning about programs
– Basic algorithms and data structures
35
17-214
Learning goals
functional correctness
36
17-214
Course staff
jbloch@gmail.com https://bit.ly/32J52av
charlie@cs.cmu.edu https://bit.ly/3lviI1z
Tomas, Victor
37
17-214
Course staff
jbloch@gmail.com https://bit.ly/32J52av
charlie@cs.cmu.edu https://bit.ly/3lviI1z
Tomas, Victor
38
17-214
Course meetings
– Supplementary material, hands-on practice, feedback – Be prepared to work on paper and with a laptop
– https://www.cs.cmu.edu/~charlie/courses/17-214/
Synchronous attendance is required unless you have permission for asynchronous attendance
39
17-214
Infrastructure
– Schedule, office hours calendar, lecture slides, policy documents
– Git, Github: Assignment distribution, hand-in, and grades – Piazza: Discussion board – IntelliJ or Eclipse: Recommended for code development (other IDEs are fine) – Gradle, Travis-CI, Checkstyle, SpotBugs: Practical development tools
– Introduction to Java and the tools in the course – Install Git, Java, some IDE, Gradle beforehand
– Homework 1 available tomorrow
40
17-214
Textbooks
available through CMU library):
– Joshua Bloch. Effective Java, Third Edition. Addison-Wesley, ISBN 978-0-13-468599-1. – Craig Larman. Applying UML and Patterns. 3rd
concurrency on the course web page
41
17-214
Approximate grading policy
This course does not have a fixed letter grade policy; i.e., the final letter grades will not be A=90-100%, B=80-90%, etc.
42
17-214
Collaboration policy (also see the course syllabus)
– You must clearly cite external resources so that we can evaluate your own personal contributions.
– Always turn in any work you've completed before the deadline
before we will grade your work: https://goo.gl/CBXKQK
– Upload signed collaboration policy to Gradescope
43
17-214
Late day policy
– 10% penalty per day after free late days are used
44
17-214
10% quizzes and participation
– If you participate asynchronously, you must complete "in-class" activities within 48 hours of class
The key to your success in this course is your regular, synchronous engagement with course activities, staff, and other students
45
17-214
Summary