?????a - PowerPoint PPT Presentation

About This Presentation
Title:

?????a

Description:

Stad?a?? ????pt??s? (Stepwise Refinement) ?a?? p??? ?at? (top-down design) ... A????t?? s?ed?as ??(modular design) ?fa??et???t?ta (abstraction) ... – PowerPoint PPT presentation

Number of Views:14
Avg rating:3.0/5.0
Slides: 38
Provided by: yiannakis
Category:

less

Transcript and Presenter's Notes

Title: ?????a


1
?????aµµat?sµ??
  • G?at? ??af??µe p????aµµata (p????. d?a?e??)
  • ??? ??af??µe p????aµµata
  • t? e??a? p????aµµat?sµ??
  • µe??d?????a
  • afa??et???t?ta (abstraction)
  • d?a????sµ?? µeta?? t? ?a? p??(p????aµµa,ded?µe?a..
    .)
  • ?a?ade??µata

2
?? e??a? p????aµµat?sµ??
  • ? s?ed?asµ?? a??????µ?? ?a? ? ???p???s? t??? se
    ???sse? p????aµµat?sµ?? ??a t?? ep???s?
    p??ß??µ?t??.

3
?e??d?????a
  • 1. ???sµ?? p??ß??µat??
  • 2. ??a??s?? p??ß??µat??
  • 3. S?ed?as? a??????µ??
  • 4. ???p???s? a??????µ?? se p????aµµa
  • 5. ????µ? ? epa???e?s? t?? ????????µ????
    p?????µµat?? (5.1 Ap?sfa?µat?s? 1-2-3-4)
  • 6. S??t???s? ? e??µ???s? t?? p?????µµat??

4
A????s?? ???ß??µat??
  • ????ß?? a?a?????s??
  • t? e??a? ta ded?µe?a (inputs)
  • t? e??a? ta e?a??µe?a/ap?te?esµa (outputs)
  • t? ??e?a?eta? ?a ???e?

5
?? e??a? a??????µ???
  • ??at?p?s? t?? d?ad??as?a? µetas??µat?sµ?? t??
    ded?µ???? st? ap?t??esµa
  • ??f???eta? se ?e?d????ssa (pseudocode)

6
S?ed??sµ?? ???????µ??
  • Stad?a?? ????pt??s? (Stepwise Refinement) ?a??
    p??? ?at? (top-down design)
  • ?? p??ß??µa stad?a?? d?asp??eta? se ??a a???µ?
    ap???ste??? ?p?p??ß??µ?t??
  • ? stad?a?? d??spas? (e???pt??s?) s??e???eta?
    µ????? ?t?? ft?s??µe se at?µ??? ?p?p??ß??µata
    (?p?p??ß??µata p?? de? e??a? ??????/d??at? ?a
    d?aspas???? pe?a?t???)
  • ?pa???e?s?/????????s?

7
???spas? se ?p?p??ß??µata
?
8
??aspas? ??e??????e?...
  • A????t?? s?ed?asµ??(modular design)
  • ?fa??et???t?ta (abstraction)
  • ??a????sµ?? a??µesa st? t? ?a? t? p??
  • ??at?p?s? d?epaf?? (interface)
  • ?a??????? a??pt??? (parallel development)
  • ?pa?a???s?µ?p???s? (reuse)
  • ?pa???e?s?/????????s?

9
??epaf??/??as??d?se??
  • ?pa?te?ta? ???sµ?? d?epaf??
  • pa?aµet???? p?? pa???e?/ep?st?efe?
  • ?e?t???????t?ta (t? ?a?e?)
  • sfa????e? µetaß??te? p?? ep??ea???ta? ap? t??
    d?ad??as?a (side-effects)

10
?fa??et???t?ta
  • ??a???ß?s? t?? t? ???eta? ????? t?? ???s? t?? p??
    ???eta?
  • ? d?ad??as?a p????aµµat?sµ?? ap?te?e?ta? ap?
    s?ed?asµ? ??se?? se d??f??a ep?peda
    afa??et???t?ta?
  • ???s??? t? t? ?ap?te s?µpe???aµßa?e?
    pe?????sµ??? (p??? ?a???)

11
?fa??et???t?ta ?e??d?????a?
  • 1. ???sµ?? p??ß??µat??
  • 2. ??a??s?? p??ß??µat??
  • 3. S?ed?as? a??????µ??
  • 4. ???p???s? a??????µ?? se p????aµµa
  • 5. ????µ? ? epa???e?s? t?? ????????µ????
    p?????µµat?? (ap?sfa?µat?s? 1-2-3-4)
  • 6. S??t???s? ? e??µ???s? t?? p?????µµat??

