📜 ⬆️ ⬇️

External voting service aka like-dislike feature

Good day, Habrasoobschestvo!

In the process of implementing one of my projects (with blackjack and all the other social charms), I had to implement the functionality of voting (like, like / dislike, rating, etc) users for some essences of the project's subject area.

Disclaimer: to my great regret, further there will be only discourses on the functions of some abstract external polling service and not a single line of code or useful links, but I need to get feedback from knowledgeable people.
')
Searching for Google solutions, could not find anything suitable. Basically, solutions (plug-ins for various web frameworks) are reduced to adding additional fields to existing tables (or collection objects in the case of MongoDB), in which the number of likes / dislikes is written, and also who of the users has already voted. Such solutions have significant drawbacks, since, on the one hand, they do not have sufficient flexibility to easily modify voting algorithms (which is very important for a new project in the process of finding the right model), and on the other hand, they require modification of the existing code and, even worse, data storage, to add voting functionality.

At the same time, there are a significant number of services that provide opportunities to add comments to your site, such as cackle.me , disqus.com , etc. Services are external to the project under development and allow you to add the ability to comment anything on your own with minimal effort. site (or in the application).

There was a logical question, why there are no similar services for adding polls to your site?

Functions Required for Voting Services


Thus, the main logic of processing likes or rating takes on external service. For example, he should check whether the user's likes for a given object is not repeated and not allow such a vote to be taken. At the same time, the business logic of who can vote for what can be implemented already on the side of their own project.

Of the additional features I would like to see:

Website integration with the service

I think there should be 2 ways - from the backend and from the frontend (web client or mobile client). Since it is possible not to keep information about voices on your side at all, you can make requests to create likes or to get the number of likes for objects directly from the client (identifying yourself with a token). Thus, the page will be collected from several sources. You can also collect information about votes on the backend and inject it into the resulting data before sending them to the client, making requests to the external API. It is even possible asynchronous, so that while waiting for a response, you can perform other data processing.

There should be plug-ins for popular languages ​​(Ruby, PHP, JS) allowing using mixins or simply adding new modules to a project to easily add the ability to like / dislike or evaluate domain objects.

Benefits



Instead of conclusion

This is how the service of my dream vote should look like this. I would like to get answers, can someone advise something similar? Or did you need such a service, would it be useful to you?

Source: https://habr.com/ru/post/189702/


All Articles