nus-cs2103-AY2223S2 / forum

12 stars 0 forks source link

Questions about JavaFX #267

Closed StanleyNeoh closed 1 year ago

StanleyNeoh commented 1 year ago

image Hello there, why should we execute the show method before we fill out the content of the stage regarding JavaFX? The above code snippet is taken from UiManager.java

damithc commented 1 year ago

@StanleyNeoh did you try switching the order of those two statements? I'm curious to know if there is a visible change if the order is changed.

StanleyNeoh commented 1 year ago

I swapped the order between the 2 statements, and so far it doesn't seem to have any visible change, but I am not sure if it will introduce any bugs.

dohaduong commented 1 year ago

I was confused about this part too, cuz seems like both ways work. Theoretically, would there be any difference/issue if we swap the order?

damithc commented 1 year ago

As per git blame, this code was added long ago, at the early stages of AB3 development when quality control was not as strict as it was in later stages. It is possible the the prescribed order of statement was unnecessary to begin with (i.e., a misunderstanding by the developer), or was necessary at the time but became no longer necessary with the passage of time. In either case, it is something for the AB3 devs to look into. Feel free to file an issue at https://github.com/se-edu/addressbook-level3/issues

More importantly, this shows the value of using comments to explain the WHY aspect, not just the WHAT aspect.

dohaduong commented 1 year ago

@damithc Member

damithc commented Mar 24, 2023

Oh, I see, thank you prof for the clarification!