nusCS2113-AY1920S1 / pe-dev-response

0 stars 0 forks source link

Overlay doesn't work correctly #169

Open nus-pe-bot opened 4 years ago

nus-pe-bot commented 4 years ago

image.png

From what I understand in the User Guide, the command overlays bar 2 to bar 3 and onwards but bar 1 got affected as well.


[original: nusCS2113-AY1920S1/pe-interim#169]

Samuel787 commented 4 years ago

Team's Response

This bug arised because user initially copied pasted bars in the song before invoking the overlay command.

After analysising our code, we found out the cause:

I implemented the copy command by copying a reference of the bars and inserting it into the music track.

My team mate Rishi implemented the overlay command by directly changing the bar in the music track.

This bug arised because:

  1. I'm copying by reference instead of doing deep copying of the bars. Hence, when a bar is changed in the music track by the overlay function, any bars referenced to this bar would also get affected.
  2. Rishi changed the bars in the music track by reference.

This bug could have been completely avoided if both of us have created a new bar to replace or add to the music track instead of directly modifying the music track by reference.

Duplicate status (if any):

--