Skip to content

Refactor#4

Merged
hadipash merged 24 commits into
hadipash:refactoringfrom
taejjing:refactor
May 7, 2018
Merged

Refactor#4
hadipash merged 24 commits into
hadipash:refactoringfrom
taejjing:refactor

Conversation

@hadipash
Copy link
Copy Markdown
Owner

@hadipash hadipash commented May 7, 2018

No description provided.

KimJeongHaeng and others added 24 commits May 2, 2018 10:49
2. BookSorter Class - compare method
3. It does not know what role it plays with existing parameter names.
2. BookSorter Class - compare Method
3. I don't know that the name of the book is the same when you see "result == 0".
2. ComputerParcelable Class - equals Method
3.I tied the related conditional statements together.(improved readability)
I extracted the function for each conditional statement. (Improved understandability)
2. FileListSorter Class - compare Method
3.The comment in the method was deleted because it was the code commenting part that was before.(Improved readability)
I extracted the function for each conditional statement. (Improved understandability)
line. 168
1. Extract Variable
2. Utils - DataUtils - void removeBook(int)
3. (books.size() > i), this expression is not understandable.

line. 174
1. Add Error Exception
2. Utils - DataUtils - void removeBook(int)
3. There is no exception if 'i' has out of bounds.
line. 214
1. Extract Variable
2. Utils - DataUtils - void removeSever(int)
3. (servers.size() > i), this expression is not understandable.

line. 219
1. Add Error Exception
2. Utils - DataUtils - void removeServer(int)
3. There is no exception if 'i' has out of bounds.
line. 232
1. Duplicate code
2. Utils - DataUtils - void addBook(final String, boolean)
3. addBook is duplicated
2. FileUtils - openunknown two methods
3. a file not supported by Amaze and a file from OTG's openunkown method codes overlap a lot.
    So, I extracted the code and made it simple. (Improved understandability)
GzipExtractor.java
void extractEntry(..) : outputDir -> outputDirectory, buf -> buffer, len -> length

RarExtractor.java
extractWithFilter(..) : arrayList -> fileHeaderArrayList
void extractEntry(..) : outputDir -> outputDirectory, buf -> buffer, len -> length

TarExtractor.java
void extractEntry(..) : outputDir -> outputDirectory, buf -> buffer, len -> length

ZipExtractor.java
extractWithFilter(..) : entry -> entryIndex, entry1 -> entryArray
void extractEntry(..) : outputDir -> outputDirectory, buf -> buffer, len -> length

After then
make similar lines to methods in extractEntry() of each extractor class.
make class BufferWriter, OutputCloseBufferWriter, IOCloseBufferWriter
make method getOutputFile(@nonnull Context context, String outputDirectory, String name)

other similar lines alse exist but, they don't have same parameter types with simple behaviors so if i make them methods, it will be more complicated, I think.
2. FileUtils Class - fileToContentUri method extract to IconUtil class
3. The purpose of fileToContentUri method is to look for a uri, not a calculation based on the icon.
    Therefore, it was extracted by IconUtils class.
2. FileUtils Class - openFile method
3. Comment is not available because it is the previous code. So, Delete it.
line 289 ~ 304
1. Extract Variable
2. Utils - DataUtils - void setServers, setBooks, setAccounts
3. More Readable Code !
1. Extract Variable
2. Utils - DataUtils - void removeBook, removeServer
3. These are more readable..
1. Extract Variable
2. Utils - DataUtils - void setGridfiles, setListfiles
3. More Readable Code !
1. Duplicate code
2. Utils - DataUtils - int contains(String[], ArrayList<String[]>)
3. 'contains(string[] ArrayList<String[])' is duplicated with the code in containsServer(String)
2. EncryptDecryptUtils -> EncryptUtil and DecryptUtil
3. Since the encryption and decryption processes are different, I have re-created the other two classes.

1. extract method
2. DecryptUtil - decryptFile method
3. Toasts are overlap a lot. This part is extracted.
    For the understandability of decryptFile method, methods were extracted for each case.
2. GenericCopyUtil Class -> inputStreamStructure and ouputStreamStructure Class
3. inputStream and ouputStream are difference. So I extract two structure class.

1. extract method
2. GenericCopyUtil Class - startCopy method
3. The if statement is too complex. So Each if statement was extracted by other methods.
line 66, 70
1. rename
2. Utils - DataUtils - containsBooks, containsServer
3. parameter name  is not understandable

line 80. 90
1. Extract Variable, rename
2. Utils - DataUtils - contains
3. 'x[0].eqauls.a[0]' is not understandable.
2. EncryptDecryptUtils, DecryptUtil, EncryptUtil Class
3. Renamed for understandability.
BookSorter, ComputerParcelable, FileListSorter Class refactoring
Rename in filesystem/compressed/extreatcontents
@hadipash hadipash merged commit 4baa55a into hadipash:refactoring May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants