DEV Community

Discussion on: You don't need classes

Collapse
thewix profile image
TheWix

Dependency Injection and polymorphism aren't restricted to classes. You can do the same with functions. A constructor that you inject a dependency into is just a function after all.

Collapse
jwhenry3 profile image
Justin Henry

Very true. Typically the project will determine what gets used the most and how it is utilized. Angular is heavily Class driven whereas React is heavily Function driven. It's just all about style and convention and what makes the most sense at the time.

Thread Thread
thewix profile image
TheWix

Agreed, if you are in a codebase that is using OO then it makes the most sense to keep that style.

Some comments have been hidden by the post's author - find out more