2

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?

asked Jul 25, 2019 at 13:56
2
  • 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? Commented Jul 25, 2019 at 14:15
  • I use the JS SDK which returns parse objects for a query Commented Jul 26, 2019 at 7:03

1 Answer 1

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.

answered Jul 25, 2019 at 14:07
1
  • "many developers will not bother to do this" +1 (me) Commented Jul 25, 2019 at 15:00

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.