Don’t Design the Database First
| November 14, 2017 | in
Build bottom-up right? Start with the database schema, then models, then the UI, then ship it, right?
Well, I think the majority of new projects would benefit from not focusing on the database until much later.
Why not focus on the database from the start? Managing database changes in the early phases of a project sucks. We often go full crazy and completely destroy the schema once or twice during a project because of what we learn along the way. This database change management, in my opinion, isn’t worth the effort (for the early stage of a project).
Have you actually ever done this? Yes, and it worked great. We once had a large project we intentionally ran off of csv files for a long time. This allowed us to focus on UI / UX, the system architecture, and getting demos in front of users. It also saved us a lot of database migration pain while the schema would have churned a lot.
Delaying database integration also caused us to rethink how we were going to use the database. Instead of storing everything in the database (class system design), we ended up storing only some of the data in SQL Server. We stored other data in text files in the final system! Delaying the use of a database helped us think about the data storage requirements, and it helped us realize that a text file was actually perfect for some of this system’s data.
When wouldn’t I do this? Data-heavy projects where we know we are going to use a database. Often these projects involve some intensive reporting, which is still an area where I think databases shine.
Can’t you just solve this pain by using code first? Code first still requires updating a SQL Server. And the sooner you start carrying around the baggage of a SQL Server the sooner you will get slowed down by it.
I’m a big fan of databases. And for managing database scripts I am a big fan of DbUp. But remember that not all data access needs SQL Server.
If you are interested in learning more about our take on software, take a look at our classes at http://dontpaniclabs.com/education.
If you are interested in discussing data storage options, or create code from database, ping me on Twitter at @chadmichel.