The frontend is nothing more than an interface for a layperson to interact with so they can perform a task or a goal in mind. It is a given that the frontend will interact with a backend API at some point throughout the user journey.
To me, the more control flow statements (if/else) exist in a system the higher the chances are of something going wrong or at least the higher the number of edge cases that will be introduced.
I try my best to determine whether control flow statements should exist on the frontend or the backend as I try to treat the frontend as if it is dumb and defer all the responsibility or a large degree of responsibility onto the backend when it comes to control flow statements.
I feel as if developers do not think about control flow statements enough, it should be the goal of the developer to reduce control flow statements in the frontend and aim to push a majority of that logic to the backend whenever possible.
Top comments (0)