4 ms·
This is why currently I am so happy with ES6+/Typescript. The ability to define strongly typed classes but also have methods really improves the OOP workflow to
by MH15 6y ago
This is why currently I am so happy with ES6+/Typescript. The ability to define strongly typed classes but also have methods really improves the OOP workflow to me. Classes should rarely be used for things that are unique, especially a "parse" method or etc. I recently had to make two modules- one to format a message and one to parse the message. Instead of classes, I can just use functions, outside the scope of any Class objects.
- cardiffspaceman 6y agoSometimes the best function for the job is a free-standing function, e.g. parse(Grammar, Input). I was leaning this way when I read some quotes from Bjarne Stroustrup which touched on the subject. Here is a link to his personal FAQ which sums it up. http://www.stroustrup.com/bs_faq.html#oop http://www.stroustrup.com/bs_faq.html#oop