DI is a way to enable loose coupling, and loose coupling is first and foremost an efficient way to deal with complexity.

software must also address matters related to security, diagnostics, operations, perfor- mance, and extensibility.

loose coupling encourages you to address each concern separately.

강하게 결합된 코드를 작성하는것은 너무나도 쉽다

2.1 Building a tightly coupled application

there’s a huge gap between theory and practice.

A common attempt at loosely coupled code is building a layered application.

다이어그램을 그리는 것은 쉽다.

하지만 최종 결과도 그렇게 된다는 보장이 없다.

it’s a declara- tion of intent that carries no guarantee with regard to the final result.

Screen Shot 2022-12-20 at 23.13.45.png

2.1.1 Meet Mary Rowan

¡ A data layer—Includes a Products table in the database, which represents all data- base rows, and a Product class, which represents a single database row

¡ A domain layer — Contains the logic for retrieving the featured products ¡ A UI Layer with an MVC controller — Handles incoming requests, retrieves the rele- vant data from the domain layer, and sends it to the Razor view, which eventually

renders the list of featured products Let’s look over Mary’s shoulder as she implements the application’s first feature.

2.1.2 Creating the data layer

to pull data from a database table