Προγραμματισμός και Τεχνολογία Λογισμικού Programming and Software Engineering

  • View
    39

  • Download
    0

Embed Size (px)

DESCRIPTION

Programming and Software Engineering . , 25 2007. . . - PowerPoint PPT Presentation

Transcript

  • Programming andSoftware Engineering

    , 25 2007

  • ... .... productivity = average; : ??(LOC/day)

  • ... : SuperSoftware SA (300 empl), CMM level = 1 8:00 .. Boss -> Bob (programmer): " "Bob . hmm ( 10 )Bob .. 1 , , 1 testing, meetings, , , , (1 )Bob -> Boss: " "Boss: OK !!!

  • ... 5 (3 )

  • ... 10:00 : meetings, , compiling, debugging, , ....., . Boss Bob !!!

  • ... : Boss: " , .Bob: , Boss ??Bob: boolean DrawColoredShape. true: , false: .

  • ... Bob: ..hmmm, interface Bob:..Aha, (global) !!!DrawColoredShapeProgram1Program2

    Laptop

  • ... false true Bob !!!// remember to reset the flag

  • ... : o Boss ( boss ), " "Bob: . !!! . Anyway. !!!

  • ... // remember to reset the flags Bob !!!

  • ... . ( Bob !!) : ! "" .

  • ... (axis of change) , - (Open-Closed Principle) : ......

  • Software Engineering

  • ... , ,

  • ...Software Engineering is:David Parnas: "the multi-person construction of multi-version software"Ghezzi: "the application of engineering to software"IEEE: "the application of a systematic, disciplined, quantifiable approach to the development, operation and maintenance of software"Roberts: "the discipline of writing programs that can be understood and maintained by others"in contrast to:"Programming is the discipline of writing programs that cannot be understood and maintained by anyone else than the author"

  • : (Multi-person, multi-version projects) :

  • Software Crisis ( 1960 ... ?)Software Hall of Shame : , 60 70 /

    YearCompanyOutcome - Costs in US $2005FBIVirtual Case File abandoned after 170 million spent2004UK RevenueSoftware errors -> 3.45 billion tax overpayment2004HPProblems with ERP system -> 160 million loss2002McDonalds CorpInformation processing system canceled after 170million spent2001Nike Inc.Problems with supply chain management -> 100 million loss2000Kmart Corp.1.4 billion IT modernization effort -> declared bankruptcy1997IRS (USA)Tax modernization effort canceled after 4 billion is spent1993London Stock ExchangeTaurus stock settlement system abandoned after 600 million spent

  • .. 1961, Mercury (NASA), FORTRANDO 10 I=1.10 ()DO 10 I=1,10 ()

  • .. 1985-1986, Therac (AECL), : Assembly !! 1996, Ariane 5 (European Space Agency) $370M: Ada 64-bit floating-point 16-bit -> ->

  • Test 1: . project manager ? .. wrong answer ! (Mythical Man-Month)Test 2: project manager ( ). ? !!Test 3: . ? !!! ?

  • (Software Product)

  • DocsCodeERICSSONUNIVERSITIES

  • ? ( ) !! :50% - managers (, , )

  • -

  • ? !! : (corrective maintenance) (adaptive maintenance) (perfective maintenance)

  • / ()

  • ( ) : ()

  • ( ) : ()

  • ( ) : ()

  • ( ) : ()

  • , ! "" :

  • "" : (Rigidity): (Fragility): . (Immobility): . (Viscosity): . (Needless Complexity): ( ) . (Needless Repetition): . (Opacity): ( ).

  • : (coupling): - (cohesion):

  • void functionA() { int x; . . . x = functionB(); . . .}int functionB() { int z; z = . . .; return z;}functionAfunctionB

  • : () ()

  • : GGOTO G1G1 : G H ( assembly, Basic, Cobol)

  • (.. ) ( ), global variables

  • flags (.. flag ) (conditional statements) : . , ( ) ( )

  • ATMvoid () { } :

  • ( )

  • 0+2 0+( )

  • C ( )

  • C ( )OUTOUTININ

  • = , 3 , 2 , 1( )

  • Fan-in, Fan-outFan-out: 4Fan-in: 1Fan-out: 3Fan-in: 2Fan-out: 0

  • Fan-in, Fan-out 1: fan-out , ( ). , ,

    2: fan-in , ,

  • (Fairley 1985) (hm & Jacopini) GOTO (OOP principle) (information hiding principle) ()

  • (Fairley 1985) 5 25 , , , , .. printf(%d, func1(s*3*func2(4*s))); static: ( ) ( static) ( )

  • (Fairley 1985) Dont be too smart ( ) shorthandsint i=0;int x = i++; //x = 0

  • (Fairley 1985) smart programming: macros#include #define max(a,b) ( (a) > (b) ? (a) : (b) )void main(){int c=5,d=7;int x = max(++c, ++d);printf("%d",x);} ?9 !!!#include #define add(a,b) ( (a) + (b) )void main(){int c=5,d=7;printf(sum= %d",add(c,d));}

  • .... C ?z = y+++x; O :z = y + ++x;z = y++ + x; C maximal munch strategy. (token) . :z = y++ + x;

  • .... :z = y+++++x; :z = y++ ++ + x; compilation error ++ - error C2105: '++' needs l-value

  • Obfuscated C Code Contest (Brian Westley, 1988)

    #include #define _ -F

  • Obfuscated C Code Contest ....

    m(f,a,s)char*s;{char c;return f&1?a!=*s++?m(f,a,s):s[11]:f&2?a!=*s++?1+m(f,a,s):1:f&4?a--? putchar(*s),m(f,a,s):a:f&8?*s?m(8,32,(c=m(1,*s++,"Arjan Kenter. \no$../.\""), m(4,m(2,*s++,"POCnWAUvBVxRsoqatKJurgXYyDQbzhLwkNjdMTGeIScHFmpliZEf"),&c),s)): 65:(m(8,34,"rgeQjPruaOnDaPeWrAaPnPrCnOrPaPnPjPrCaPrPnPrPaOrvaPndeOrAnOrPnOrP\nOaPnPjPaOrPnPrPnPrPtPnPrAaPnBrnnsrnnBaPeOrCnPrOnCaPnOaPnPjPtPnAaPnPrPnPrCaPn\BrAnxrAnVePrCnBjPrOnvrCnxrAnxrAnsrOnvjPrOnUrOnornnsrnnorOtCnCjPrCtPnCrnnirWtP\nCjPrCaPnOtPrCnErAnOjPrOnvtPnnrCnNrnnRePjPrPtnrUnnrntPnbtPrAaPnCrnnOrPjPrRtPn\CaPrWtCnKtPnOtPrBnCjPronCaPrVtPnOtOnAtnrxaPnCjPrqnnaPrtaOrsaPnCtPjPratPnnaPrA\aPnAaPtPnnaPrvaPnnjPrKtPnWaOrWtOnnaPnWaPrCaPnntOjPrrtOnWanrOtPnCaPnBtCjPrYtOn\UaOrPnVjPrwtnnxjPrMnBjPrTnUjP"),0);}

    main(){return m(0,75,"mIWltouQJGsBniKYvTxODAfbUcFzSpMwNCHEgrdLaPkyVRjXeqZh");}

  • Obfuscated C Code Contest

  • ( . Amdahl :

  • Amdahl E F S (.. 100 10 secs10 x2 , S=2)

  • Amdahl1.05

  • Amdahl floating point ( 2x) 10% .

  • C1. main() { int x = 5;

    setToZero(x);

    printf("x = %d\n", x);

    }

    x = 5void setToZero(int x) { x = 0;

    }

  • C2. break switchint x = 2;switch(x) {case 2: printf("Two\n");case 3: printf("Three\n");}

    TwoThree

  • C3. = == . if ( 6 = x) int x = 5;if ( x = 6) printf(x equals 6\n); x equals 6

  • C4. main() { int A[5]; int i;

    for(i=0; i

  • C5. ( ):double half = 1.0 / 2;double half = 1/2;half = 0;

  • C6. int x = 5; while( x > 0 ); x--;int x = 5; while( x > 0 ) ; x--;int x = 5; while( x > 0 ) _; x--;

  • CRunTime Error (General Protection Fault)7. #include int main(){ char* st;

    strcpy(st, "abc"); return 0;}

    char st[20];char* st = malloc(20);

  • C8. == ( o st1 st2). string.hif (strcomp(st1, st2) == 0)char st1[] = "abc"; char st2[] = "abc"; if ( st1 == st2 ) printf("Yes"); else printf("No");

  • C text 9. H scanf() , buffer \n.H fgets() buffer \n .: int x; char st[31]; printf("Enter an integer: "); scanf("%d", &x); printf("Enter a line of text: "); fgets(st, 30, stdin);

  • C10. gets(). !!! string buffer overflow Internet gets() /* gets example ( string stdin) */#include

    main(){ char string [20]; printf ("Insert your full address: "); gets (string); printf ("Your address is: %s\n",string);}

  • C gets() Internet Worm 1988 Cornell Univ. : PC_A: finger string PC_B PC_B: finger PC_B: gets() string PC_B: string PC_B: PC_B: (shell) PC_B: PC_xx: repeat until sent to prison

  • Reviews - Inspections IBM 1972 , IEEE: , ,

  • - Reviews reviews inspections: , . . ,

  • Review Process : (Moderator) (Author) (Reviewers Inspectors) (Record keeper)

  • Review Process , project manager ( entry criteria, .. )

  • Review Process ( , , , checklists)

  • Review Process , , , , checklists

  • Checklists ( ) (http://www.processimpact.com/pr_goodies.shtml): ? () ? : ? ? : ? 0 ? : if_else ? if_else switch ? ? ?

  • Checklists ( ) : ? switch ? : , reco