DEV Community

Discussion on: Using getters/setters as opposed to methods?

Collapse
 
khrome83 profile image
Zane Milakovic

I really don’t use them. Mostly because I keep forgetting they exist.

Is there any performance reason to not use them?

Collapse
 
nombrekeff profile image
Keff • Edited

I also forget about them :P

I don't think there is, although I haven't made much research in that respect.

Correction: It kinda has some side-effects and is prone to errors, for example, if a method or property is mispeled:

person.getFulName(); // Throws error
person.fulname; // Does not throw