3 ms·
Readable, and intuitive. The syntax is like a standard class (constructor, methods, getters, setters) you'd see in C or PHP.
by nodesocket 12y ago
Readable, and intuitive. The syntax is like a standard class (constructor, methods, getters, setters) you'd see in C or PHP.
- yoklov 12y agoC++, you mean. There are no classes in C.
- dzhiurgis 12y agoWhat is the benefit of using classes rather than just bunch of functions, calling each other?
- ajanuary 12y agoThere are strong arguments for both, but if you're going to decide on classes, ES6 classes are preferable to ES5 style.
- nextweek2 12y agoThat's a big question, its usually a first year software engineering degree assignment. Its the question of object orientated programming vs procedural programming. The main thing with having classes is about encapsulating functionality into objects which can be tested, reused and extended as a component in its own right.
- rhizome31 12y agoOften when you use a bunch of functions together, you end up passing the same arguments. Those arguments represent some kind of state that your pass around from functions to functions. Sometimes you might even add an argument to a function just to pass it over to another function. After a while you might get tired of changing your function signatures and it makes sense to group those common arguments into a single data structure that can be accessed by your bunch of functions working together. While you're at it you might as well put the functions in that data structure too, so you can see clearly how they relate to each other. That's basically what a class is for.
- deleted 12y ago[deleted]