Your backend is showing
This really hit home, as in the middle of last year I finished up an 18 month contract making a complicated series of forms, with complicated integrations with a backend, and complicated business logic.
But we were implementing complicated business rules on the front-end layer and all the massively powerful enterprise database was doing, was holding a string of values.
For example, imagine the user creates an application that has a $100 fee, and depending on a field of the application, it could add a 13% tax, and then maybe the user has a discount type attached to their user profile, now lets show the cost to the user.
A simple implementation would be that when the front end loads the page, it makes a call to the database and says “$100 fee, Application Type B, User ID is 531”, and it would return “Fee is this, bonus is this, discount is this, tax is this, shipping is this, total is this, total with GST is this”.
But instead, all of that was being forced onto the front end.
There would be mathematical calculations and calls to the database to get lookup tables of what code means what discount or fee addition… but no simple send the packet, display the packet.
There was no way to look at the values in the database, and make a calculation on the final cost.
I have one idea why this might be the case.
While yes, the front ends have become more powerful, but they are also way easier to deploy.
On the project we had a Microsoft CRM at the base layer, a Mulesoft middleware, and then us at the top.
It took the CRM guys around 2 days to push new code up an environment.
It took Mulesoft a few hours,
It took us 5 minutes.
What happens in the future when they want to add an extra $40 processing fee?
With everything happening in the top layer, you can add a new fee in a matter of minutes, IF that calculation is being done on the Front End, but not so easy if you need to deploy the CRM and Middleware.
It’s left me with a bunch of questions:
- Have we been foiled by our own performance? If it took a day to deploy a change to the frontend, would the business logic be this high up in the stack?
- Is it because there is lots of work that needs doing, and front-end developers are easier to get a hold of than Database admins, so get the plentiful cheap guys to do the harder work?
- Is it that modern databases aren’t setup for logic and are more geared towards storage?
- Did we just not push back hard enough and say it shouldn’t have been in the front-end?
I genuinely don’t know the answer.
Or am I wrong entirely, and the FrontEnd should always be doing business logic and calculations?