Skip to contentSkip to conversation

gitweb: how to name main "action" subroutines?

DISCUSSION Jakub Narebski 3 participants 6 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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.

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#1 lore raw
Quoted 7 lines · --- Jakub Narebski

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

#2 lore raw

<opublikowany i wysłany>

Quoted 10 lines · Luben Tuikov
Quoted 7 lines · --- Jakub Narebski

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...

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#3 lore raw
In reply to Jakub Narebski
Quoted 4 lines · you

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

Quoted 3 lines

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

#4 lore raw
Quoted 8 lines · Josef Weidendorfer
Quoted 4 lines · you

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.

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#5 lore raw
Quoted 8 lines · Jakub Narebski
Quoted 6 lines · Josef Weidendorfer
Quoted 4 lines · you

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,...

Quoted 6 lines
Quoted 2 lines

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