nus-cs2103-AY2324S2 / forum

16 stars 0 forks source link

Practice exam p1.12 - solution unclear #992

Closed aureliony closed 6 months ago

aureliony commented 6 months ago

I think the given solution is not exactly correct, as changing the software's internal behavior without changing the external behaviour is still considered refactoring. "It changes the external behavior" would be a better answer.

image

baskargopinath commented 6 months ago

i think refactoring is changing the softwares internal structure and not internal behaviour

some code code changes might change the internal behaviour (such as performance) of the software that is not visible externally but this doesn't qualify under refactoring

SherisseTJW commented 6 months ago

I feel that "It changes the external behaviour" would be more appropriate actually.

While refactoring is changing the internal structure, there is always the possibility of side-effects where it changes the internal behaviour, but we still consider it as refactoring

image

Having the rationale be just "It changes the behaviour" could result in confusion that such side effects are not allowed at all.

damithc commented 6 months ago

I feel that "It changes the external behaviour" would be more appropriate actually.

While refactoring is changing the internal structure, there is always the possibility of side-effects where it changes the internal behaviour, but we still consider it as refactoring

Correct.

Most examples we've given (for instance, the two examples given in https://nus-cs2103-ay2324s2.github.io/website/se-book-adapted/chapters/refactoring.html#what and the 10 examples given in https://nus-cs2103-ay2324s2.github.io/website/se-book-adapted/chapters/refactoring.html#how ) change the internal behavior.