DEV Community

Elisaassa
Elisaassa

Posted on

osd lab3

Lab 3 Blog: Implementing File Size and Execution Time Features

Hey everyone! 👋

I'm back with Lab 3, and this time, I focused on supercharging my Code-Formatter-Advisor project by adding two awesome features: File Size Calculation and Execution Time Measurement. These additions are all about giving you more insights and making your experience smoother. Let me share how I rolled these out, managed parallel development with Git branches, and successfully merged everything without a hitch.


🚀 Features Implemented

1. 📏 File Size Calculation

First up, I added the File Size Calculation feature. Knowing the size of each file in bytes can be a game-changer, especially when you're dealing with large datasets or multiple files. It helps you get a clearer picture of what's being processed.

Issue Created: Add File Size Calculation for Analyzed Files (#3)

How I Did It:

  • New Command-Line Argument: Introduced a --file-size flag. Simple and straightforward!
  • File Size Logic: Leveraged Node.js's fs module to calculate and display the file size right in your terminal or write it to an output file if you prefer.

2. ⏱️ Execution Time Measurement

Next on the list was the Execution Time Measurement feature. Ever wondered how long it takes to analyze each file? This feature answers that by tracking and displaying the time taken for each file's processing.

Issue Created: Add Execution Time Measurement (#4)

How I Did It:

  • New Command-Line Flag: Added a --time flag to toggle this feature on or off.
  • Timing Logic: Used JavaScript's Date object to record the start and end times of the file analysis.
  • Output: Displays the execution time for each file in the terminal or writes it to your specified output file.

Here's a sneak peek of what the output looks like:

Pretty neat, right?


🌿 Branch Management and Merging Strategy

To keep things organized and avoid chaos, I adopted a branch-per-feature approach. Here's how I managed it:

Steps I Followed:

  1. Created Separate Branches for Each Feature:

    • issue-3 for the file size calculation.
    • issue-4 for the execution time measurement.
  2. Implemented Features Independently:

    • Worked on each branch separately to keep changes isolated and the codebase clean.
  3. Merging Back into Main:

    • First, merged issue-3 into the main branch.
    • Then, merged issue-4 into main.

Luckily, merging went smoothly with no major conflicts, thanks to keeping the changes minimal and well-organized.


📝 Conclusion

Lab 3 was an incredible learning experience in managing multiple Git branches and merging parallel developments seamlessly. I honed my skills in feature isolation, avoiding merge conflicts, and maintaining code stability throughout the process.

I'm really excited about the new features in Code-Formatter-Advisor. The File Size and Execution Time Measurement functionalities add valuable context, making the tool even more powerful and user-friendly.

Closed Issues:

Thanks for reading! Stay tuned for more updates on the development of Code-Formatter-Advisor.

Top comments (0)