r/learnprogramming • • 29d ago

Tutorial Dependency Injection confusing example

I am learning about Dependency Injection from the below link Dependency Injection in ASP comma NET MVC Tutorial | ASSIST Software, but in the first example is writing a prototype, in the second it creates "a separate class that has the responsibility of working with the database", but no class is created. He only implements the function from the example 1.

Am I missing something?

Edit: I initially put a link to the tutorial in question, but Reddit removed my post. So this is why this post doesn't have a link.

11 Upvotes

6 comments sorted by

View all comments

2

u/TheStonedEdge 29d ago

When I was learning DI what helped the most was

  • Instead of declaring as a object 'new' inside another class. Eg tightly coupled you pass it as a argument to the constructor