nusCS2113-AY1920S1 / forum

Discussion forums
MIT License
9 stars 2 forks source link

Violations of LoD #105

Open aquohn opened 4 years ago

aquohn commented 4 years ago

image

In the above image, isn't LoD violated by the code? The method call is essentially:

(new MultiFormatReader()).decode(...).getText()

Wouldn't an LoD-compliant implementation be:

(new MultiFormatReader()).decodeToText(...)

?

Jefferson111 commented 4 years ago

Maybe, I think, because MultiFormatReader is something from the library, so not counted as LOD violation by the person who wrote the code snippet

okkhoy commented 4 years ago

qrCodeResult is also created within the method. So no violation

Jefferson111 commented 4 years ago

@okkhoy Just to clarify, if something like this would to come out:

String result = new MultiFormatReader().decode().getInfo().getText().toString();

This does not constitutes to violation of LOD because of the new keyword?