??e?a?t?ta G??ssa?
12
?fa??et???t?ta ???????µ??
  • ?? e??a? ? a??????µ?? ??? p?? ?a ???p????e?

???????µ??
...
Java
C
Fortran
13
?p?peda ?fa??et???t?ta?
  • ?fa??et???t?ta ?????aµµat?? ?? ?a?e? e?a
    p????aµa ??? p?? t? ?a?e? (d?ad??as?e?
    /s??a?t?se??)
  • ?fa??et???t?ta ?ed?µe??? ?? e??a? ta ded?µe?a
    µ?a? d?µ??/t?p?? ??? p?? e??a? ???a??µe?a
    (d?µ??/af???µ???? t?p??)
  • ?fa??et???t?ta ??t???? ?? ?a?e? µ?a e?t??? ???
    p?? t? ?a?e?

14
??p?? ?ed?µ????
  • ?p??? ??p?? a???µ??, ?a?a?t??e?
  • S???et?? ??p?? p??a?e?, d?µe?, ??ste?
  • ?f???µe??? t?p?? (abstract data types)
  • ?d?af??e?a ?? p??? t?? ???p???s? t???
  • ??epaf? d?aµ?s?? s??a?t?se?? p??sßas??
  • S???e???µe??? d?afa?e?a ?a? aµes? p??sßas?

15
?a??de??µa
  • G?a?te e?a p????aµµa p?? ?p??????e? t? eµßad?
    e??? ??????????. ?? ????????? ????eta? µe d??
    a???µ??? t? µ???? ?a? t? p?at?? (se µet?a). ??
    eµßad? ?p??????eta? ?? µ???? x p?at??. ?.?. ea?
    t? µ???? e??a? 10 µet?a ?a? t? p?at?? 5 µet?a
    t?te t? eµßad? e??a? 50 tet?a?????a µet?a.

16
??a??s??
  • ?ed?µe?a e??a? d?? p?a?µat???? a???µ?? (µ???? ?a?
    p?at??)
  • ?p?te?esµa e??a? e?a? p?a?µat???? a???µ?? (t?
    eµßad? to? ?????????? p?? ????eta? ap? ta
    ded?µe?a)

17
???????µ??
  • ??aßase ta ded?µe?a
  • ?p?????se t? eµßad?
  • ??a???? ap?te?esµat??

18
???????µ??
  • d?aßase_ded?µe?a(µ????,p?at??)
  • a????sµa?p?????se_eµßad?(µ????,p?at??)
  • e?a????_ap?te?esµat??(µ????,p?at?? eµßad?)

19
???ßase ?ed?µ??a
  • Interface
  • ??aßa?e? ?a? ep?st?efe? d?? t?µe? µ???? ?a?
    p?at?? (µ??ada µet??se?? µet??)
  • Functionality
  • ??aßase
  • µ????
  • p?at??
  • e?e??e a? e??a? ?et??a

20
?p?????se ?µßad?
  • Interface
  • ?a???e? d?? pa?aµet???? (µ???? ?a? p?at??)
  • ?p?st?efe? eµßad?
  • Functionality
  • ?p??????e? eµßad?
  • eµßad? µ???? x p?at??

21
??a???? ?p?te??sµat??
  • Interface
  • ?a???e? t?e?? pa?aµet???? (µ????, p?at?? ?a?
    eµßad?)
  • Functionality
  • e?a?e? t? ap?te?esµa

22
???????µ??
???ß??µa
??sa?.
??a???.
?p????.
??e????
µ???? p?at??
eµßad?
?µßad? µ???? x p?at??
23
?e?a?t??? ????pt??s? ??sa?????
  • get(µ????) /d?aßase µ????/
  • get(p?at??) /d?aßase p?at??/
  • /e?e???? µ????/
  • if (µ????lt0) print(?a??? µ????) exit
  • /e?e???? p?at??/
  • if (p?at??lt0)print(?a??? p?at??) exit

24
???p???s?
  • ?p?t???? ???p???s? e??pa???e? ???s? ???ssa?
    p????aµµat?sµ??
  • s??ta??
  • s?µµas?????a

