Cs427 software engineering i
This presentation is the property of its rightful owner.
Sponsored Links
1 / 26

CS427: Software Engineering I PowerPoint PPT Presentation


  • 94 Views
  • Uploaded on
  • Presentation posted in: General

CS427: Software Engineering I. Darko Marinov (slides from Ralph Johnson). Midterm exam. Your opinion? Hard/easy? Long/short? Surprising/not? Reading books is important Did you like format of questions? T/F? Grades will be on Wiki by Friday, Oct 13 If you have questions, please let us know

Download Presentation

CS427: Software Engineering I

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Cs427 software engineering i

CS427:Software Engineering I

Darko Marinov

(slides from Ralph Johnson)


Midterm exam

Midterm exam

  • Your opinion?

    • Hard/easy? Long/short? Surprising/not?

    • Reading books is important

    • Did you like format of questions? T/F?

  • Grades will be on Wiki by Friday, Oct 13

    • If you have questions, please let us know

    • If you think we erred, please let us know

CS427


Project groups

Project groups

  • Only groups 8 and 27 have 8 students so far

    • 8 students is ideal; it may be 7 or 9 at the end

  • Project fair

    • 5pm on Friday, Oct 13, room TBA (Wiki)

    • You should come if

      • You’re a representative of a group with <8 students

      • You’re still looking for a group

    • Each representative will give a brief presentation

    • HW2 (due Oct 24) asks for details of your project

CS427


Project grading

Project grading

  • You are graded on how well you follow your process (you decide XP or RUP)

    • You must know it

    • You must follow it

    • You must prove you follow it

  • Make a log of what you do every day

  • Project is 35% of grade

    • HWs help you to make progress on the project

CS427


Classic software engineering phases

Classic software engineering phases

  • Put them in correct order: code, design, maintenance, requirements, specification, test [ME: almost all correct answers]

  • We covered requirements and some design

  • Today: specifications (specs)

  • Do customers and users need to understand requirements (or specs)? [ME: many wrong]

CS427


Why phases

Why phases?

  • Break big job into smaller steps

    • Let people specialize

    • Provide check-points

    • Provide early feedback

    • Provide multiple views

CS427


Other forms of decomposition

Other forms of decomposition

  • Modules/components

    • For each module, follow req-spec-design-code-test cycle

  • Features

    • For each feature, follow req-spec-design-code-test cycle

CS427


Specification

Specification

  • Define system as a set of data items and operations on that data

  • Specification is set of properties of data and operations

  • Example: bank balance is never negative

  • Formal spec: “forall a: Account. a.balance ≥ 0”

CS427


Notations

Notations

  • English

    • Easy to read

    • Hard to analyze

  • Programming language

    • Easy for programmers to read

    • Often not powerful enough

  • Special (formal) specification languages

    • We don’t teach much on this topic in CS427

CS427


Why formal languages

Why formal languages?

  • Can describe many artifacts (specs, designs, requirements) [ME: many correct answers]

    • Documentation (precise, unambiguous)

    • Enables (automatic!) machine reasoning

  • Informal: “everybody likes a winner”?

    • exists w: Winner. exists p: Person. p.likes(w)

    • exists w: Winner. all p: Person. p.likes(w)

    • all p: Person. exists w: Winner. p.likes(w)

    • all p: Person. all w: Winner. p.likes(w)

CS427


Credit card

Credit card

  • A credit card has a balance that is the sum of all charges minus the sum of all payments. If the balance is not paid within 20 days of billing, 1% of the unpaid balance is charged as interest. Each credit card has a particular day on which it is billed each month. Customers cannot charge if the charge would put balance over the limit. [Data and operations?]

CS427


Data and operations

Data and operations

  • Credit card has

    • balance

    • limit

    • billing day

  • Operations on credit card

    • pay(amount)

    • charge(amount)

CS427


Properties of operations

Properties of operations

  • Can’t say balance equals sum of all charges minus sum of all payments due to interest

    • Invariant: what holds in all states

  • Can say “c.pay(a).balance = c.balance - a”

    • Postcondition: what operation establishes

  • Can say “if c.balance + a < c.limit then c.charge(a).balance = c.balance + a”

    • Precondition: what operation assumes

CS427


Question not on me

Question not on ME

  • Consider binarySearch(int[] a, int v) method

  • Input: array and a value to search for

  • Output: position of value in the array

  • Uses binary search

  • What should be precondition?

    • a is sortedT/F

    • a is not nullT/F

CS427


Extending operations

Extending operations

  • “If the balance is not paid within 20 days of billing, 1% of the unpaid balance is charged as interest.”

CS427


First approach

First approach

  • Add “unpaid balance” to a credit card

  • unpaidBalance = balance on billing date

  • payments get subtracted from unpaidBalance

  • 20 days after billing, compute interest and charge it

CS427


Second approach

Second approach

  • Add date to payments and charges

  • Operations on credit card

    • pay(amount, date)

    • charge(amount, date)

  • Credit card has

    • balance, limit, billing day

    • set of payments

    • set of charges

CS427


Second approach1

Second approach

For each credit card

balance(date) =

(sum a for d<=date of charges(a,d)) –(sum a for d<=date of payments(a,d))

There is a c in charges(a, billingDate + 20) wherec.balance(billingDate) –sum a for d<=date of charges(a, d)

CS427


Comparison

Comparison

  • First approach

    • More like programming

    • More standard notation

    • Longer specs

  • Second approach

    • Shorter, more abstract, easier to reason about

    • More to learn

  • Personal experience: Java vs. Alloy

CS427


Design and specification

Design and specification

  • Specification needs to know data

  • Specification needs to be structured

  • Must design module interfaces

  • Specification is usually the design of the “entities”

CS427


Executable specifications 1

Executable specifications (1)

  • Some very high-level programming languages can be used to write specs

    • Prolog (Hamlet and Maybee, you don’t need details)

    • Lisp

    • Smalltalk

    • Maude (several courses on formal methods)

CS427


Executable specifications 2

Executable specifications (2)

  • Write and test specification

  • Rewrite in efficient language

  • Write and test specification

  • Rewrite to be more efficient

CS427


Story about ada

Story about Ada

  • Ada - language invented by military project around 1980

  • Specification, verification suite

  • First Ada compiler written in SetL

    • “Set Language”

  • Slow, but tested spec and verification suite

  • Moral: executable specifications are useful

CS427


Story about concurrency

Story about concurrency

  • System for downloading data from cash registers (Prof. Johnson’s experience)

  • Frequent deadlock

  • After fourth attempt, developed formal specification and derived a design

  • Moral: formal techniques can solve hard problems

  • Automated analysis: model checking

CS427


Conclusion

Conclusion

  • Specifications can be

    • Informal or formal

    • For entire system or just a small part

    • Executable or non-executable

  • You must decide what you need

    • Very common in software engineering

    • Many things are vague and ambiguous

    • Advice: use your experience (get some in CS427)

CS427


Next time

Next time

  • Read chapter 10 of Hamlet and Maybee

    • Be familiar with the controversy

    • Don’t need to learn details of Prolog

CS427


  • Login