Station 1: Constructing Code

AS A GROUP, construct the code to match the output, based on file.txt. Don’t split up the work! Do it together! What parts of the code gave you the most amount of trouble? Why? What are some key tips you need to remember when reading and writing to a file?

The part of the code that gave me the most amount of trouble was utilizing printf when writing to files. I don’t usually use printf at all when I code. To remember what each % did I had to reference previous lessons. Another thing that gave me a bit of trouble was the if statement in the first slide. I didn’t understand why I was checking if a studentID equaled a certain number until I arranged more of the code. I believe some key tips to remember when reading and writing to a file would be: use “true” if you want to append to a file, check how the data is split (commas, semi-colons, etc…), and read over your code every so often to catch mistakes early on.

Station 2: ELI5

AS A GROUP, use the Jamboard to come up with a simplified version of how to READ and WRITE to file that a 5-year-old could understand. It can look however you want, but should include pictures and text.

BTW - ELI5 = Explain like I’m 5 Why do you think is the most difficult step for a 5-year-old to understand? Why? What was your thought process for what you/your team came up with to address this challenge?

I believe the most difficult step for a 5-year-old to understand would be the catch block for errors. When I was younger, it usually seemed that when an adult did something, they didn’t make any mistakes. You may have to apologize as a child when you make errors, but you don’t always understand why you need to explain what happened, and you often don’t document what happened. Due to these experiences, I believe that explaining or documenting errors would be difficult to understand as it seems like an unnecessary step. My thought process for the reading of a file was to write the code and try to create meaning from the lines of code. There wasn’t a central theme, and I tried to explain each step with little context from any of the other steps. For the writing of a file, I decided that I should try using a theme that a 5-year-old would recognize, such as a meal being made (possibly by parents or their attempts). I wrote the code as usual, but I tried finding images and explanations that would relate to the theme. I believe the first slide could be good for those who like to look step by step, while the second could be those who like seeing the overall picture.

Station 3: Method Helpers

AS A GROUP, come up with 2 method headers. One method header to read from a file. Second method header to write to a file. Are there any other method helpers you think would be useful for you or someone else, when reading and writing to a file? Explain and provide situations that it would be useful for.

I believe that a method helper that read the amount of rows and columns in an array could be useful. This method could be helpful when utilizing the the fileToArray method. Instead of checking and manually setting the rows variable to a specific value, a method could go through the file and find the value for you. This could prove helpful when dealing with multiple files or if the file’s length changed.

Another method helper that checked if a file was present could prove useful. The method would write the session time to the file, which could prove useful in the future to see previous results. It could also append the session time instead of overwriting if the file already existed. This would be useful to run before the writeToFile method to differentiate different runs and compare the results of multiple trials.