This is the mail archive of the
frysk@sources.redhat.com
mailing list for the frysk project.
Re: Endless getters() and setters()
- From: Mark Wielaard <mark at klomp dot org>
- To: Phil Muldoon <pmuldoon at redhat dot com>
- Cc: Frysk Hackers <frysk at sourceware dot org>
- Date: Thu, 08 Mar 2007 18:22:07 +0100
- Subject: Re: Endless getters() and setters()
- References: <45EE17FD.2080903@redhat.com>
Hi Phil,
On Tue, 2007-03-06 at 19:40 -0600, Phil Muldoon wrote:
> Is there any preferred style with using $subject in classes that have
> class data? I find a mix in Frysk and in Frysk-Imports. I find myself
> endlessly writing getters and setters in emacs, that gate variables, and
> I find really they serve no real purpose other than to be hall monitors
> and clutter up the code. I'd really not write them at all. So I decided
> to ask what other people do.
This got discussed a little on irc, but the answer seems to depend on
the actual use case you have in mind. If this is for internal/package
private code which doesn't need to provide a stable interface then using
direct field access can make sense. If however you intend the code to be
used as a more or less stable interface by "outside" code then direct
field access is not so nice.
I assume this question is related to the libelf wrappers. If we intend
them to be public api then it makes sense to only provide public getters
and setters for values that are meaningful for users of libelf as
library. Maybe we should start a public api review for this library?
Cheers,
Mark