Introduction to Computer Programming Lecture 01 Software engineering is a field of engineering, for designing and writing programs for computers or other electronic devices. A software engineer, or programmer, writes software (or changes existing software) and compiles software using methods that improve it. Kasun@dscs.sjp.ac.lk Department of Computer Science University of Sri Jayewardanepura 2 The application of a systematic, disciplined, quantifiable approach to the development, operation, and maintenance of software. An engineering discipline that is concerned with all aspects of software production. Structure Programming Data & process centric Global data - unsecure Repeat code segments Uses Flowcharts, DFD, ER etc. for diagramming OOP Real world concepts more understandable Secure Reusable Uses Unified Modeling Language (UML) for diagramming 3 4 The main program coordinates calls to procedures and hands over appropriate data as parameters. Objects of the program interact by sending messages to each other 1
Analysis SRS To identify what to be solve Feasibility Worth while of solving Elicitation Designing SDS Large system, team work, long time, huge money Words are ambiguous, No language barrier, Quick massage, different views Coding Testing Deployment Maintenance 7 8 Analysis Designing Coding Testing Maintenance Waterfall Model Iterative Model V-Shaped Model Verification and Validation model Spiral Model Big Bang Model RAD Prototyping Agile Model 9 7/28/2017 10 7/28/2017 11 7/28/2017 12 2
13 14 15 16 17 18 3
19 20 7/28/2017 21 7/28/2017 22 DFD maps out the flow of information for any process or system. Process Datastore Dataflow External Entity 23 24 4
7/28/2017 25 Kasun@dscs.sjp.ac.lk - Faculty of Applied Sciences of USJP 26 7/28/2017 27 Kasun@dscs.sjp.ac.lk - Faculty of Applied Sciences of USJP 28 29 30 5
31 32 33 34 35 36 6
Action Stubs Condition Stubs 7/28/2017 Rules Div by 4 Conditions and Actions Rule 1 1993 Rule 2 2016 Rule 3 1900 Rule 4 2000 C1 : Year Div by 4 N Y Y Y C2 : Year Div by 100 N N Y Y N Not leap year Y Div by 100 N Y C3 : Year Div by 400 N N N Y A1 : Leap year N Y N Y...... Leap year Div by 400 N Not leap year Y Leap year 7/28/2017 37 Kasun@dscs.sjp.ac.lk - Faculty of Applied Sciences of USJP 38 39 40 41 42 7
43 44 45 46 47 48 8
49 50 51 52 53 54 9
55 56 57 58 59 60 10
61 62 Syntax Compiler can detect. Logical Incorrect logic. Compiler can t detect. Should detect by humans. Most hard to detect. Run time Memory overflows, System failures due to incorrect inputs and etc. 63 64 Black box testing. Don t see the code, check inputs & outputs. White box testing inputs, outputs and the code. Unit testing each module(function) separately. Integration testing whole system together. Acceptance testing with client. Alpha testing real data but simulated or selected environment. Beta testing real data in real environment. 65 66 11
Manual Automatic Static Code Inspection Syntax checking Dynamic Desk checking Code walkthrough Unit testing Integration testing 67 68 69 If a=0, then it is a Linear Equation Else it is a quadratic equation of one of these cases b 2 4ac Case 1 : delta=0 : One real root Case 2 : delta>0 : Two real roots Case 3 : delta<0 : Two imaginary roots ax 2 bx c 0 b x b 2 4ac 2a 70 ID Test Case Inputs Expected output Observed output 1 Linear equation 2 Two real roots 3 One real root a = 0, b = 4, c = 5 a = 1, b = -7, c = 12 a = 1, b = 2, c = 1 4 Two imaginary roots a = 1, b = 2, c = 10 X = - 0.8 X 1 = 3 X 2 = 4 X 1 = -1 X 2 = -1 X 1 = -1 + 3i X 2 = -1-3i X 7/28/2017 71 Kasun@dscs.sjp.ac.lk - Faculty of Applied Sciences of USJP 72 12
73 74 13