nus-cs2103-AY2021S1 / forum

20 stars 2 forks source link

Practice Exam part 1 question 2 #484

Closed iamjamestan closed 3 years ago

iamjamestan commented 3 years ago

In this question, I got the correct answer of "2", and my rationale was "a and d" since Magic Numbers and SLAP are mentioned in the code quality section in the textbook here.

However, from the general comments below, it mentions that "a c" should be the correct rationale instead. May I ask how does coupling reduce code quality as stated in the question? My impression is that coupling is not related to code quality since it is under the design fundamentals section of the textbook. Thank you!

Screenshot 2020-11-29 at 12 54 19 PM
damithc commented 3 years ago

It's not based on what things are good/bad for code quality. SLAP is good e.g., it makes the code easier to read Coupling is bad e.g., it makes the code harder to maintain/test

EDIT: deleted not

GeNiaaz commented 3 years ago

@damithc I believe why James was confused was because he wasn't sure what "code quality" is meant to mean, when in this case it merely pointed to bad practices. In the finals it would be more explicit right? I think students may be confused on this front, including myself.

damithc commented 3 years ago

@damithc I believe why James was confused was because he wasn't sure what "code quality" is meant to mean, when in this case it merely pointed to bad practices. In the finals it would be more explicit right? I think students may be confused on this front, including myself.

Yes, I'll make sure it is stated clearly in the exam questions.

seanjyjy commented 3 years ago

It's not based on what things are good/bad for code quality. SLAP is good e.g., it makes the code easier to read Coupling is bad e.g., it makes the code harder to maintain/test

Hi @damithc, I belive your reply is referring to increasing SLAP and increasing coupling. But how do we infer from this question that your intention was to refer to increasing? i.e increasing magic literals reduce code quality, decreasing magic literals improve code quality etc? Just nice for this question looking at the decreasing / increasing should yield the same answer however that is not true in general.

damithc commented 3 years ago

It's not based on what things are good/bad for code quality. SLAP is good e.g., it makes the code easier to read Coupling is bad e.g., it makes the code harder to maintain/test

It should have read:

It's not based on what things are good/bad for code quality.

Sorry for the typo.

Hi @damithc, I belive your reply is referring to increasing SLAP and increasing coupling. But how do we infer from this question that your intention was to refer to increasing? i.e increasing magic literals reduce code quality, decreasing magic literals improve code quality etc? Just nice for this question looking at the decreasing / increasing should yield the same answer however that is not true in general.

🤔 Hmm... Think of drugs ruin lives. No ambiguity right? magic literals reduce code quality should be clear too? :-)