DEV Community

Shailen Naidoo
Shailen Naidoo

Posted on

1

Treat the frontend as if it is dumb

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.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay