design - Command Pattern leading to class explosion -


it seems whenever use command pattern, leads larger number of classes when don't use it. seems pretty natural, given we're executing chunks of relevant code in separate classes. wouldn't bother me if didn't finish 10 or 12 command subclasses might consider small project have used 6 or 7 classes otherwise. having 19 or classes usual 7 class project seems wrong.

another thing bothers me testing of command subclasses pain. feel sluggish after last few commands, if i'm moving slower , no longer agile.

does sound familiar you? doing wrong? feel i've lost agility late in project, , don't know how continuously implement , test speed had few days ago.

design patterns general templates solving problems in generic way. tradeoff seeing. happens because need customize generic approach. 12 command classes not seem lot me, though, personally.

with command pattern, commands simple (just execute method, right?) , hence easy test. also, should testable in isolation, i.e. should able test commands little or no dependencies.

the benefit should seeing two-fold:

1) should have seen specific, complicated approach simplified using pattern(s) chose. i.e. getting ugly should more elegant.

2) should going faster, due simplified approach , ease of testing individual components.

can make use other patterns, composite, , use oo design avoid duplicating code (if duplicating code...)?


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -