intro to intro to software engineering - brown university jannotti (cs32) intro to intro to software...

21
Announcements TA hours and labs start today. First lab is out and due next Wednesday, 1/31. “Getting started” lab is also out I Get you setup for project/lab work. I We’ll check it with the first lab. “Stars” is out and due in a little over 2 weeks (2/9 6pm) Gear-up session here (Metcalf Auditorium) Monday at 6:30pm 1/29 Brown CS “town hall” meeting today at 4pm in Atrium. John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1/1

Upload: ngokhanh

Post on 18-Jul-2018

263 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Announcements

TA hours and labs start today.

First lab is out and due next Wednesday, 1/31.

“Getting started” lab is also outI Get you setup for project/lab work.I We’ll check it with the first lab.

“Stars” is out and due in a little over 2 weeks (2/9 6pm)

Gear-up session here (Metcalf Auditorium) Monday at 6:30pm 1/29

Brown CS “town hall” meeting today at 4pm in Atrium.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1

Page 2: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Intro to Intro to Software Engineering

John Jannotti

/course/cs0320/www/lectures/

Jan 25, 2018

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 2 / 1

Page 3: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Introductions

John Jannotti (jj) — Networking, Sightpath, FoodlerI CIT 449 (Hours: After class until around 6pm.)

Tim Nelson (tn) — Logic for Systems, cs18

HTAs — Adam DeHovitz, Alex Jang, Joe Romano

UTAsI You’ll “meet” them soon.I See website for blurbs that may help you find the right mentor.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 3 / 1

Page 4: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

CSCI0320 focus

We focus mainly on Applications programming.I CS33 focuses on Systems programming.

We will spend most of our time onI Writing correct, understandable, and extensible code.I Building the right thing. You will make these decisions.I Integrating and connecting subsystems.

The class is designed to work with code bases over time.I Projects work together.I Your pair project will marry your code to another student’s.I Labs will evolve the Boggle project.I Group project — lots of code, several contributors, over time.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 4 / 1

Page 5: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Meetings

Lectures (Metcalf Auditorium)I Emphasis on design, we’ll walk through many case studies.I We time lectures to help with projects, honest.I More emphasis on particpation this year.I Tuesday & Thursday 1pm-2:20pm

Project “gear-up” sessions.

LabsI Hands-on training you’ll need for assignments.I Significant to your grade.

Communication via the web-site, PiazzaI Signup: piazza.com/brown/spring2018/cs32I Calendar and lectures slides will be available.I You are responsible for everything posted.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 5 / 1

Page 6: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

This course just keeps going. . .

There is very little slack in the schedule.

Start (even if only to read) assignments when they come out.

Labs: Due in lab hours by due date or nothing.

Lateness is penalized 20% / day. (We forgive your first two.)I No credit at all after 48 hours, and yet. . .I Every assignment must be turned in and working to pass!I If you’re not truly done 47.9 hours after the deadline, turn something

in.I Getting a zero on a project costs about one whole letter grade.I You still need a passing grade. “All working by semester end” is a

necessary, but not sufficient, condition for credit.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 6 / 1

Page 7: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Collaboration

We have loosened some restrictions.

You may discuss projects orally with other (current) 32 students.

You may not look at each others’ code, or collaborate over a mediumthat allows direct sharing of others’s words or code (email, IM).

No photos, recordings, written notes.

Take a break before coding after oral collaboration.

We do use MOSS. It finds shared code. Please don’t test it.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 7 / 1

Page 8: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Term Project

Team project — Four person teams.

Project of your choiceI We let you choose, because we want it to matter to you.I Some of you won’t stop at the end of the course.I You will learn the most from this, we can’t guide you step-by-step.

ConceptsI Pull together all your skillsI Software engineering, project management; software design

We’re intentionally starting a bit later this year.I Ideas not due for a while. Pay attention in daily life.I We encourage “heterogeneous” teams (wrt Intro Sequence)I No web frameworks beyond Spark.I No (native) mobile apps.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 8 / 1

Page 9: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Your illustrious TAs

Let’s meet your TAs.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 9 / 1

Page 10: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Software Engineering

Software Engineering 6= ProgrammingI Programming is often a surprisingly small part.

What else?I Determining what to build

F Requirements (what tasks should the Software accomplish?)F Specifications (exact operating behavior)

I Determining how to build it (Design/Architecture)I Testing (correctness and user experience)I Debugging (functional and performance)I Maintaining the program (new APIs, platforms, minor features)I There are certainly dependencies, but not purely linear.

