threads / discuss / 5058

gitweb: how to name main "action" subroutines?

Subject: gitweb: how to name main "action" subroutines?

## tl;dr

6 messages between Jul 31, 2006 and Jul 31, 2006.

replies: 5people: 3as markdown or json

Jakub Narebski· Jul 31, 2006, 14:03 UTC · lore

I'm going to rename some gitweb subroutines to better correspond to what given subroutine does. I have problem: how to name main "action" subroutines? Currently they use git_ prefix, e.g. git_logo. git_project_list, git_rss, git_summary, git_heads,...

I have thought about do_logo, or gitweb_logo, or out_logo etc., but somehow none is best.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Luben Tuikov· Jul 31, 2006, 17:26 UTC · re: Jakub Narebski · lore

Re: gitweb: how to name main "action" subroutines?

--- Jakub Narebski <jnareb@gmail.com> wrote:
Show 7 quoted lines
> I'm going to rename some gitweb subroutines to better correspond to what
> given subroutine does. I have problem: how to name main "action"
> subroutines? Currently they use git_ prefix, e.g. git_logo.
> git_project_list, git_rss, git_summary, git_heads,...
> 
> I have thought about do_logo, or gitweb_logo, or out_logo etc., but somehow
> none is best.
"git_<noun>_<verb>" ?  So then you'd have, for example "git_logo_show".
   Luben
Jakub Narebski· Jul 31, 2006, 17:50 UTC · re: Luben Tuikov · lore

Re: gitweb: how to name main "action" subroutines?

<opublikowany i wysłany>
Luben Tuikov wrote:
Show 10 quoted lines
> --- Jakub Narebski <jnareb@gmail.com> wrote:
>> I'm going to rename some gitweb subroutines to better correspond to what
>> given subroutine does. I have problem: how to name main "action"
>> subroutines? Currently they use git_ prefix, e.g. git_logo.
>> git_project_list, git_rss, git_summary, git_heads,...
>> 
>> I have thought about do_logo, or gitweb_logo, or out_logo etc., but somehow
>> none is best.
> 
> "git_<noun>_<verb>" ?  So then you'd have, for example "git_logo_show".

I'd rather reserve git_ prefix for subroutines which deal with git repository, either by calling git commands (e.g. git_get_type), or accessing git repository directly (e.g. git_read_hash, git_read_description).

I'm partial to either out_foo or gitweb_foo...
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Josef Weidendorfer· Jul 31, 2006, 18:38 UTC · re: Jakub Narebski · lore

Re: gitweb: how to name main "action" subroutines?

On Monday 31 July 2006 16:03, you wrote:
> I'm going to rename some gitweb subroutines to better correspond to what
> given subroutine does. I have problem: how to name main "action"
> subroutines? Currently they use git_ prefix, e.g. git_logo.
> git_project_list, git_rss, git_summary, git_heads,...

print_* or write_* ? At least, the functions print/write the HTML code to stdout of the script.

Josef
> 
> I have thought about do_logo, or gitweb_logo, or out_logo etc., but somehow
> none is best.
Jakub Narebski· Jul 31, 2006, 18:45 UTC · re: Josef Weidendorfer · lore

Re: gitweb: how to name main "action" subroutines?

Josef Weidendorfer wrote:
Show 8 quoted lines
> On Monday 31 July 2006 16:03, you wrote:
>> I'm going to rename some gitweb subroutines to better correspond to what
>> given subroutine does. I have problem: how to name main "action"
>> subroutines? Currently they use git_ prefix, e.g. git_logo.
>> git_project_list, git_rss, git_summary, git_heads,...
> 
> print_* or write_* ?
> At least, the functions print/write the HTML code to stdout of the script.

The problem is that there are subroutines which print _fragments_ of HTML code (like git_header_html or git_print_page_path) which would use probably print_ prefix. Action subroutines output always whole page.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Josef Weidendorfer· Jul 31, 2006, 20:41 UTC · re: Jakub Narebski · lore

Re: gitweb: how to name main "action" subroutines?

On Monday 31 July 2006 20:45, Jakub Narebski wrote:
Show 14 quoted lines
> Josef Weidendorfer wrote:
> 
> > On Monday 31 July 2006 16:03, you wrote:
> >> I'm going to rename some gitweb subroutines to better correspond to what
> >> given subroutine does. I have problem: how to name main "action"
> >> subroutines? Currently they use git_ prefix, e.g. git_logo.
> >> git_project_list, git_rss, git_summary, git_heads,...
> > 
> > print_* or write_* ?
> > At least, the functions print/write the HTML code to stdout of the script.
> 
> The problem is that there are subroutines which print _fragments_ of HTML
> code (like git_header_html or git_print_page_path) which would use probably
> print_ prefix. Action subroutines output always whole page.

Why not "print_*_page", if they print out a whole page? I would "git_header_html" rename to "print_header"; it's clear that it prints out HTML ;-) And "git_print_page_path" only needs stripping of "git_" prefix.

Josef

← back to recent threads