baloch
1 year ago

should i use conditions in methods or make different methods?

Posted 1 year ago by baloch

Currently i have 2 options, in my controller i can either make different methods or i can make a single method and differentiate the working by using conditions. Let me elaborate.

  1. I can make two methods dealer() and subDealer() and do their workings separately.

  2. I make a single dealers() method and in that i can check if that is a dealer or a sub dealer by using a single if statement. as majority of the work of these two will be same.

which is better?

Please sign in or create an account to participate in this conversation.