Hacker News new | ask | show | jobs
by EpicEng 4629 days ago
I've written a lot of C# and Java (and others of course). It's really not an issue. If you're doing something expensive in a property getter or setter you're doing it wrong. If the function call doesn't get inlined and becomes a bottleneck in some tight loop you can just change it. Anecdotally, I have yet to see this occur in practice.

Also, as the guy below me pointed out, by convention you know that Foo is a property.

1 comments

Exactly. It's (at least from what I've seen/read) common convention to make sure that getters/setters should be quick and have minimal side effects.

Your application shouldn't hang from a database call when you pull a property from an object. And obviously, methods doing such things should be documented appropriately.