nus-cs2113-AY2122S1 / forum

3 stars 1 forks source link

Self-invocation vs SLAP #132

Closed saravanamani1999 closed 3 years ago

saravanamani1999 commented 3 years ago

Hi prof, i remember you mentioning having too many layers of self-invocation would be considered as a design flaw. But what if we use these self-invocations because we want to follow SLAP? Which one should we prioritise, SLAP or keeping the number of self-invocations to the minimum?

okkhoy commented 3 years ago

would be considered as a design flaw

should be: could be considered as a design flaw

TL;DR Prioritize SLAP

Interested? read on:

One of the reasons you can have too many self-invocations is when the object is doing too many things and you haven't done the correct abstraction (thus also violating SRP). In such cases, you should consider creating other objects to separate out what each object should be doing.

saravanamani1999 commented 3 years ago

ahhh okay thanks prof!