DEV Community


Discussion on: Do you start with frontend, backend, or both?

sharpninja profile image
The Sharp Ninja

I start with a data model which I normalize to fourth normal form. Next I create POCO entities from the datamodel and generate a dbcontext with EFCore. I push the migrations to an Azure managed SQL instance and use xUnit to build basic CRUD test cases to both seed test data and test the correctness of the data model.

Next I mock up the main use cases either in html or xaml depending on web or app. After building enough screen mockups to represent the workflow, I start creating APIs to expose the basic workflow's data flow. I define models for each API and thrn consolidate them such that a model with multiple fields in common with multiple API encapsulate the repeating fields in an abstract class and a sub-class for each API is created. Then I create the service endpoints and unit tests for calling the endpoints directly and indirectly through the API. Next I create Adapter patterns to translate models to entities which are consumed by the API implementation. At this point I begin integation testing by mocking the dbcontext and using an in memory data store, allowing a precise and repeatable testing experience.

Only after I have a first round of functioning APIs do I start implementing UI,, wgich at this point should only require hooking up UI elements to models and responding to events appropriately.