I just want to have other opinions about this, which I discussed in my head, for example, I have a class user_controller and a class user
class User attr_accessor :name, :username end class UserController // do something about anything about users end
The question is should I have logic in my User class, so this will be
user = User.new user.do_something(user1) or it should be user_controller = UserController.new user_controller.do_something(user1, user2)
user = User.new user.do_something(user1) or it should be user_controller = UserController.new user_controller.do_something(user1, user2)
I'm not sure which one is the best design, I personally really like the first one, so for example, he would read how
john = User.new john.accept_friend(jane) instead of user_controller = UserController.new user_controller.accept_friend(john, jane)
john = User.new john.accept_friend(jane) instead of user_controller = UserController.new user_controller.accept_friend(john, jane)
What are the pros and cons of these templates? This is not just typical of Ruby, it is because it’s easier for me to type in ruby.
Edit: A really good transformation is going on, but I really like it more here from people. Thanks to all.
source share