Why are methods like KIO::open_RenameDialog(), not called KIO::RenameDialog::open()?
richard_dale at tipitina.demon.co.uk
Thu May 31 12:17:51 BST 2007
On Thursday 31 May 2007, Thiago Macieira wrote:
> Richard Dale said:
> > In the KIO:: namespace there are various methods that are named like the
> > above
> > one, and I'm not sure why they aren't defined as static methods in the
> > class
> > named after the underscore, like this:
> > I ask because in language like C# and Java methods always have to be in a
> > class, even if they are static. So C++ methods in namespaces must be
> > moved into some sort of class. In this case for C#, I will probably need
> > to move the C++ open_RenameDialog() to a C# RenameDialog.Open() method to
> > get it to
> > work, and it would be easier if I didn't have to.
> Our current trend is to turn into namespaces all classes that have only
> static methods.
> That said, historically, KIO has had convenience methods in its namespace
> and in KIO::NetAccess to avoid having to create the objects for simple
> operations. Maybe they could still be gathered in a single place, to avoid
> populating KIO:: too much.
Well my point is that I can't see any reason why these methods are in a
namespace instead of in the classes that they could belong to as static
methods. If the original class name has to be encoded in the method name
like 'open_MyClassname', then it looks like some sort of workround to a
problem in C++, that an elegant naming scheme to me (imho underscores and
camel case don't mix). It is just as easy to type KIO::RenameDialog::open()
More information about the kde-core-devel