wxruby-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Wxruby-dev] Summary of naming problems


From: repeater
Subject: RE: [Wxruby-dev] Summary of naming problems
Date: Tue, 24 Jun 2003 21:06:59 +0200

Richard Kilmer wrote:
> On Sun, 2003-06-22 at 10:59, Kevin Smith wrote:
> > Ok. I've tried to figure out a way out of all of this. So I laid out all
> > the naming problems that I'm aware of right now. Here are the C++
> > wxWindows naming categories I've found, with examples:
> >
> > CLASS
> >  wxWindow
> >
> > CLASS METHOD
> >  GetPosition
> >
> > GLOBAL METHOD
> >  wxMessageBox
> >  EVT_MENU
> >
> > CONSTANT, PRE-DEFINED OBJECT, PTR TO PRE-DEFINED OBJECT
> >  wxSUNKEN_BORDER
> >  wxLIGHT_GREY
> >  wxNullColour
> >  wxDefaultPosition
> >  WXK_TAB
>
> Rich and Curt now agree on ruby style, and I'm willing to go along. And
> I think we have a consensus that we will discourage global including of
> Wx and encourage the use of Wx:: (or Wx.). So here's the latest proposal
> on the table:
>
> CLASS
>  Wx::Window
>
> CLASS METHOD
>  get_position
>
> GLOBAL METHOD
>  Wx.message_box
>  Wx.evt_menu
>
> CONSTANT, PRE-DEFINED OBJECT, PTR TO PRE-DEFINED OBJECT
>  Wx::SUNKEN_BORDER
>  Wx::LIGHT_GREY
>  Wx::NULL_COLOUR
>  Wx::DEFAULT_POSITION
>  Wx::K_TAB
>
> I think I can live with that. And it means I don't have to undo anything
> I've already done (Yea!).
>

Hi!

I like the idea conceptually of that "Wx" actually _doing_ something by
indicating a namespace.

But I just want to point out a few counter arguments:

-the effort of two extra characters (together with shift that means 3) that
is perhaps not needed
-code readability, especially since Wx* is so numerous
example:
    @calendar = Wx::CalendarCtrl.new(self, ID_CALENDAR, Wx::DefaultDateTime,
                                     Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
                                     Wx::CAL_MONDAY_FIRST |
                                     Wx::CAL_SHOW_HOLIDAYS |
                                     Wx::RAISED_BORDER)

    dlgSizer = Wx::BoxSizer.new(Wx::HORIZONTAL)
    calendarSizer = Wx::BoxSizer.new(Wx::VERTICAL)
    calendarSizer.Add(@calendar, 1, Wx::GROW)
    dlgSizer.Add(calendarSizer, 1, Wx::GROW)

vs

    @calendar = WxCalendarCtrl.new(self, ID_CALENDAR, WxDefaultDateTime,
                                     WxDEFAULT_POSITION, WxDEFAULT_SIZE,
                                     WxCAL_MONDAY_FIRST |
                                     WxCAL_SHOW_HOLIDAYS |
                                     WxRAISED_BORDER)

    dlgSizer = WxBoxSizer.new(WxHORIZONTAL)
    calendarSizer = WxBoxSizer.new(WxVERTICAL)
    calendarSizer.Add(@calendar, 1, WxGROW)
    dlgSizer.Add(calendarSizer, 1, WxGROW)
    SetSizer(dlgSizer)
    SetAutoLayout(TRUE)
    Layout()

For sure it is a matter of taste, but we must just make sure we can stomach
'::' in bulk.

-the cultural reorientation of people like me, who through experience with
other gui libs would 'include' the first thing that they see.

Keep up the good work!

regards
Peter





reply via email to

[Prev in Thread] Current Thread [Next in Thread]