Due to technical reasons in last 2 weeks i have no time and possibilities to write and post new articles. But now everything is ok and I hope that in the short time I’ll post something interesting.
As the result of previous parts we have domain with core classes and services. Actually we can generate and process any amount of data with methods provided by domain services. But there are some issues:
- How user will input data;
- How data will reconstitute/persist.
Domain by nature and the general plan must be absolutely independent and free from technology aspects as GUI/user interaction (WPF, WinForms, Web) and the data layer implementation (MSSQL, MySQL, Oracle, etc.)
Step by step we realize that application should be multi layered. And there are minimum possible set of layers, as I see it:
- Domain –business logic layer. In this layer described HOW to work with data.
- Data layer. At this level implemented saving and recovering data to/from external data storage to domain objects. Extracting these actions in separate layer makes application more agile, i.e. it’s easy to deal with several different DB without changing other parts of the application.
- Presentation layer. Here we say WHAT to do with data: define specific sequence of domain services and return calculated result to GUI. So, this layer connects Domain and Front End.
- User Interface (Front End). This level can be console, win forms, web, even mental transmission to mind! =) Try to keep this layer as dumb as possible. No data changes, no application flow logic – only do what other says with any initiative.
Now when we know layers responsibilities, next goal is to understand how they interconnect with each other.