daniLOLZ / ingsw2022-AM45

Progetto ingegneria del software 2022 Gruppo AM45
5 stars 0 forks source link

pls use exception correctly! #10

Open ingconti opened 2 years ago

ingconti commented 2 years ago

You have at least 4 bad practices!

I see:

} catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); }

this is 1st BAD practice. if You have exceptions, PLS play attention to result.

in the specific case You could have exception AS You cannot read here:

FileReader(directoryName +

file is missing.

2) You did not try to test if You caught exception: 2ns bad practice. You have to deliberately FAKE your parti to verify You catch it! (and then restore correct path)

3) bad practice; You did not ask HOW to manage exception: or You propagate it OR return NNULL

You simply return new Assistant(id,(int)steps,(int)turn);

4) do not cascade calls to IO /system:

You do:

Object obj = parser.parse(new FileReader(directoryName +

NEW fierleader + PARSE

Are you sure you don't fail in inner call??

ghost commented 2 years ago

We removed the problematic class following implementation changes and hopefully ironed out these bad practices across the rest of the code