4 ms·
If there's no logic in the getter and setters, just make the properties public.
by jonathankoren 11y ago
If there's no logic in the getter and setters, just make the properties public.
- ossreality 11y agoHuh? Then they're just fields and not properties, maybe I'm misunderstanding what you're trying to say. And there are numerous reasons that Properties are preferable to Fields. Unless someone else can help me, I think this is really bad advice for a C# developer.
- jonathankoren 11y ago>Huh? Then they're just fields and not properties Nomenclature schmomenclature. They're variables with object scope.
- jonathankoren 11y ago>Huh? Then they're just fields and not properties Nomenclature schmomenclature. They're variables with object scope.
- jonathankoren 11y ago>Huh? Then they're just fields and not properties Nomenclature schmomenclature. They're variables with object scope.
- Retra 11y agoThat works until you want to add logic without breaking existing interfaces.
- masklinn 11y agoOr until you need to use them in beans and the like.
- tajen 11y agoPlay!Framework 2 for Java is awesome in this matter. You write public members, but at compilation it transforms them into private members with getters and setters (if not final). It means if you write the setter, it overrides the default one.
- kuschku 11y agoLombok does the same ;)
- jinst8gmi 11y agoBut then you're using Lombok...
- dfullarton 11y agoCan you clarify? I've heard similar negative feelings from devs. What's wrong with lombok?