...

/

Implementation of the Dependency Inversion Principle

Implementation of the Dependency Inversion Principle

Learn about the benefits of the dependency inversion principle.

We have the following codebase, which adheres to the single responsibility principle, open-closed principle, Liskov substitution principle, and interface segregation principle:

Note: Run the following code. The program will ask for the file to convert. Enter sample.txt as the name of the file. When the program stops execution, press any key to return to the terminal. Now, enter the cat sample.html command to see the content after conversion.

This is the first paragraph. It has *bold text*.

This is the second paragraph. It has **italic text**.

This is the third paragraph. It has ~~text with strike-through~~.
Code for file processing minus the dependency inversion principle

Having all the logic inside the Program.cs file is probably not the best way of doing things. It’s meant to be purely an entry point for the application. Because it’s a console application, providing input from the console and output to it is also acceptable. However, having it to coordinate text conversion logic between separate classes is probably not something we want to do.

So, we’ve moved our logic into a separate ...