I'm curious the community's opinion on this:
how stupid it's sounds like (in enterprise level companies and systems):
"If you can automate a task on frontend, you should move the task and automation to backend"

  • 0
    It depends on the task but generally I would agree. Code on the backend is running on (hopefully) good hardware that's under your control; code on the frontend is running under whatever random conditions and is ultimately controlled by the user. "Don't trust the client" is a pretty important security maxim, and any code you run on the frontend is code you're trusting them with. Even in a corporate environment, you're not guaranteed against bad actors and you're definitely not guaranteed against stupidity. Is your frontend code going to keep working correctly if they run it on their crappy old iPad or is it going to AJAX POST a bunch of garbage into your database? In a server environment, if a task crashes you can set up automated alerts and retries. What do you do in the client environment if they close the window? Is there anything in the data that's supposed to be hands-off but that a client might be tempted to manually tweak? Any secrets they could lift out of the source?
  • 0
    You mean like, it's currently done in the web interface when the user clicks a button in Javascript code?

    Yea, then it does make sense to just have that same code in the backend and the request go to it. I mean, it depends on the specific problem, and what you mean by "automation."
Add Comment