Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How essential is polymorphism for writing a text editor?

Many years ago when I didn't know much about object oriented design I heard one guy said something like "How can you write a text editor without polymorphism?" I didn't know much about OOP and so I couldn't judge how wise that though was or ask any specific questions at that time.

Now, after many years of software development (mostly C++), I've used polymorphism many times to solve various problems when designing software. Yet I've never created text editors. So I still can't evaluate that guy's idea.

Is using polymorphism so essential for implementing a text editor in object-oriented languages and why?

like image 300
sharptooth Avatar asked Aug 24 '10 09:08

sharptooth


1 Answers

Polymorphism for writing a text editor is by no means essential. In fact, polymorphism for solving any programming problem is not essential. It's just one way to do it. Sometimes it makes solving certain kinds of problems easier, and sometimes it just gets in the way.

The evidence for this is that there are perfectly usable text editors developed long before "OOP" became popular.

like image 156
Greg Hewgill Avatar answered Oct 01 '22 12:10

Greg Hewgill