Removing database dependency from 3 tier architecture -


I've worked as part of a team on some 3-level applications for a long time, I like this architecture, But in all these applications I have seen the huge dependence of the top two layers on the data abstraction layer. This makes test and counterfeit hard work, as it is practically impossible to execute the application or perform some large scale without any existing database connection. Is there a pattern that tries to solve this problem? (Dip, one of the solid principles) relates exactly to the situation you describe:

A high-level module should not be dependent on low-level modules. Both should depend on separation

B. Abstraction should not be dependent on the details. The description should be dependent on your stages.

For your situation, it is particularly relevant: to reference the data layer rather than the UI and business logic, those layers should only depend on the residue (eg interface) Which can be implemented in different ways. For business level this means that you define the interface on which the layer of business depends. The data layer provides the implementation of these interfaces.

You can provide another implementation of related parts of the interface for tests. In this way, you can provide accurate data which is used in testing instead of preparing a complete database for testing.

This pattern is also known as. You will find that soon you will have several interfaces which will require you to implement to run your program. You can either make it easy by using or solving - an inverse of the control container that is configured with the registration type for the type that executes the interface.

Another pattern you can find useful in this regard.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -