-1

What are some good practices for handling communication between a frontend and a backend?

From what I know in order to keep things loosely coupled you shouldn't just have your frontend have a reference to your backend and directly call it but use some sort of middle layer.

I'm a C# dev and I know of the Event Aggregator pattern, where the backend can say something like "I register this method with you under the key "whatever"." and the front can at any time say "I want to call the "whatever" methods." or something like that.

However after googling I wasn't able to find any alternatives and for simpler projects this pattern seems overly complicated.

What good practices are there for handling the frontend requesting the backend do some logic-heavy operation and the backend report progress to the front?

1 Answer 1

0

I see two cases of front/back communication:

  1. Single software, Front-end is the IHM in the traditionnal sens. Don't try more complicated things than necessary. If you're in C# there are probably a few IHM frameworks available. Pick one, learn one.
  2. Front-end and back-end are two different sowftware, as in a React front-end for C++ back-end. In this case you typically use a message protocole like REST to send message (not method call) to one another.
2
  • Thank you but what is "IHM"? Commented Aug 16, 2020 at 21:16
  • @user14092802 IHM (french) = GUI (as in what users see and which controls they can use) Commented Aug 17, 2020 at 6:22

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.