Cs427 software engineering i
1 / 26

CS427: Software Engineering I - PowerPoint PPT Presentation

  • 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

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

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

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

    • If you think we erred, please let us know


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


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


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]


Why phases?

  • Break big job into smaller steps

    • Let people specialize

    • Provide check-points

    • Provide early feedback

    • Provide multiple views


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



  • 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”



  • 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


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)


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?]


Data and operations

  • Credit card has

    • balance

    • limit

    • billing day

  • Operations on credit card

    • pay(amount)

    • charge(amount)


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


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


Extending operations

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


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


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


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)



  • 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


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”


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)


Executable specifications (2)

  • Write and test specification

  • Rewrite in efficient language

  • Write and test specification

  • Rewrite to be more efficient


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


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



  • 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)


Next time

  • Read chapter 10 of Hamlet and Maybee

    • Be familiar with the controversy

    • Don’t need to learn details of Prolog


  • Login