Timeline for Should I prefer classes or singletons in JavaScript/Node?
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 10, 2015 at 0:01 | vote | accept | Aviv Cohn | ||
| Feb 9, 2015 at 23:07 | comment | added | ArnauOrriols | Precisely. It's understandable the urge to think about classes when coming from C# and Java. But Javascript (like many other languages) offer a wider range of patterns that fulfil some of the needs that would be solved with classes in C# or Java. These languages are called multi-paradigm, because they are designed with multiple programming paradigms in mind, not just OOP. This doesn't mean you shouldn't use classes. If OOP is the paradigm of your choice, you will define and use objects. But not if it is just to solve a need that is already natively solved, like modules. | |
| Feb 9, 2015 at 13:45 | comment | added | Aviv Cohn | I see. So do you agree that often I can settle with plain modules, but when I do need an object I should create a 'class'? | |
| Feb 8, 2015 at 22:25 | review | First posts | |||
| Feb 9, 2015 at 3:46 | |||||
| Feb 8, 2015 at 22:20 | history | answered | ArnauOrriols | CC BY-SA 3.0 |