campeon23 / split-fetcher

The code is a concurrent file downloader in Go that splits a file into multiple parts, downloads them in parallel, and assembles the final file, with support for Etag validation to ensure file integrity.
MIT License
1 stars 0 forks source link

Code Refactoring for Flags, Configuration Passing, and Function Decomposition #131

Closed campeon23 closed 1 year ago

campeon23 commented 1 year ago

Description:

To enhance the readability and maintainability of our codebase, several changes are required:

Refactor Flag References:

Streamline Configuration Passing to run Function:

Decompose Logic of Execute Function:

Action Items:

Priority: Medium

Assigned To: Marco A. Villarruel

campeon23 commented 1 year ago

Status: Completed ✅

Summary of Resolutions:

A "flags" struct has been defined and implemented, centralizing the storage of flag names. This minimizes the usage of repeated string literals throughout the code, enhancing maintainability. The run function signature was updated to directly accept cfg *AppConfig. All corresponding function calls have been updated accordingly, simplifying the parameter passing. Within the Execute function, we successfully isolated the logic for decryptManifest and assembleOnly by moving them to their dedicated functions. This step ensures that the code remains clean, readable, and adheres to our established coding standards of limiting complexity. Testing: Comprehensive testing was done post-refactor, and all functionalities have been confirmed to be consistent with previous behaviors.

Commit Summary: Refactored the code to streamline flag management, simplified parameter passing in the run function, and decomposed the Execute function for enhanced readability.

Recommendation: Recommend merging changes to the main branch, given that all checks and tests have passed successfully.