Is having a class have a handleAction(type) method bad practice?
Posted
by
zhenka
on Programmers
See other posts from Programmers
or by zhenka
Published on 2011-11-29T02:01:05Z
Indexed on
2011/11/29
2:07 UTC
Read the original article
Hit count: 299
My web application became a little too complicated to do everything in a controller so I had to build large wrapper classes for ORM models.
The possible actions a user can trigger are all similar and after a certain point I realized that the best way to go would be to just have constructor method receive action type as a parameter to take care of the small differences internally, as opposed to either passing many arguments or doing a lot of things in the controller.
Is this a good practice?
I can't really give details for privacy issues.
© Programmers or respective owner