<villy.joergensen@lindhard.com> wrote:
> Hi everyone.
>
> I would like to restrict the use the prefixes get and set to
getPropertyName
> and setPropertyName as used in the beans standard of methods only getting
or
> setting a value.
Very good idea - always use the standard methodnames when applicable...
> When I get or set a value in a method and at the same time execute some
> extra code I would like to use anoter prefix for my method.
>
> I would like to have an advise what to use instead.
Well, I'd have to say that it depends largely on what you will be doing in
the method, and who will use it.
I, for one, don't like APIs with lots of getXXX, retrieveXXX, loadXXX and
fetchXXX, because you can never be entirely sure of what the author meant,
when naming the method...
So, a method that just returns a value, like the day of the month, simply
call it getDayOfMonth() - if however the method does something more, like
updates the birthday calendar or something, it really should be called
getDayOfMonthAndUpdateBirthDayCalendar()...
This is a stupid example, but since I haven't the slightest idea as to your
application, or method implementations, it is a bit hard to give more
specific help.
If you could elaborate a bit on the exact function of the methods, you would
probably receive more and better advice - or maybe even find the solution by
yourself.
And for a further, deeper discussion about method and variable-naming, refer
to Steve McConnell: Code Complete
(
http://www.amazon.co.uk/exec/obidos/ASIN/1556154844/026-6508173-9220446)
/Peter Lind
-der iøvrigt også kan dansk....