Bug 18 - Reconsider naming conventions
Status:
RESOLVED FIXED
Component:
Core
Version:
unspecified
Hardware:
All All
Importance:
P3 normal
Target Milestone:
---
Assignee:
Rob Caelers
URL:
Depends on:
Blocks:
Reported:
Sep 1 2002 20:33:17 UTC
by:
Raymond Penners
Modified:
Sep 8 2002 20:54:32 UTC
CC List:
Raymond Penners
| Who | When | What | Removed | Added |
|---|---|---|---|---|
| Rob Caelers | Sep 1 2002 22:48:41 UTC | assigned_to | Rob Caelers | Raymond Penners |
| Raymond Penners | Sep 2 2002 23:42:41 UTC | status | NEW | RESOLVED |
| resolution | FIXED | |||
| Raymond Penners | Sep 8 2002 20:21:16 UTC | cc | Raymond Penners | |
| status | RESOLVED | REOPENED | ||
| resolution | FIXED | |||
| Raymond Penners | Sep 8 2002 20:21:29 UTC | assigned_to | Raymond Penners | Rob Caelers |
| status | REOPENED | NEW | ||
| Rob Caelers | Sep 8 2002 20:45:38 UTC | status | NEW | ASSIGNED |
| Rob Caelers | Sep 8 2002 20:54:32 UTC | status | ASSIGNED | RESOLVED |
| resolution | FIXED |
Description
Raymond Penners Sep 1 2002 20:33:17 UTC
The studlyCaps naming conventions conflict with the standard GNU, Gnome and GTK naming conventions. Consider a custom Frame class (Gtk::Frame style). It would have the following methods: void setFrameWidth(guint width); // workrave method void set_border_width(guint width); // inherited method void setFrameStyle(Style style); void setFrameColor(Gdk::Color color); void setBlinking(bool); IMHO, the above is bad for code readability (and butt-ugly ;-) Solution: void set_frame_width(guint width); // workrave method void set_border_width(guint width); // inherited method void set_frame_style(Style style); void set_frame_cColor(Gdk::Color color); void set_blinking(bool); I hereby request humble permission to use the latter set of API names for my custom frame class, and gradually phase out all studlyCaps.
Comment 1
Rob Caelers Sep 1 2002 21:07:31 UTC
Uhh. If your class behaves like a gtkmm class, it might as well look like one. So, I don't mind the underscores. Still not realy conviced about converting everything to underscores...can it be done (semi-) automatically ?
Comment 2
Raymond Penners Sep 1 2002 22:41:11 UTC
Sure. A couple of lines of perl doing:
1) destudlify.pl `find . -name '*.cc'` :
foreach (@ARGV)
{
// collect \1 in "Class::(fooBar)" where fooBar != Class
collect_all_symbols_for_file($_);
}
foreach (@ARGV)
{
destudlify($_);
}
2) while (! compiles_error_free()) { edit; make; }
I am volunteering.
Comment 3
Rob Caelers Sep 1 2002 22:48:41 UTC
Be my guest. Just to be sure: only underscores for methods and variables. Class names and filenames remain studly. Ok ? Please add a CVS tag before performing an automatic mass-rename. Just in case... (I seems that almost all my pre-workrave code uses underscores....Damn coding standards at work...)
Comment 4
Raymond Penners Sep 8 2002 20:21:16 UTC
Constants are still in error:
enum Command
{
CmdNone,
CmdUpdate,
CmdTimerAction,
CmdTerminate
};
What coding standards prescribe the above? (Java doesn't).
Correct (Java/GTK/GNOME) would be:
enum Command
{
CMD_NONE,
CMD_UPDATE,
CMD_TIMER_ACTION,
CMD_TERMINATE
};
What do you think, Rob?Comment 5
Rob Caelers Sep 8 2002 20:45:38 UTC
Some constants already use all-caps. fixing.
Comment 6
Rob Caelers Sep 8 2002 20:54:32 UTC
Fixed