I am implementing strategy pattern in Rails where I have Models like User, Item, Category and need to recommend items for the users depending on various algorithms (strategies) that user selects in view.
I am having a Recommend class which has an interface of recommend(user_id, strategy) and returns array of item_id. The strategy in recommend will be decided at runtime depending on the option user selects in the view. I have placed the recommend interface in /lib directory and the strategies in /lib/strategy directory. The strategies or algorithms right now will do SQL queries to give recommendations which is naive.
I want to make sure if I placed the files in proper directories or Should I need place the recommend class and all the strategies in models or app/services or any other?. I am really confused.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9e54adf5-deb5-4e25-968c-f1f61cc84e75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment