0% found this document useful (0 votes)
3 views22 pages

Download

The document discusses key theoretical topics in computer science, focusing on abstraction and decomposition in problem-solving, as well as the program development life cycle. It outlines the processes, benefits, and examples of abstraction and decomposition, and details the stages of the program development life cycle, including analysis, design, coding, testing, and maintenance. Additionally, it compares different development life cycles such as Waterfall, Iterative, and Rapid Application Development (RAD), highlighting their principles, benefits, and drawbacks.

Uploaded by

saqibkbty741
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
3 views22 pages

Download

The document discusses key theoretical topics in computer science, focusing on abstraction and decomposition in problem-solving, as well as the program development life cycle. It outlines the processes, benefits, and examples of abstraction and decomposition, and details the stages of the program development life cycle, including analysis, design, coding, testing, and maintenance. Additionally, it compares different development life cycles such as Waterfall, Iterative, and Rapid Application Development (RAD), highlighting their principles, benefits, and drawbacks.

Uploaded by

saqibkbty741
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
AS Level Paper 2 - Theoretical Topics 1 - Abstraction & Decomposition Process of Abstraction: © Itis used to filter out information/data that is not necessary for a task. © It involves removing unnecessary details from the problem. Benefits of Abstraction: 1. The solution is simplified so easier/quicker to design/implement. 2. The system is tailored to the need of the user. Decomposition: © It breaks down problems into sub-problems/sub-tasks leading to the concept of a program module (procedure/function). ‘Type of Program Module that should be used to return a value: * Function Type of Program Module that should be used when not returning a value: * Procedure Process of Decomposition // Problem Decomposition: * It breaks the problem/algorithm (not program/code) into sub-tasks/sub-problems repeatedly until all sub-problems are small/detailed enough to solve. * It is used to identify program modules/repeated elements where each sub-task can be implemented by a program module. * It is used to identify subroutines. Benefits of Decomposition to break down the complex problems into sub-problems: Breaking a complex problem down makes it easier to understand/solve. Smaller problems are easier to program/test/maintain. Sub-problems can be given to different teams/programmers with different expertise Sub-problems can be solved separately. Awe @ 0335-1400368 © @gilanihaseeb 8 Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics Why are problems broken down into modules // Why is it a good practice to construct the program using modules // Advantages of decomposing the program into modules // Advantages of using program modules in program design: 1. 7. It allows the module to be called from many/multiple places (encourages the re-usability of program code) The module code can be independently tested and debugged once and can then be used repeatedly. If the module task changes the change needs to be made only once. . It reduces unnecessary code duplication. It allows modules to be shared among many programmers/given to programmers with specific skills. It makes the program easier to work on/debug/test/maintain as each module can be tested separately. It makes the program easier to solve/implement/manage. Benefits of using Sub-Tasks/Sub-Problems: 1 2. 3, The sub-tasks make the solution more manageable/makes the algorithm easier to follow. A sub-task makes the problem easier to solve/design than the whole task. ‘A sub-task is useful when a part of the algorithm is repeated Component Parts of a problem after it has been Decomposed: 1. 2 3 4, Inputs — what is put into the system . . Processes — actions taken to achieve a result. Outputs - what is taken out of the system, Storage - what needs to be kept for future use. @ 0335-1400368 © @gilanihaseeb 8 Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics Example 1: A system is being developed to manage book loans in a library. Registered users may borrow books from the library for a period of time. i) Three items of data that must be stored for each loan: 1. User ID / Username 2. Book ID 3. Date of loan/return date ii) Item of data that will be required in the library system but does not need to be stored for each loan: 1. Users name / address / phone number / DOB 2. Book title / author / publisher / ISBN number / price 3. The length of the loan iii) Operations that manipulates the data stored for each loan: List of all overdue books Create loan / borrow book Return book |. View the loan history for a given book . View the loan history for a given user wewne Example 2: The manager of a cinema wants a program to allow users to book seats. The cinema has several screens, Each screen shows a different film. i) Program modules that could be used in the design (through decomposition): 1. Allows the user to search for films being shown // input name of film they want to see 2. Allows the user to search for available seats 3. Calculate cost of booking 4. Book a given number of seats for a particular screening @ 0335-1400368 © @gilanihaseeb 8 Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics Example 3: An airline wants to provide passengers with information about individual flights and allow them to book their flight using an online booking system. i) Tick one box in each row of the table to indicate whether each item of information would be essential for the customer when making the booking: Information Essential Not essential Departure time v Flight number v Departure airport v Aircraft type v Ticket price v Number of seats in aircraft v ii) Additional pieces of essential information that a passenger might need when booking a 1. Destination / arrival airport 2. Arrival time / flight duration 3. Date of flight 4, Seat number 5. Seat availability @ 0335-1400368 © @gilanihaseeb 8 Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics Example 4: A system is being developed to help manage a car hire business. A customer may hire a car for a number of days. An abstract model needs to be produced. i) Items of data that should be stored each time a car is hired: Car details: ID, Car Registration, car type etc. Customer details: ID, name, address, license details etc. Start date of hire Return date / Number of days of hire Cost of hire awe ou ii) Operations that would be required to process the car hire data: Input customer details Input car details Input payment details Create hire / start hire Return car / end hire Change / check car status (hired/available/written-off) Cancel hire Process payment / calculate hire cost ONONAWHSA Example 5: A program is being designed for a smartphone to allow users to send money to the charity of their choice. Decomposition will be used to break the problem down into sub-problems. i) Program modules that could be used in the design and description of their use: SelectCharity () — Allows the user to choose a particular charity. SpecifyAm AndType () — Allows the user to specify a single or regular payment. MakePayment () —Make payment to the charity validatePayment () — Validate payment details (by accessing bank computer) AddBankAccountDetails() / AddPaymentDetails() — Allows the user to add bank account information from which donation will be taken. AddDonorDetails () — Allows user to add details such as name and contact details. wawne 2 @ 0335-1400368 © @gilanihaseeb 8 Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics 2 - Program Development Life Cycle Stages in a Program Development Life Cycle: 1* Stage - Analysis/Problem Definition: Identify the problem and its requirements. 24 Stage - Design: The details of a solution are set out (develop an algorithm to solve the problem using structure diagrams, flowcharts or pseudocode). 3" Stage - Coding/Programming/Implementation: The program is developed (write and implement the instructions to solve the problem), 4" Stage - Testing: The program is tested for errors (detect and fix the errors in the program), 5" Stage - Maintenance: ‘The program is updated and corrected for changed conditions and users may find bugs and errors that were missed in the earlier testing phase. Benefits of using a Program Development Life Cycle: ‘The development life cycle is used to split the development of a website/application into several stages: 1. It makes it easier to plan the project. 2. It makes it easier to manage the costs of the project 3. The clear deliverables are produced at end of each stage of development life cycle. Program Development Life Cycle activities with reference to editor, translator & debugger: Editor: * An editor is used to produce/write/modify the source code/high-level language code * Aneditor provides features such as context-sensitive prompts/dynamic syntax checking etc. Translator: * A translator (compiler) is used to translate/convert the source code into object code/machine code/executable file * A translator (interpreter) is used to translate the source code line by line. @ 0335-1400368 © @gilanihaseeb 8 Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics Debugger: * A debugger is used to test the program. * Adebugger is used to detect errors and correct errors in the program. Program Development Life Cycle activities with reference to source code, object code & corrective maintenance: Source Code: © The source code represents a solution/design/algorithm expressed in a high-level language. Object Code: * The Object code is produced by the compiler during the translation stage. * The Object code is produced by translating the source code Corrective Maintenance: © The corrective maintenance occurs when testing reveals a fault or error in the program and this is corrected OR the corrective maintenance is when errors are found and fixed OR the corrective maintenance is when a program is debugged. Diagram for showing the Stages of the Program Development Cycle (arrows indicate how the stages are linked) @ 0335-1400368 © @gilanihaseeb 8 Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics Tasks/Activities performed during Analysis Stage: |. Abstraction . Decomposition of the problem (problem definition) Identification of the problem (problem investigation) Identification of the requirement specifications Feasibility study wewne *For more clarity on Abstraction & Decomposition, refer to previous pages of their chapter! Tasks/Acti ities performed during Design Stage: Create/produce/define data structures/data types . Create/produce/define identifier table |. Decomposing the problem into sub-problems . Create algorithms/pseudocode/flowchart Create structure charts Create/produce/define test plan/strategy Use of library routines/program structure (modules) 3. Identify inputs/outputs/processes ). Choose a suitable programming language/program environment wPenavnaune Different ways that the Design of a solution to a problem can be presented: 1. Structure diagram/chart 2. Flowchart 3. Pseudocode Tasks/Activities performed during Coding Stage: Write program code/coding the algorithms from design Iterative testing (initial debugging/testing) }. Define data structures . Use a translator to check and run the code awne The stage of the program development cycle where a syntax error may occur: * Coding/Implementation/Programming Stage @ 0335-1400368 © @gilanihaseeb eo Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics Tasks/Activities performed during Testing Stage: Testing program code with use of different test data Producing a trace table Designing test case Setting up test environment Integration testing Performance testing Error reporting and tracking Performance monitoring Test summary and reporting ypOEnanawna Tasks/Activities performed during Maintenance Stage: Program is updated and corrected for changed conditions (software updates) Finding bugs and errors that were missed in the earlier testing phase Provide ongoing support to end-users Analyze and optimize the performance of the software yawn Perform database maintenance tasks, including data cleanup, optimization, and ensuring data integrity. Update documentation, including user manuals, technical documentation and etc. Test the software for compatibility with new operating systems or browsers Analyze user feedback to identify areas for improvement Regularly test backup and recovery procedures to ensure that data can be restored in the event of a system failure pone Example table for Activity and their corresponding Life Cycle stage: Activity Life cycle stage An identifier table is produced. Design Syntax errors can occur. Coding The developer discusses the program requirements with the customer. Analysis A trace table is produced, Testing @ 0335-1400368 © @gilanihaseeb eo Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics Development Life Cycles: * There is 2 need for different development life cycles depending on the program being developed. Examples: Waterfall, Iterative and Rapid Application Development (RAD). 1) Waterfall Life Cycle: Diagram for Waterfall Model of Program Development Life Cycle = Meaning of Downward Arrows: * The result from one stage is input/passed to the next stage. Meaning of Upward Arrows: * More work is required at a previous stage to complete the current stage. @ 0335-1400368 © @gilanihaseeb eo Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics i) Principles: © Itis linear as each stage is completed before the next is begun. © Itis well documented as full documentation is completed at every stage. © It requires low client involvement (only involved at the start and end of the process) ii) Benefits: 1. It is easier to estimate cost and time required to complete project. 2. It is easier to manage, understand and use. 3. The stages do not overlap and are completed one at a time and each stage has specific deliverables. It is fully documented. There is no need for client availability throughout life cycle. 6. It works well for smaller programs where requirements are known and understood. i) Drawbacks: It results in slower development as one stage can be worked on at a time. we It does not allow the creation of early versions/prototypes. It is difficult to change the requirements at a later stage. It does not allow early review as there is no cooperation between client and developers. It is not suitable for programs where the requirements could be subject to change. The working program is produced late in the life cycle. It is not suitable for long, complex projects Nowpune 2) Iterative Life Cycle: i) Principles: * Itisincremental development as the program development lifecycle is repeated * The working programs are produced for part of the system at every iteration. * Itallows for changes to requirements. * Ithas a flexible development process. © The clientis involved during all stages of development. ii) Benefit: 1. It allows for quicker development as some working programs are developed quickly at an early stage in the lifecycle. 2. Itis easier to test and debug smaller programs. It is easier to change requirements It makes early review possible as there is closer cooperation between client and developers at each iteration. aw @ 0335-1400368 © @gilanihaseeb eo Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics Drawbacks: 1. The whole system needs to be defined at start, so it can be broken down into pieces to be developed at each iteration. 2. It needs good planning overall and for every stage. 3. It is not suitable for short simple projects. 3) Rapid Application Development (RAD) Life Cycle: i) Principles: * The modules are developed in parallel/modules are developed as prototypes. * Minimal planning is carried out (no detailed planning) © Itallows for changes to requirements. © Ithas a flexible development process. © The small incremental releases are made, each adding functionality. * Its used for time critical development. © The clientis involved during all stages of development i) Benefit: 1. It allows for quicker development as multiple areas can be worked on at the same time. 2. The prototype is produced at early stage in process. 3. It is easier to change requirements/allows for quicker delivery of usable modules. 4. It makes early review possible as there is closer cooperation between client and developers Drawbacks: It is difficult to estimate cost and time required to complete project. The documentation is often omitted. There is lack of client availability throughout life cycle. It is too easy for client to keep changing their mind. It needs strong teams of skilled developers. Itis not suitable for short simple projects aueune @ 0335-1400368 © @gilanihaseeb 8 Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics Example 1: Several companies are developing websites to market a new type of games console. The company that is first to create a website that can demonstrate the interactive features of the games console will have an advantage over the others. The requirements for the website are likely to change as more information about the features of the console are made available. One company has decided to develop their website using a program development life cycled based on the Waterfall Model i) Reasons why this may not be the most appropriate model to use in this case: 1. There will be no working software until late in the life cycle so slower to market than competitors as it does not allow the creation of early versions/prototypes (which can be updated later). 2. Itis more difficult/slower to cope with changes to the requirements//website will be slower to be updated to refiect new requirements. 3. It needs high involvement/feedback of the stakeholders/customer/client. ii) More appropriate program development life cycle model for this scenario: * Iterative or Rapid Application Development (RAD) Example 2: A software company is working on a project to develop a website for a client. The client has some ideas about the appearance of a website but is unclear about all the details of the solution. The client would like to see an initial version of the website. i) Suitable Life Cycle Method: * Iterative OR Rapid Application Development (RAD) ii) Reasons why this may be suitable: * It provides a working model/prototype at an early stage for the client to approve/review. @ 0335-1400368 © @gilanihaseeb 8 Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics 3 - Program Testing & Errors Program Fault: * A program fault is when the program does not do what itis supposed to do/expected to do under certain circumstances. Ways to minimize the risk of faults when writing programs: * It can be minimized by using tried and tested library subroutines/codes * It can be minimized by using modular programming techniques (to break the problem down and make it easier to solve). * It can be minimized by using good programming practices 1. Good formatting to make the code easier to read (indentation, white space) 2. Use of sensible variable names 3, Use of comments to explain functionality of code 4, Use of local variables 5. Use of constants * It can be minimized by using IDE features (parameter type-checking, auto-complete etc.) Types of Errors: 1) Syntax Errors 2) Logic Errors 3) Run-Time Errors Methods to find an Error (in a program that runs but does not give the expected output): i) Dry run the code // use of white box testing // trace tables: * Trace the contents of variables // trace all possible routes through the program. ii) Breakpoints: © Run the code to a set point to find error. ) Variable watch: * Check the contents of variables at specific points in the program iv) Stepping: * Execute the code line by line. @ 0335-1400368 © @gilanihaseeb 8 Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics v) Include OUTPUT statements in the code: * To display the value of variables as the code is running A program is compiled without producing any errors. Types of error that the program could still contain: 1. Logical Error 2. Run-time Error Techniques that may be used to identify these two types of errors: 1. White-box testing // use of suitable test data 2. Dry-run / use of a trace table 3. IDE features such as breakpoints, stepping, watch windows ete. 1) Syntax Errors: * An error in the grammar of the programming language. * An error/construct/statement that breaks the rules of the programming language. Meaning of “the program does not contain any syntax errors”: © The program obeys the rules/grammar of the programming language used. © The program will run and it can be compiled/interpreted. * Examples include ‘no mis-spelt keywords, ‘all brackets match’ etc. 2) Logic Errors: * Anerror in the logic of the algorithm/design of the solution that causes the program not to behave/perform as intended/expected. * It does not give expected results. * Examples include wrong arithmetic operator used or wrong loop count. How single stepping may be used to help find a logic error in a program: © It executes a line of code at a time. © Itis used to trace the path of execution (sequence) © Its used to track variable values using a watch window. 3) Run-Time Errors: © The program performs/executes an invalid operation/instruction such as tries/attempts to divide by zero. © The program enters an infinite loop or stops unexpectedly (program crashes). * Examples include divide by zero or endless loop or simply ‘crashes'/freezes. @ 0335-1400368 © @gilanihaseeb eo Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics Why a run-time error may occur: 1. Division by zero . Array out of bounds . File does not exist Stack overflow Memory leakage Hardware fault/failure anawn Reasons why a software may not perform as expected (excluding Syntax error): . Logic error //it is programmed incorrectly. There was an error in the design // the correct requirements were not stated. Run-time error // division by 0 // stack overflow // end of file reached // library not available The software is not adequately/correctly tested. pwns Methods of Testing: 1) Dry Run 2) Walkthrough 3) White-Box 4) Black-Box 5) Integration 6) Alpha 7) Beta 8) Acceptance 9) Stub 1) Dry Run: © It is a method in which the developer works through a program or module from a program manually and documents the results using a trace table. 2) Walkthrough Testing Method: * The program is checked by creating trace table / going through the program a line at a time to record/check variable values as they change. © The error may be indicated when variable given an unexpected value. © The error may be indicated by an unexpected path through the program // faults in the logic of the program can be detected. @ 0335-1400368 © @gilanihaseeb oe Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics 3) White-Box Testing: It is used to test every path through the algorithm/code. It includes the use of a trace table * The data is chosen to test every possible path through algorithm/code. + It involves testing every path in the code. * Each line of code/structure is tested. © The internal structure is being tested. © The tester can view the code. A programmer chooses data to test each path through the program. Type of testing that the programmer has decided to perform: 1) White-box testing 2) Dry-tun testing / use of trace table / walk through method 4) Black-Box Testing: It can find/reveal errors such as syntax error, logical error, or a run-time error if an algorithm is incorrect and program produces unexpected result/performs incorrect calculation. The data is chosen to test that the program does what it is supposed to do/to check that the results are as expected. * The code is unknown/not considered * The data is chosen to test boundaries (test with normal, extreme and erroneous values). * It involves comparing expected output with actual output // testing whether the inputs produce the correct/expected outputs. © Itis used for testing if the program meets the requirements. ‘Types of Test Data: 1. Normal/valid 2. Abnormal/erroneous/invalid 3. Boundary/extreme @ 0335-1400368 © @gilanihaseeb 8 Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics Table comparing White-Box & Black-Box testing methods: specification. Statement White-box | Black-box The student does not need to know the structure of the code. v The student chooses data to test every possible path through y the code. The student chooses normal, boundary and erroneous data v v The student chooses data to test that the program meets the Vv The commercial softwares usually undergoes integration testing, alpha testing, beta testing and acceptance testing: 5) Integration Testing: Itis carried out on a modular program * This testing is done by the programmers / developers / in-house testers. * The modules that have already been tested individually are combined into a single (sub) program which is then tested as a whole. * Itis used to ensure the modules work together as expected and to ensure code is ready for alpha testing 6) Alpha Testing: * This testing is done by the programmers / developers / in-house testers. * Its done near the end of development // program is nearly fully-usable // after integration and before beta. * It is used to find errors not found in earlier testing and to ensure code is ready for beta testing. @ 0335-1400368 © @gilanihaseeb eo Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics 7) Beta Testing: It is an additional test stage that may be cartied out before a program is sold to the public. + The testing is carried out by a small group of potential users. * Itis done before general release of software // after passing Alpha testing. + The users will check that the software works as required/works in the real world/does not contain errors. © The users will feedback problems/suggestions for improvement * The problems/suggestions identified are addressed (before the program is sold). 8) Acceptance Testing: * This testing is done by the end user // user of the software. It is done when the software is finished / installed. It is used to ensure the software is what the client ordered // to check that the software meets the user requirements. Table comparing Integration, Acceptance, Alpha & Beta testing methods: Statement Integration | Acceptance | Alpha | Beta Software is tested in-house by dedicated testers, v v Software is tested by the client before it is signed-of. Software is tested by combining all modules that have previously been v tested to check they work as expected. Software is tested using normal, abnormal and boundary data Software is tested by releasing it to selected customers, who test it in normal circumstances @ 0335-1400368 © @gilanihaseeb 8 Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics Example 1: The different independent modules now need to be combined to create the final system. i) Type of testing required at this stage: + Integration ii) Final testing stage required before the system becomes operational: * Beta OR Acceptance Example 2: The independent modules are combined to create the final program. Testing is performed to make sure they interact correctly. i) Type of testing: * Integration testing Testing is performed to prove to the customer that the system works correctly and meets the requirements specified in the design. ii) Type of testing: * Acceptance testing Example 3: Test plans are used when testing data. One item that would be included in a test plan is example test data. i) Other items that would appear in a test plan: © Test number * Type of test // type of test data * Test description * Expected outcome @ 0335-1400368 © @gilanihaseeb eo Syed Haseeb Bari Gilani CS/IT - O/A Level AS Level Paper 2 - Theoretical Topics Example 4: The following table contains definitions related to testing terminology. Completion of the table with the correct testing term to match the definition. Definition Term Alpha testing/black- Software is tested by an in-house team of dedicated testers. boxhahite bos Software is tested by the customer before it is signed off. Acceptance testing Software is tested by a small selection of users before Beta testin: general release. ‘9 9) Stub Testing: It is often used in the development of the modular programs. It is used (during development) to test a program consisting of several functions/modules. It is used to test the main program before the modules of a program are completed/developed (not ready for full testing). * Assimple module/code is written to temporarily replace each of the called modules known as module stubs. * The module stubs will return an expected value/provide a known response. © Itwill output a message to confirm the module has been called and return a fixed value Example 5: A developer wants to start testing the program before all the subroutines (procedures and functions) have been implemented. i) The type of testing would be: © Stub Testing ii) The program contains a function status ()that has not been written yet, but will be in the program. Explanation of what developer needs to do to called from several places wi allow the program to be tested: © Asimplified version of status () is written / a dummy function is written. © The simplified/dummy function returns a typical/expected value. @ 0335-1400368 © @gilanihaseeb eo Syed Haseeb Bari Gilani CS/IT - O/A Level

You might also like