Front-end and Back-end: Together but Separate
Before you read any further I would like to clarify, I am by no means an expert in this topic. All that I am going to write in the next few paragraphs are knowledge gathered over the period of 2 days and are mostly mine or someone else's opinion. There probably are equally good arguments against what I am going to propose here. But as a selfish citizen of the internet I chose to pick the arguments that serves my belief the best.
I am going to assume anyone reading this is familiar with the idea of front and backend (I am expecting veteran developers to read this. Just definition knowledge is enough). If anyone needs a quick refresher on it Click Here.
Now that we have that out of our way I can proceed with this piece. In our CUNY Codes project (Showtrack — TV show tracking app) we had to make a decision of how our frontend and backend code would be version controlled. We wanted to have complete separation of front and backend and here is why-
- Scalability: Lets say our app gets too big for our database system we are using right now and we need to migrate to a different database. With the current structure we have, we are making all data transfers through the use of restful api. That means our backend can change completely as long as the api endpoints are maintained. In the same way we could decide to revamp our frontend or switch frontend framework completely without having to worry about data consistency.
- Difference in Technology: Frontend and backend are on a completely different skillset. Although both department works hand in hand to make application but the main goal of each are slightly different. While backend developpers are busy with providing data security and access to data in a fast and efficient manner, frontend developpers are making sure the end user is getting the best user experience. The analogy could be a restaurant. The chef (backend) is making sure the food gets prepared as per the order and the server (frontend) takes care of customer satisfaction. You would not want your food preparation and food serving in the same place (Hibachi style restaurant excluded from this analogy). In the same way it would make sense to have separation of front and backend.
- Multi-platform Frontend: Did I mention we were also building an android app? Having a backend as an api means we can keep adding more frontend technologies that will get the data from the api and will be able to provide similar performance on almost any platform. If we had an integrated backend system that would mean that we would have to write the same data queries in our android. And if in the future we were to decide to build an iOS app, we would have to go through the same hoops all over again. This one time effort would save us the headache for the future.
This are few of many good reasons we came across that made us decide to have a separate front and backend.
Separating the frontend and backend has some disadvantages too. Like if the api changes there is no clear way to inform the frontend. Also maintaining a api documentation requires some extra work. But I think its worth the extra work, because the benefits outweigh the problems in the long run.
And as always, HAPPY CODING.