Hopefully, software lifetime is mostly maintenance/enhancement.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 10 / 1

Page 11: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

And the programming is different, too

We’re stressing certain aspects when we say, “engineering”.I What do you think matters most when we talk about “high-quality

code”?

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 11 / 1

Page 12: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Three first principles

As you learn about software engineering you’ll hear a lot of “bestpractices,” and “rules of thumb” or their opposite: “code smells.” Whilehandy, at base we try to justify everything against three goals.

Safe From Bugs (SFB) – is your code likely to stay bug-free as it’schanged?

Easy To Understand (ETU) – can someone read your code and knowwhat’s going on quickly, without false starts?

Ready For Change (RFC) – if new features are needed, are the neededchanges likely to be straightforward?

These goals are about code quality — meeting requirements (includingcorrectness and performance) is an external property, and also matters.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 12 / 1

Page 13: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Programming Languages

Among “equivalence classes” language isn’t so importantI Should be able to pick up new ones on your own.I We’ll teach universal concepts.

But, how you use the language is importantI By necessity, we’ll talk about language specific things.I Others need to understand your code.I Idioms vary from one language to another.I We’ll expect (and teach) you to write Java “properly.”

Projects and lectures will all use Java (8) at their “core”.

But the user interfaces will be “webby” - HTML, CSS, Javascript es6.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 13 / 1

Page 14: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Why Java?

Easy to teach concepts.I The interface mechanism is simple and powerful (often a better

abstraction mechanism than inheritance).I Encapsulation / Data-hiding support is excellent.I Garbage Collection allows cleaner interfaces than C/C++I Static typing catches many mistakes at compile-time.

Strong “ecoystem”I IDEs and command-line tools widely available.I Extensive libraries available.I Common enough that you gain real-world experience.

Fast enough for almost anything.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 14 / 1

Page 15: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Why “Webby”?

User Interfaces are always a bit grungy.

You might as well pick up reusable skills.

HTML, CSS, and Javascript are “reasonable”

Ecmascript, or “es6”, even more so.

You’ll learn at least half of what matters to modern web apps.

The same separation applies to mobile apps.

We’ll be treating them as “display technology.”, we won’t worryabout

I Users: Logins, Passwords, Multiple usersI Security: Cookies, XSS attacks, malicious clientsI Browser details: “Back button”, multiple windows, browser quirks.

I’ll spend a little time on them late, for the sake of projects.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 15 / 1

Page 16: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Java vs Javascript

Almost the same name, and they look very similar.

1 i n t n = 3 ;2 w h i l e ( n != 1) {3 System . out . p r i n t l n ( n ) ;4 i f ( n % 2 == 0) {5 n = n / 2 ;6 } e l s e {7 n = 3 ∗ n + 1 ;8 }9 }

10 System . out . p r i n t l n ( n ) ;

1 l e t n = 3 ;2 w h i l e ( n != 1) {3 c o n s o l e . l o g ( n ) ;4 i f ( n % 2 == 0) {5 n = n / 2 ;6 } e l s e {7 n = 3 ∗ n + 1 ;8 }9 }

10 c o n s o l e . l o g ( n ) ;

Awfully similar, right? What’s different? Do you expect the same resultsfor all n?

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 16 / 1

Page 17: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Messy interlude

Let’s have a look at what can go wrong.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 17 / 1

Page 18: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

What went wrong?

The programs used types in a way they were not intended.

We may have imagined the values as representing abstract,mathematical numbers (integers).

That wasn’t true in either language, though it was untrue in differentways in each.

To write high-quality programs you must not only understand thebuilt-in types of a language, you will become skilled at creating newtypes.

Back to Java vs Javascript: The biggest single difference is that Javahas an explicit typing system that it checks at compile-time.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 18 / 1

Page 19: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Messier interlude

Let’s have a look at what else can go wrong, and how these languages tellus about the problem.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 19 / 1

Page 20: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Static Typing

Static typing is a great benefit in meeting our three core goals.

Safe from bugs. — Catch type errors and other bugs before runtime.

Easy to understand. — Types are explicitly stated in the code.

Ready for change. — Identifies other places that need to change intandem.

Next week, I’ll show you more tools and techniques to get similar benefitswith static analysis of your code.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 20 / 1

Page 21: Intro to Intro to Software Engineering - Brown University Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 1 / 1. ... Projects and lectures will all use Java (8)

Back to the code

There’s much more to writing code code than not having type errors.

John Jannotti (cs32) Intro to Intro to Software Engineering Jan 25, 2018 21 / 1