FrEDD: Front End Driven Development

What if, as you designed and nailed down your View layer, your Model emerged from it, fully formed?

Sai Ramachandran

--

Say you are building an online bookshelf to show your friends what you are reading. I know you can just reuse Goodreads but stay with me.

So you are building an online bookshelf. You want it to simply show the book jacket, the name of the book, its author(s), and how many pages it has.

Implementing the Model

Given these requirements, implementing a Model becomes quite simple. You decide to go for the most trivial implementation imaginable and use a big JSON file containing an array of your books, each entry containing the following fields — name , jacket_image_url , author_names , page_count .

Great. You know what you model is going to look like.

Recall, for a moment, your workflow. You wanted to build a beautiful online bookshelf but the first thing you did was to figure out the model.

But it doesn’t end here.

CRUD Support

Now that the Model has been nailed down, you still have some questions to answer about how to will manage updates to the JSON.

Broadly, here’s where you are right now:

  1. Create — for the initial cut of the JSON, you decide to hand generate the array objects, export to .json, and upload it to some static host. Adding new books is still an open question. Admin dashboard? Manual updates? Let’s file it away for now with a Github issue to track it.
  2. Read — as long as the JSON is available and the server configured correctly, reading JSON is simply a matter of calling the URL.
  3. Updates — not sure how this is going to be implemented. Admin dashboard? Manual updates? Let’s file this away for now as well with a Github issue to track it.
  4. Deletes — not sure how this is going to be implemented. Admin dashboard? Manual updates? Let’s file this away for now as well with a Github issue to track it. Does it even matter? Why would I want to delete a book I read?

Out of the four basic operations a CRUD based web project is expected to support, three have open questions attached to them. Still, you forge ahead.

Implementing the Controller

--

--

Sai Ramachandran

Building https://squadgpt.ai - GPT for teams. Manage AI costs and retain visibility with SquadGPT. All views personal. Email = sai@squadgpt.ai