<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	
	>
<channel>
	<title>
	Comments on: How to choose good names in your code	</title>
	<atom:link href="https://www.fluentcpp.com/2017/01/30/how-to-choose-good-names/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/2017/01/30/how-to-choose-good-names/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Mon, 18 Sep 2017 07:04:44 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.3</generator>
	<item>
		<title>
		By: Amir Shrestha		</title>
		<link>https://www.fluentcpp.com/2017/01/30/how-to-choose-good-names/#comment-475</link>

		<dc:creator><![CDATA[Amir Shrestha]]></dc:creator>
		<pubDate>Tue, 08 Aug 2017 22:06:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=427#comment-475</guid>

					<description><![CDATA[Consistency in coding style is good... However, this is very challenging to achieve in practice because we may have many third party libraries that follows its own coding guidelines, and your company may have its own guideline...
There is always a debate on how to name your class member variable...
m_data or _data or data_ ?
Another example is, C++ standard library uses vector as a class name, Qt library uses QVector ...

It would be great if we have a uniform naming convention across all projects...

And the C++ coding guidelines says in NL.8: Use a consistent naming style

There are many styles and when you use multiple libraries, you can&#039;t follow all their different conventions. Choose a &quot;house style&quot;, but leave &quot;imported&quot; libraries with their original style.]]></description>
			<content:encoded><![CDATA[<p>Consistency in coding style is good&#8230; However, this is very challenging to achieve in practice because we may have many third party libraries that follows its own coding guidelines, and your company may have its own guideline&#8230;<br />
There is always a debate on how to name your class member variable&#8230;<br />
m_data or _data or data_ ?<br />
Another example is, C++ standard library uses vector as a class name, Qt library uses QVector &#8230;</p>
<p>It would be great if we have a uniform naming convention across all projects&#8230;</p>
<p>And the C++ coding guidelines says in NL.8: Use a consistent naming style</p>
<p>There are many styles and when you use multiple libraries, you can&#8217;t follow all their different conventions. Choose a &#8220;house style&#8221;, but leave &#8220;imported&#8221; libraries with their original style.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Dan Gendreau		</title>
		<link>https://www.fluentcpp.com/2017/01/30/how-to-choose-good-names/#comment-81</link>

		<dc:creator><![CDATA[Dan Gendreau]]></dc:creator>
		<pubDate>Sat, 04 Feb 2017 01:11:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=427#comment-81</guid>

					<description><![CDATA[One technique that helps me to find the best names for function parameters is to write a quick Doxygen comment before writing the function signature. By writing the function&#039;s Doxygen brief in simplest terms, the parameter names will emerge naturally and the resulting implementation usually reads more fluently. e.g.

/// Insert a p note with the specified p velocity into the note p stack in sorted order.
void NsInsertSorted( NoteStack* stack, uint8_t note, uint8_t velocity );]]></description>
			<content:encoded><![CDATA[<p>One technique that helps me to find the best names for function parameters is to write a quick Doxygen comment before writing the function signature. By writing the function&#8217;s Doxygen brief in simplest terms, the parameter names will emerge naturally and the resulting implementation usually reads more fluently. e.g.</p>
<p>/// Insert a p note with the specified p velocity into the note p stack in sorted order.<br />
void NsInsertSorted( NoteStack* stack, uint8_t note, uint8_t velocity );</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: triangle_soup {neil}		</title>
		<link>https://www.fluentcpp.com/2017/01/30/how-to-choose-good-names/#comment-80</link>

		<dc:creator><![CDATA[triangle_soup {neil}]]></dc:creator>
		<pubDate>Thu, 02 Feb 2017 23:44:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=427#comment-80</guid>

					<description><![CDATA[I would also suggest that it&#039;s important to remove ambiguity and avoid the use of prefix verbs such as compute or calculate for function names, which are largely meaningless since everything is computed or calculated, especially when you use auto; e.g.

computeEmployeeSalaries (); // Looks like intention is to call an &quot;update&quot; function.
const auto result = computeEmployeeSalaries(); // Looks like result holds the call status. Wrong.

Remove &#039;compute&#039; and things start to look a lot different; e.g.

getEmployeeSalaries (); 
const auto result = getEmployeeSalaries();
const auto result = employeeSalaries ();

Edit: 
Once the &#039;compute&#039; prefix has been removed,  &#039;result&#039; looks inappropriate, which is a good thing and my intention with this example. It&#039;s a poor variable name, after all.]]></description>
			<content:encoded><![CDATA[<p>I would also suggest that it&#8217;s important to remove ambiguity and avoid the use of prefix verbs such as compute or calculate for function names, which are largely meaningless since everything is computed or calculated, especially when you use auto; e.g.</p>
<p>computeEmployeeSalaries (); // Looks like intention is to call an &#8220;update&#8221; function.<br />
const auto result = computeEmployeeSalaries(); // Looks like result holds the call status. Wrong.</p>
<p>Remove &#8216;compute&#8217; and things start to look a lot different; e.g.</p>
<p>getEmployeeSalaries ();<br />
const auto result = getEmployeeSalaries();<br />
const auto result = employeeSalaries ();</p>
<p>Edit:<br />
Once the &#8216;compute&#8217; prefix has been removed,  &#8216;result&#8217; looks inappropriate, which is a good thing and my intention with this example. It&#8217;s a poor variable name, after all.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2017/01/30/how-to-choose-good-names/#comment-78</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Thu, 02 Feb 2017 17:43:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=427#comment-78</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/01/30/how-to-choose-good-names/#comment-73&quot;&gt;Bartlomiej Filipek&lt;/a&gt;.

By now we&#039;ve realised the importance of good naming, so in the new code we add or refactor, we really do our best to use good names everywhere, so 90% I would say. But in old code it really varies!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/01/30/how-to-choose-good-names/#comment-73">Bartlomiej Filipek</a>.</p>
<p>By now we&#8217;ve realised the importance of good naming, so in the new code we add or refactor, we really do our best to use good names everywhere, so 90% I would say. But in old code it really varies!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2017/01/30/how-to-choose-good-names/#comment-79</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Thu, 02 Feb 2017 17:43:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=427#comment-79</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/01/30/how-to-choose-good-names/#comment-75&quot;&gt;Jörg&lt;/a&gt;.

thanks for sharing your experience Jörg.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/01/30/how-to-choose-good-names/#comment-75">Jörg</a>.</p>
<p>thanks for sharing your experience Jörg.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jörg		</title>
		<link>https://www.fluentcpp.com/2017/01/30/how-to-choose-good-names/#comment-75</link>

		<dc:creator><![CDATA[Jörg]]></dc:creator>
		<pubDate>Wed, 01 Feb 2017 18:43:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=427#comment-75</guid>

					<description><![CDATA[I would like to add another point: If your variable has units, spell them out! Ages are usually given in years, so it&#039;s fine to leave it at that. But you should always write speed_m_s to save the next person from searching for any hint whether it may be km/h or mi/h.
I have found several bugs in code reviews just by fixing this!]]></description>
			<content:encoded><![CDATA[<p>I would like to add another point: If your variable has units, spell them out! Ages are usually given in years, so it&#8217;s fine to leave it at that. But you should always write speed_m_s to save the next person from searching for any hint whether it may be km/h or mi/h.<br />
I have found several bugs in code reviews just by fixing this!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Bartlomiej Filipek		</title>
		<link>https://www.fluentcpp.com/2017/01/30/how-to-choose-good-names/#comment-73</link>

		<dc:creator><![CDATA[Bartlomiej Filipek]]></dc:creator>
		<pubDate>Tue, 31 Jan 2017 07:27:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=427#comment-73</guid>

					<description><![CDATA[Thanks for a great article.

I am glad that you mentioned negations. It&#039;s best to avoid them! It&#039;s especially confusing if you have a name that has a negation (like &quot;IsNotValid&quot;) and you try to use it in a bit more complicated condition. So &#039;stay positive&#039; is a good advice here :D

What&#039;s your experience when it comes to actual code bases... are/were your projects using proper names all the time? 50% of cases? 20%?
From what I&#039;ve seen it could be around 50...60%.]]></description>
			<content:encoded><![CDATA[<p>Thanks for a great article.</p>
<p>I am glad that you mentioned negations. It&#8217;s best to avoid them! It&#8217;s especially confusing if you have a name that has a negation (like &#8220;IsNotValid&#8221;) and you try to use it in a bit more complicated condition. So &#8216;stay positive&#8217; is a good advice here 😀</p>
<p>What&#8217;s your experience when it comes to actual code bases&#8230; are/were your projects using proper names all the time? 50% of cases? 20%?<br />
From what I&#8217;ve seen it could be around 50&#8230;60%.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
