Day 48, the power of dummy JSON

It is a simple but very powerful idea. Similar to the idea of ghost chart in management consulting, dummy JSON files allow you to set up your API server in hours instead of days.

Assuming you are writing /api/v1/tweets, instead of querying the database and return the correct result, you can just write the expected result in an object, and return the string version of it. For example, just do this in the node app:

var output = [{title:'tweet1'},{title:'tweet2'},{title:'tweet3'}];

The benefits are:
– many API endpoints can be set up in a short period of time
– reduce the uncertainty in the system. Basically, the backend shouldn’t cause any bug. All unexpected behaviors should come from the front end code
– allow parallel working streams. The front end developers can continue to work on the front end, without waiting for the backend.

I regretted that we haven’t thought about this early this week. It would save us so much time. With the help of dummy JSON, I was able to fix bugs in my front end code. When I am producing more backend code, I just remove the dummy JSON with the actual dynamically generated result. This is almost the idea working stream.