...

/

Importance of the Interface Segregation Principle

Importance of the Interface Segregation Principle

Understand the importance of the interface segregation principle with an example.

Example of the interface segregation principle

The following playground contains a console application that reads text from a file and converts it to HTML:

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~~.
Initial project setup

We have a TextProcessor named base class on lines 6–23 in the code provided below that converts paragraphs in the input text into HTML paragraphs ...