[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: outlet v. context
From: |
Carl Sorensen |
Subject: |
Re: outlet v. context |
Date: |
Tue, 7 Jul 2020 17:20:08 -0600 |
On Tue, Jul 7, 2020 at 5:05 PM Dan Eble <dan@faithful.be> wrote:
> On Jul 4, 2020, at 11:27, Dan Eble <dan@faithful.be> wrote:
> >
> > Ugh. I'm working on the outlet/context change now (involving lots of
> rebasing of my work in progress). I'll probably be unwilling to do more
> than that immediately, but regardless, I should let others weigh in on
> get_foo() v. foo() first.
>
> I prefer get_foo(). I tend to interpret function names as verbs and
> "get_" clarifies when they are not. Context can help, but I'd rather have
> the "get_".
>
> group() get_group()
> start() get_start()
> error() get_error()
> rank() get_rank()
> bound() get_bound()
> output() get_output()
> rest() get_rest()
> note() get_note()
> flag() get_flag()
> position() get_position()
> control_points() get_control_points()
> list() get_list()
>
I appreciate your preference, but mine is exactly opposite.
The only time I would like a member function of a class to have a verb name
is when it causes a side effect.
When the job of a function is to return a result that can be used
elsewhere, to me the goal is a result, and hence, it is a noun. flag()
refers to an object -- a flag. get_flag focuses on the action, not the
result. And most often, it's the result that I want -- which is a noun.
This is just my opinion, and I can live with it either way. But I think
that get_ is just unneeded noise in most cases.
Thanks,
Carl