When starting a new web app, what’s your data modeling workflow?

ecto
phoenix
discussion

#1

Do you sketch it out on paper? A text doc? Visual tool? Straight to code? Do you use generators to create resources all at once and fill them in later, or do you create them one at a time? Apart from data modeling, do you have any checklist, mental or otherwise, you follow when creating greenfield applications? :stuck_out_tongue:


#2

Your question focuses on tooling.

To get started:

  1. Figure out what your application is supposed to do, what it is supposed to accomplish, what actions/interactions are going to be supported.
  2. Now decide what persisted data is needed to support all your scenarios. If you can think of the data that your queries will have to return you’ll have a first draft of the data that you need. Now aggregate that knowledge and convert it to a relational model.

There really is nothing stopping you from laying down that foundation with a pen and paper or whiteboard + marker + camera (to capture snapshots).


If you are finding it difficult to break down your data into a schema:

Joe Celko’s Data and Databases (1999) - 2.6 Semantic Methods p.23

Terry Halpin - Object Role Modeling: An Overview (2001)
Terry Halpin - Object Role Modeling: An Overview (pdf)
Terry Halpin - Information Modeling and Relational Databases. Chapter 3: Conceptual Modeling: First Steps (2001)

Re-emphasizing: Don’t do the full 7 steps of the CSDP (Conceptual Schema Design Procedure) - do just enough to get the facts and sentences.


Sam Newman, Building Microservices (2015)


#3

Pen and paper. Focus on core functionality flow. Sketch the data model. Look for high stress query or write situations that may call for a slightly different table structure to optimize for those situations without joins if your really foresee a problem.

I keep a notebook where I sketch all this stuff out.


#4

I generally try to get my head around what endpoints I am going to need to accomplish what I want(pen and paper). I then look at what endpoints need to be done before others(order them). I put it all into a trello board and start working my way through it. Over time I naturally start making additional lists that contain smaller tasks from the broken down endpoint tasks.