From 3f81cbaf747ce88f34faaf02d182272924f4dac0 Mon Sep 17 00:00:00 2001 From: Ryan Chudd Date: Wed, 20 Jul 2022 15:17:21 -0400 Subject: [PATCH] java file manager notes --- .idea/compiler.xml | 1 + FileManager.md | 47 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 3f507c9..29fac82 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -7,6 +7,7 @@ + diff --git a/FileManager.md b/FileManager.md index 1e01e92..f229dd9 100644 --- a/FileManager.md +++ b/FileManager.md @@ -1,4 +1,47 @@ -# FileManager +# FileManager - Ryan's Notes -An amazingly useless tool! +#### Why are the manipulation commands, the things that affect files and folders, in a different class than the _file manager_ itself? +FileManager has a lot of userinput, in order to make the program test-able it needs methods that operate on the files to be independent of scanners. + +#### Why is all the input and output factored out into a separate class? +So that it can be called easily and factored out of methods that change things + +#### Why is Copy/Move in the same method? What about the two operations are so much the same? +It's a very similar action where move has an extra step after copying. + +#### How would you separate them? Would it make it more understandable or less to separate them? +You could make a cut method that calls the move method and then deletes the file that was moved from its original location. +As written (checking for input to be move to do one other task) would be the same amount of work. It may make future changes +to move and copy be easier to change if they were less integrated. + +#### What would you have to do to: + +- add the idea of a _current folder_? -- we would need a cd type command that moved us into a certain folder +- how would you add a _change folder_ command? -- we can take a file path and then need a field to store the current path we're on and +be able to move forward and backward on it +- how would you add a command to display the contents of a file? you'd need the ability to read the file's text and store that before printing to console +- how would you change _list_ to show the difference between files and folders? string formatting +- how could you clean up some of the code by using an _enum_ instead of strings for the commands? +an enum would clean up some of the console variables and make a cleaner switch statement possible?? +- how would you use the _FileOperator_ class to test the _FileOperator_ class? +Creating an instance of console and passing it to a new instance of file operator would let you call methods of the +class. You could make instances of file's etc for testing + +#### How would you test this code? +you could test the FileOperator class with the above method + +#### How are the testing methods different for each class? +Tests that include user I/O would need to be tested through use rather than with test methods + +#### Which class cannot be easily tested wit unit tests? +FileManager which has a lot of console scanner waiting for input + +#### Does the code, as is, have any obvious bugs? +I didn't notice any.. + +#### How would find out? +Write tests that cover all of the FileOperator methods + +#### Why is the Console passed as a parameter to the two constructors? +By having a single Console, it can clean up repeated code