Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I design the application or model (database) first? [closed]

I am getting ready to start building a new web project in my spare time to bring to fruition an idea that has been bouncing around my head for a while.

I have never gotten down whether I am better off first building the model and then the consuming application or the other way around.

What are the best practices? What would you build first and why?

I imagine that in general the application should generally drive the model, however the application like many websites really doesn't do much without the model.

For some reason I find it easier at times to think in terms of the model since the application is really just actions on the model. Is this a poor way of thinking about things?

What advantages/disadvantages does each option have?

like image 435
YonahW Avatar asked Nov 30 '08 18:11

YonahW


People also ask

Should you design database first?

+1: data first, everything else will follow logically from there. It comes down to whether you want the database to reflect the user's requirements, or have the GUI reflect your database design. Exactly backwards. Your unit tests will be determined by the UI, and the database needs to facilitate the tests.

When designing this database which step do you take first?

The first step is requirements gathering. During this step, the database designers have to interview the customers (database users) to understand the proposed system and obtain and document the data and functional requirements.

Which is better code first or DB first?

Versioning databases is hard, but with code first and code first migrations, it's much more effective. Because your database schema is fully based on your code models, by version controlling your source code you're helping to version your database.


1 Answers

When you're building the whole application yourself, I would start with the user. What does the user want? What information do they need? That should drive the design of the application and model, not the other way round. When the model is designed first, there is a temptation to expose the user to it directly, which will rarely make sense.

like image 71
roryf Avatar answered Dec 25 '22 12:12

roryf