Abma Ce Holiday Assignment
Abma Ce Holiday Assignment
Flowcharts
This is a diagrammatic presentation of how logic flows in a program. Functions by the use of standard boxes each representing a specific task or function to be performed. Uses graphic symbols to represent different types of program operations. Perform many different processes, for example the start and end activity, the decision making, processing of files and out putting data. Every flowchart symbol observes a single entry and a single exit point. They take less time to comprehend and help to understand large and complicated processes. Flowcharts let you solve complex problems and describe complex processes by breaking them down to their component parts and actions. It identifies the individual steps of a program and avoids missing key factors regardless of its complexity It is easy to flexible and easy to prepare and also can change and evolve as your project develops and grows.
Stepwise Refinement
This refers to the designing of software from top down or from the outside in. Involves the breaking down of complex problems down into a number of simpler steps therefore easier to construct and sketch in detail. It emphasizes separating on the functionality of a program into independent interchangeable modules. Sub-algorithms can be broken into smaller potions. Refinement of the algorithm is continued until each step is sufficiently detailed. It replaces existing steps/ instructions with a new version that fills in more detail. Its desired goal is to have no interaction between modules. Several programmers can work individual programs at the same time. The code base is easier to debug, update and modify. It leads to a structured approach as a complex problem can be broken into simpler task.
QUESTION 2 {25marks}
What techniques are used to debug programs?
Debugging is the process of locating and fixing or bypassing bugs/errors in computer program code therefore there are several techniques that are used to debug programs: (a) DEBUGGING BY PRINTING This is the act of watching live or recorded trace statements or print statements that indicate the flow of execution of a process. This is sometimes called printf debugging, because it uses the printf statement which enables you to classify messages according to their severity by associating different loglevels or priorities with the messages. These statements are placed to show the flow of control and the values of key variables and the output produced may make the problem obvious or may be used to narrow down the problem location. Systems currently in use support logging status data to a file so that it provides some information about what went wrong if a program occurs. (b) REMOTE DEBUGGING This is the process of debugging a program running on a system different from the debugger. To start remote debugging, the debugger connects to a remote system over a network and once it has been connected the debugger can control the execution of the program on the remote system and retrieve information about its state. (c) POST-MORTEM DEBUGGING This is the debugging of the program after it has crashed, related techniques include various memory dump or core dump of the crashed process. The dump of the process can be obtained automatically by the system when the process has been terminated due to an unhandled exception or by a programmer inserted instruction and can also be manually by the interactive user. (d) DELTA DEBUGGING This is a method that automates the scientific method of debugging. The basic idea of a scientific method is to establish a hypothesis on why something is not working. You test this hypothesis, and you refine or reject it depending on the test outcome. It runs by search based techniques that take an input to a program that triggers a bug and making that input smaller. It also initiates random testing. (e) SAFF SQUEEZE DEBUGGING This is a technique that works by taking a failing test progressively inlining parts of it until you cant inline further without losing sight of the defect. Heres the cycle: 1. Inline a non-working method in the test 2. Place a (failing) assertion earlier in the test than the existing assertions 3. Prune away part of test that are no longer relevant 4. Repeat
Modularity is designing a system that is divided into a set of functional units (named modules) that can be composed into a larger application. Modular programming also called top-down design or stepwise refinement is a software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules such that each contains everything necessary to execute only one aspect of the desired functionality but are able to communicate with each other in a loosely coupled fashion through a well-defined interface. The principal of modularity enables you to structure the application into separate modules that can be individually developed, tested and deployed by different teams. Modules are able to enforce separation of concerns by partitioning the system and keeping a clean separation between UI and business functionality. Modularity is also designed to simplify modules, properly defined modules have a high internal cohesion and loose coupling between the modules. Modules can be developed, tested and deployed on independent schedules and by doing this you can do the following You can independently version modules You can develop and test modules in isolation You can have modules developed by different teams. Loading modules from different locations is also enabled by modularity thus a Window Presentation Foundation application might retrieve modules from the Web, from the file system or from a database. However, most of the time, the modules come from one location either there is a specific folder that contains the modules or there are in the same XAP file. Modularity also enables the loading of modules based on rules and this allows you to only load modules that are applicable for a specific role. An application might retrieve from a service the list of modules to load. A module is able to broadcast that a certain event has occurred and other modules can subscribe to those events so that they will be notified when the event occurs. Modularity also designed modules in a way that if you do not want them to directly communicate with each other you can have them communicate indirectly through a shared resource such as a database or a set of web services. QUESTION 4 (25marks) a. Construct a flowchart to input a sequence of ten numbers and to output their arithmetic mean (average) {13 marks} b. Write the psedocode as well {12 marks} Pseudo code Input number 1, a Input number 2, b Input number 3, c Input number 4, d Input number 5, e Input number 6, f Input number 7, g Input number 8, h Input number 9, i Input number 10, j Mean= a+b+c+d+e+f+g+h+i+j/10 Print mean Stop
Flowchart
Start
Input number 1 a
Input number 2 b
Input number 3 c
Input number 4 d
Input number 5 e
Input number 6 f
Input number 7 g
Input number 8 h
Input number 9 i
Input number 10 j
Mean= a+b+c+d+e+f+g+h+i+j/10
Print mean
End