CSCI 2132 Software Development Lecture 14: Software Development - - PowerPoint PPT Presentation

csci 2132 software development lecture 14 software
SMART_READER_LITE
LIVE PREVIEW

CSCI 2132 Software Development Lecture 14: Software Development - - PowerPoint PPT Presentation

CSCI 2132 Software Development Lecture 14: Software Development Life Cycle Instructor: Vlado Keselj Faculty of Computer Science Dalhousie University 5-Oct-2018 (14) CSCI 2132 1 Previous Lecture (Fire Alarm) Integer and


slide-1
SLIDE 1

CSCI 2132 Software Development Lecture 14: Software Development Life Cycle

Instructor: Vlado Keselj Faculty of Computer Science Dalhousie University

5-Oct-2018 (14) CSCI 2132 1

slide-2
SLIDE 2

Previous Lecture

  • (Fire Alarm)
  • Integer and floating-point representation
  • Character types

5-Oct-2018 (14) CSCI 2132 2

slide-3
SLIDE 3

Reading Characters

  • scanf can be used to read a character, but it does not

ignore white space

  • For example, the following statements are not equivalent.

(Find an input example.) scanf("%c", &ch); scanf(" %c", &ch);

  • getchar and putchar are used for input and output at

the character level; e.g.: int ch = getchar(); putchar(ch);

  • int is used as return to detect EOF

5-Oct-2018 (14) CSCI 2132 3

slide-4
SLIDE 4

Code Example

#include <stdio.h> int main() { int ch; while (EOF != (ch = getchar()) && ch != ’\n’) { if (’a’ <= ch && ch <= ’z’) ch = ch - ’a’ + ’A’; putchar(ch); } putchar(’\n’); return 0; }

5-Oct-2018 (14) CSCI 2132 4

slide-5
SLIDE 5

Code Example

  • Consider:

EOF != (ch = getchar()) && ch != ’\n’

  • Are brackets necessary?

5-Oct-2018 (14) CSCI 2132 5

slide-6
SLIDE 6

Type Conversions

  • Consider the following code:

float f = 3.4;

  • Works in C (not in Java) due to implicit type conversion
  • Implicit type conversion takes place in:

– operands, and – assignments

5-Oct-2018 (14) CSCI 2132 6

slide-7
SLIDE 7

Example with Operands

  • Example

float f; double d; int i; d = d + f; f = f + i;

  • f is promoted to double, and i is promoted to double
  • operands are promoted to ‘narrowest’ type which will

accomodate both

5-Oct-2018 (14) CSCI 2132 7

slide-8
SLIDE 8

Implicit Conversion in Assignment

  • Example:

int i = 8.92;

  • The right side is converted to the type of the left side

5-Oct-2018 (14) CSCI 2132 8

slide-9
SLIDE 9

Type Casting

  • Type Casting, or explicit type conversion
  • Syntax: (type) expression
  • Example

float f, frac_part; frac_part = f - (int)f;

  • What is calculated in frac_part?

5-Oct-2018 (14) CSCI 2132 9

slide-10
SLIDE 10

Another Example

float quotient; int dividend = 5; int divisor = 4; quotient = dividend / divisor; quotient = (float) dividend / divisor; quotient = (float) (dividend / divisor); quotient = 1.0f * dividend / divisor;

  • What values are assigned in these four statements to

quotient?

5-Oct-2018 (14) CSCI 2132 10

slide-11
SLIDE 11

Type Definitions Using typedef

  • We can define types using:

typedef typename alternative_name

  • One example:

typedef int Bool; Bool flag;

  • Particularly useful with more complex types, as

we will see later

5-Oct-2018 (14) CSCI 2132 11

slide-12
SLIDE 12

The sizeof Operator

  • Size of many C types are

implementation-defined

  • sizeof operator = number of bytes required

to store a type

  • Syntax: sizeof(type)
  • Example: sizeof(char)
  • sizeof can also be applied to variables; e.g.:

int i; printf("%d\n", sizeof(i));

5-Oct-2018 (14) CSCI 2132 12

slide-13
SLIDE 13

Software Development Life Cycle (SDLC)

  • SDLC is a general term that describes structure imposed
  • n the development of a software product
  • Purpose

– To reduce the risk of missing the deadline – To ensure product quality – To prevent “scope creep”, etc.

  • Many models have been proposed to describe SDLC

5-Oct-2018 (14) CSCI 2132 13

slide-14
SLIDE 14

The Waterfall Model

  • A sequential design process

Requirements Analysis (Software) Design Implementation (Coding) Verification (Testing) Maintenance (Patches...)

5-Oct-2018 (14) CSCI 2132 14

slide-15
SLIDE 15

Waterfall: Advantages and Disadvantages

  • Advantages

– Natural and easy to understand – Widely used – Reinforces notion of “design before coding” – Clear milestones

  • Disadvantages

– Often not practical – Clients may change requirements – Designers may not be aware of implementation difficulties

5-Oct-2018 (14) CSCI 2132 15

slide-16
SLIDE 16

The Rapid Prototyping Model

  • 1. Gathering preliminary requirements
  • 2. Fast prototyping
  • 3. User evaluation of the prototype
  • 4. Repeat the above steps if necessary
  • 5. Discard the prototype and develop the software

using a formal process

5-Oct-2018 (14) CSCI 2132 16

slide-17
SLIDE 17

Rapid Prototyping: Advantages and Disadvantages

  • Advantages

– Ensure that software product meets client’s requirements – Reduce time and cost if client requests changes during the process

  • Disadvantages

– Adequate and appropriate user involvement may not always be possible – Cost of prototype development

5-Oct-2018 (14) CSCI 2132 17

slide-18
SLIDE 18

More about Models

  • There are many other models
  • To be studied in the Software Engineering

course

  • Choose an appropriate model depending on

the particular software to be developed

5-Oct-2018 (14) CSCI 2132 18