Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » User lists of "bad" naming of classes, functions etc in U++...
Re: User lists of "bad" naming of classes, functions etc in U++... [message #23721 is a reply to message #23716] Tue, 17 November 2009 15:41 Go to previous messageGo to previous message
andrei_natanael is currently offline  andrei_natanael
Messages: 262
Registered: January 2009
Experienced Member
ag_newb wrote on Tue, 17 November 2009 11:00

Boost C++ naming system should be adopted.
reason: delimiting by underscore is safer than capitalization, IMHO.

Have you an argument for this?
void DoSomething(const String& paramOne) {}

void do_something(const string& param_one) {}


IMO, using second version(with underscores) takes more time to write because when you write _ you have to press Shift+_ and that means 2 key press more than camel case naming.

Using camelCase notation you identify clearly which is a method of a class or a public variable. For example, you could notate all member function using notation LikeThis and variables using notation likeThis. If a variable is an instance of a class which redefine operator () is clear that accessing it like instance.variableName() means calling operator () from variableName and not calling function variableName().
class X
{
  class Y { public: void operator() {} };
public:
  Y variableName;
  void CallMe() {}
};

class x
{
  class y { public: void operator() {} };
public:
  y variable_name;
  void call_me() {}
};

int main()
{
  X camelCaseNotation;
  x underscore_notation;
  camelCaseNotation.variableName(); // means calling operator () from variableName
  camelCaseNotation.CallMe(); // means calling a member function

  underscore_notation.variable_name(); // looks like we are calling a member function
  underscore_notation.call_me(); // ok, we are calling a member function
  return 0;
}

IMO camelCase make you easier understanding the context.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: BUG: Key states incorrectly cleared on Ubuntu
Next Topic: Painter DrawLine proposal
Goto Forum:
  


Current Time: Sun May 12 12:26:45 CEST 2024

Total time taken to generate the page: 0.03055 seconds