Procedure advice- Bugs added to computer code (science fair)

Ask questions about projects relating to: computer science or pure mathematics (such as probability, statistics, geometry, etc...).

Moderators: AmyCowen, kgudger, bfinio, MadelineB, Moderators

Locked
melissjoelle
Posts: 1
Joined: Wed Jan 22, 2020 7:38 am
Occupation: Parent

Procedure advice- Bugs added to computer code (science fair)

Post by melissjoelle »

I need advice for my son's procedure on his science fair project (see project below). Does the procedure of adding three different bugs (each add one action) to the same code test the purpose and answer the question the best? Should we add more bugs or do more than 10 runs of the code on each? Seems to little to be super scientific???

Purpose: To determine the effect of a computer bug on efficient code.
Question: How much time can you actually save by eliminating all computer bugs?
Hypothesis: I predict that adding three different computer bugs to the same cod individually, will increase the time it takes to execute the code.
Variables: My Independent variable in this test, was our bugs, measured by the number of unnecessary blocks of code.
My dependent variable was the amount of time (measured to the thousandth of a second) of the bugs added to the otherwise clear and concise code.
My controlled variable was the same computer code in the same program, Scratch, and the same built in timer used for all the tests. I tested the clear performable and bug-free code, for time comparison.
Procedure: Test the time of a good computer code on Scratch (ball bouncing) Use the same computer code on Scratch and add three different bugs (lines of code that do not relate and are added to be inefficient). Run each code 10 times and records the results.
Results:
Bug 1- added average + .262 seconds
Bug 2- added average + .261 seconds
Bug 3- added average +.171 seconds
bfinio
Expert
Posts: 740
Joined: Mon Aug 12, 2013 2:41 pm
Occupation: Science Buddies Staff
Project Question: Expert
Project Due Date: n/a
Project Status: Not applicable

Re: Procedure advice- Bugs added to computer code (science fair)

Post by bfinio »

Hi melissjoelle,

I want to back up a bit before answering your questions because I think you and your son are misunderstanding the definition of a "bug" in computer code. A "bug" is generally considered something that will cause an error and either prevent code from working at all (e.g. cause the program to crash and give an error message), or maybe it will run but behave unexpectedly or give strange results (e.g. if your program is to animate a ball bouncing up and down in Scratch, maybe a "bug" would cause the ball to move sideways because you got the x and y directions mixed up in a line of code). That is not the same as an extra line of code - which might unnecessarily add length and run time to a program because it doesn't really do anything important - but also doesn't "break" anything. It sounds like your son is testing the latter. That is still a perfectly fine experiment - making code run quickly and as efficiently as possible is very important - but I wouldn't call them "bugs." Point being, I think your procedure is OK, but you would need to re-write the language of your purpose, question etc.

Hope that helps!

Ben
Locked

Return to “Grades 6-8: Math and Computer Science”