Partial preview of the text
Download Research and Conduct and more Lecture notes Computer Science in PDF only on Docsity!
ELL, Dees © 2009 How to Conduct Experiments In thus course (COSC 3320), you will be asked to design and run several programs whose primary purpose 1s to help you discover the behavior of yout programming environment As such, the programs themselves are neither particularly challenging nor actually very important on their own What is important 1s your interpretation of the results For the most part, the results you will be asked to measure are timings of program executrons Therefore, it 1s vital that you study how to measure execution tme within your programming and runtime environment. Often, timings are not very reliable; therefore you may have to repeat your executions many times and use the resulting timings to obtain a reasonable value. There are different reasons why timings can vary even though you executed the identical program with identical data sets The most important reason is that you are not entirely in control of the execution environment (that 1s, there may be processes executing you are not aware of, or you have no control over) Thus: If your environment may myolve other processes executing at the same time, you may have to use the minimum of the timings. Also, some system provided timing functions are notoriously unreliable Finally, you have to provide timings in units that are appropriate for the specific context - if you want to measure very short periods, using a function that gives you information in terms of seconds 1s useless Similarly, if you measure relatively long periods, using nanoseconds 1s not particularly iMumtnating either. If your timing function 1s not very reliable, you should use the average of many repetitions Also, it may be necessary to increase the workload in order to obtain more reliable timings (Eg. doing a search once may not provide any meaningful timings, it may be necessary 10 repeat the search 1,000 or 1,000,000 times In this ease, ensure that the searches are comparable ) ‘Once you have reliable timings, you must carefully explain what they mean. This is the meat ‘of your investigation. In other words, if you merely throw numbers at me, you are not providing any answers at all! You have to explain in considerable detail what the numbers mean, how you derive a general observation (hypothesis) based on these numbers, and how you can validate this hypothesis Note. YOU MUST FORMULATE SUCH A HYPOTHESIS! If you don’t, you will not have answered the question, no matter how good your numbers are!! Since you will be dealing with real world data, you will encounter surprises, that is, situations Where the values do not seem to conform to the general hypothesis that you wish to formulate You must explain why these deviations occur (Of course, if there are too many deviations. perhaps your hypothesis is wrong!) Often, it will be necessary to run additional experiments (tha! 1s, you must modify your program and measure additional phenomena), in order to ave at a well-founded explanation This is part of a well-defined experiment. It 1s up to you to design your programs so that they will provide answers that make sense! Finally, you must realize that there are no predefined answers in many of the situations you wil] study ~ rather, the answers depend on your programming and execution environment Therefore, the answers may differ for different programming and execution environments! EL babe Remarks on Programming Style Basics + Use structured programming! + Use procedures and functions! Eneapsulate as much as possible No procedure body (including the main program) may be longer than 95 lines {excluding comments) On average, their length should be about 25-50 lines, + Do not use global variables! This 1s an unconditional prohibition + Avoid goto’s. Programs with more than four goto’s are not acceptable + Any read must be followed by a write (You may use a flag to tum off write statements as they mess up your output -- BUT THE CODE MUST BE THERE!) Documentation (A) Use mnemonics for identifiers, Variables have some intended meaning, state it! (B) In-Line Documentation For each procedure and function, give a bnef description of its input/output behavior, of the parameters used, and if necessary. of some important local variables (C) Outside Documentation ‘A careful statement of the problem and a top-down approach to the design of your algorithm are mandatory You must describe in extensive detail the input (including its precise format) your program expects You must extensively document and justify any assumptions that you made during the development of the program/algonthm (no real-world problem 1s completely specified) These assumptions must be reasonable If you have problems justifying them, they may be unjustifiable ‘The data structures used in your program must be described You must not explain the output of your program, since it mus{ be self-explanatory In other words, if one cannot understand every portion of your output knowing only the problem statement, your program by definition 1s wrong ‘As a general rule, the outside documentation must be logically independent and physically separate from the program. Thus, direct references to the program are not permitted, Documentation will account for 40-50% of the grade of a properly working program Thus, a perfectly working program without outside documentation may get a D- ‘Thorough testing is crucial All cases, including exceptions and possible errors must be covered. It 1s your responsibility to select test cases that convince us that your program works, If we are not convinced by your test cases (not enough of them, many cases not covered, only simple cases covered, ctc.), we consider your program not working, (Remember Testing means running the program with certain test data and then comparing the output produced with that expected, The only thing worse than a badly tested program 1s one where the test data handed in prove the program wrong! )