0

I am currently planning a movie recommendation application. Within this context, the user can fill out a form including different information (e.g. title, description, etc.). The new entry gets then saved to an external database.

Amongst those fields, I also would like to include a category input where autocompletion suggestions are based upon previous category choices from other users. Adding a new category is also feasible and should appear as a new suggestion for later entries. In my current iteration, I included the categories as another table within my original database, but was unsure if this is the ideal approach (since a new query needs to be made to the external DB each time a new form is about to get filled)

Is my current approach too limiting (making unnecessary frequent requests to the DB)? Would an approach including Redis (or another key-value store) be a more suitable approach? I would really appreciate any critical feedback or alternative suggestions.

1

It's been my experience that the most critical resource on the projects I've worked on is developer's time.

Therefore, I'm a big fan of the Keep It Simple & Stupid approach - the less you have to think about it, the better. You'll find a simple solution easier to reason about, easier to extend, and easier to debug. It might cost a few extra cycles to process a request, but the tradeoff is usually worth it.

I'm also a big fan of actually testing and timing perceived limitations and optimizations. If you're concerned about time required to make an extra DB call, then write some code, make the call, and measure your results. Optimization by guessing is also known as "over complicating code and introducing bugs".

In short, take whatever approach seems easiest and most comfortable to you in the short run and let the future worry about itself. The fear of painting oneself into a corner is greatly exaggerated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.