1

I am very much an amateur developer. I have written a web app which uses parse-server as a backend.

My question revolves around how agnostic the frontend should be to the backend (parse server)?

For example, on the client side (browser), I query the parse-server for data - let's say using function GetData(). My web app then renders that data to the user - say, using ShowData(). BUT, GetData() returns an array of Parse Objects - so the client side rendering function requires the data is an array of Parse Objects.

Essentially, my code is locked into using parse-server. If I ever decided to I wanted killer feature 'X' that's only available in, say, Firebase then I can't move easily.

For me, I have no plans to move backend but wanted to know how this is done in the professional circles?

So, would ShowData() be written in such as way that it requires the data in a generic format (e.g. JSON); and GetData() would ensure that whichever backend is used (parse, firebase, etc) it would always return data in the same format (JSON or whatever)?

Or is the way I have done it perfectly normal?

  • Just perusing the docs for the community edition, it shows curl examples that return JSON objects. It's a little unclear what you would do differently. Are you talking about a different JSON structure? – JimmyJames Jul 25 at 14:15
  • I use the JS SDK which returns parse objects for a query – SimpleOne Jul 26 at 7:03
3

You've correctly identified that there is a potential issue here if you ever want to replace parse-server with something else. The "solution" to this is, as you suggest, to ensure that all of your third party dependencies are wrapped with an adapter - then, if you ever need to switch out your dependency, you only need to rewrite the adapter.

In practice, many developers will not bother to do this. They will take the stance that it's not worth the extra development effort for something that they may never need. Others believe that it's worth the extra development effort anyway as it helps to structure the code and make it easier to read.

  • "many developers will not bother to do this" +1 (me) – Ewan Jul 25 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.