25
/program that computes the area of a rectangle
(use of procedures) inputs length, width in
meters outputs area in square
meters/ include ltstdio.hgt void
get_data_check(float length, float width
) float compute_area(float length, float width
) void display_sum(float length, float width,
float area) main() /orismos
metavlitwn/ float length, width
/input variables/ float area
/holds
area/ / diabase dedomena/elegxos/ get_data_
check(length, width ) / ypologismos/
area compute_area(length, width ) /
ejagwgh/ display_area(length, width , area)
26
/function that reads program input
data/ void get_data_check(float length, float
width ) printf(Enter length in meters
) scanf(f,length) printf(Enter width in
meters) scanf(f,width) if (lengthlt0)
printf(error length should be
positive\n) exit(0) if (widthlt0)
printf(error width should be
positive\n) exit(0)
27
/function that computes the area of a
rectanlge/ float compute_area(float length,
float width ) float area
/holds area/ area length
width /compute area/ return area

28
/function that displays the output of the
program/ void display_area(float length, float
width, float area) printf(The area of a
rectangle with f m length and f m width is f
sq. m.\n, length, width, area)
29
???p???s?
  • ???s?µ?p???s? ???µat?? p?? ß?????? st?? e?????
    e?µ??e?a t?? ??d??a
  • ??????d?aßast?? ??d??a?
  • ?e?µ????s? s????a st?? ??d??a

30
????µ?/?pa???e?s?
  • ?eta???t?sµ?? p.?.
  • gtcc foo.c -o foo
  • pa?a?e?
  • t?? a?t??e?µe???? ??d??a (µp??e? ????)
  • e?te?este (t?e?te) p????aµµa
  • eµpe????? epa???e?s?(µe?e??? 1,0, ???a a??a)
  • ?a?? (s??ta?t??a)
  • d?????s? ??d??a

31
??t??es??
  • gtfoo
  • Enter length in meters 17
  • Enter width in meters 2
  • The area of a rectange with 17 m length and 2 m
    width is 34 sq.m
  • gtfoo
  • Enter length in meters -0.5
  • Enter width in meters 12
  • error length should be positive
  • gt

32
??ßas? ??t??es??
  • ??e?e? ???a
  • p??? ??a?a - a??a µe epa???e?s?
  • ?pa???e?s? eµpe????a, a?a??t??a
  • ????????s? ??se??
  • ?a??t?ta, a????? se µ??µ?
  • ??a??t????/?µpe?????? ????d??

33
??ßas? ??t??es??
  • ??e?e? µa pa?a?e? ?a??? ap?te?esµata ? t?e?e?
    µe????? (crashes)
  • ap?sfa?µat?s? (µp??e? ?a sa? ß????se? ?a
    ße?t??sete t?? ??s? sa?)

34
???t??a ?????aµµat?sµ??
  • ??ad??as?a?? ? ???sta?t??? e?t???/ d?ad??as?a,
    p.?. C, Pascal, Modula-2
  • ??t??e?µe??st?ef?? a?t??e?µe??/e?d?pe??ß??µa-???
    ????µ???t?ta, p.?. C, Smalltalk, Java
  • S??a?t?s?a?? s????t?s?/ap?t?µ?s? e?f??se??,
    p.?. Miranda, ML
  • ?????? s??s?/µ??a??sµ?? s??epa?????, p.?. Prolog

35
???sta?t???? ??a?t? ????t???? G??sse?
  • ????t???? ???sse? ????? ?????te?? afa??et???t?ta.
    ?e? ?p???e? ? ?????a t?? ap????e?s?? se s??s? µe
    a?t?? t?? ???sse? ?a? ep?µ???? t?? te?est?
    a???es?? t?µ?? (assignment operator).
  • Ta ???s?µ?p???s??µe C (d?ad??as?a??)

36
??ad??as?a?? ???t???
  • ?e?t???? ?????a ? e?t??? ? p??sta??
  • ? ?????a t?? d?ad??as?a? pa???e? t? ßas???
    µ??a??sµ? ??a afa??et???t?ta
  • ? ??? e?????? (control flow) e??a? a???????a???
    µ??f??
  • ?p???e? ? ?????a t?? ap????e?s??
  • ?etaß??t?? ????? d?e????s? (???? µ??µ??), t?p?
    ?a? t?µ? p.?. int x 123456

37
??ad??as?a?? ???t???
  • ?p???e? ? ?????a t?? ap????e?s??
  • ?etaß??t?? ????? d?e????s? (???? µ??µ??), t?p?
    ?a? t?µ? p.?.
  • int x 123456

e?ds
0 1 2 ... 1021 ...
123
err12
123456
d?e????s? (s?µß?????)
t?p??
t?µ?
Write a Comment
User Comments (0)
About PowerShow.com