web-miner icon indicating copy to clipboard operation
web-miner copied to clipboard

Make the serializer JSON independent to further comply with "clean architecture"

Open Createdd opened this issue 7 years ago • 3 comments

See file here

See the discussion on this issue on Slack

Right now the Response is JSON dependent (end of the file):

return Response(
        json.dumps(response.value, cls=ser.ArxivDocEncoder),
        mimetype="application/json",
        status=STATUS_CODES[response.type],
    )

Createdd avatar Aug 10 '18 11:08 Createdd

One way to let objects interact is to use composition. This can be a good way to decouple functions. See this article to fresh up the ideas of delegation in OOP in Python

Createdd avatar Aug 16 '18 15:08 Createdd

I would also add this source for how to refactor python properly

liadmagen avatar Sep 23 '18 12:09 liadmagen

And regarding the serialization method itself, json is quite slow. ujson is already faster, and there are also other alternatives in the benchmark competition

liadmagen avatar Sep 23 '18 12:09 liadmagen