<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Shape of Code &#187; naming</title>
	<atom:link href="http://shape-of-code.coding-guidelines.com/tag/naming/feed/" rel="self" type="application/rss+xml" />
	<link>http://shape-of-code.coding-guidelines.com</link>
	<description></description>
	<lastBuildDate>Sun, 29 Jan 2012 23:49:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Using local context to disambiguate source</title>
		<link>http://shape-of-code.coding-guidelines.com/2009/02/12/using-local-context-to-disambiguate-source/</link>
		<comments>http://shape-of-code.coding-guidelines.com/2009/02/12/using-local-context-to-disambiguate-source/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 01:23:45 +0000</pubDate>
		<dc:creator>Derek-Jones</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ambiguous]]></category>
		<category><![CDATA[context information]]></category>
		<category><![CDATA[declarations missing]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[naming]]></category>
		<category><![CDATA[parsing]]></category>

		<guid isPermaLink="false">http://shape-of-code.coding-guidelines.com/?p=67</guid>
		<description><![CDATA[Developers can often do a remarkably good job of figuring out what a snippet of code does without seeing (i.e., knowing anything about) most of the declarations of the identifiers involved. In a previous post I discussed how frequency of occurrence information could be used to help parse C without using a symbol table. Other [...]]]></description>
			<content:encoded><![CDATA[<p>Developers can often do a remarkably good job of figuring out what a snippet of code does without seeing (i.e., knowing anything about) most of the declarations of the identifiers involved.  In a previous post I discussed how frequency of occurrence information could be used to help <a href="http://shape-of-code.coding-guidelines.com/2008/12/parsing-without-a-symbol-table">parse C without using a symbol table</a>.  Other information that could be used is the context in which particular identifiers occur.  For instance, in:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">f<span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
y <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>f<span style="color: #009900;">&#41;</span>z<span style="color: #339933;">;</span></pre></div></div>

<p>while the code <code>f(x);</code> is probably a function call, the use of <code>f</code> as the type in a cast means that <code>f(x)</code> is actually a definition an object <code>x</code> having type <code>f</code>.</p>
<p>A project investigating the <a href="http://www.sable.mcgill.ca/publications/techreports/2008-2/sable-tr-2008-2.pdf">analysis of partial Java programs</a> uses this context information as its sole means of disambiguating Java source (while they do build a symbol table they do not analyze the source of any packages that might be imported).  Compared to C Java parsers have it easy, but Java&#8217;s richer type system means that semantic analysis can be much more complicated.</p>
<p>On a set of benchmarks the <a href="http://bart.prologique.com/projects/ppa">researchers</a> obtained a very reasonable 91.2% accuracy in deducing the type of identifiers.</p>
<p>There are other kinds of information that developers probably use to disambiguate source: the operation that the code is intended to perform and the identifier names.  Figuring out the &#8216;high level&#8217; operation that code performs is a very difficult problem, but the names of Java identifiers have been used to <a href="http://shape-of-code.coding-guidelines.com/2008/12/naming-used-to-predict-object-lifetime/">predict object lifetime</a> and appear to be used to help deduce <a href="http://www.knosof.co.uk/cbook/accu07.html">operator precedence</a>.  Parsing source by just looking at the identifiers (i.e., treating all punctuators and operators as whitespace) has been on my list of interesting project to do for some time, but projects that are likely to provide a more immediate interesting result keep getting in the way.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fshape-of-code.coding-guidelines.com%2F2009%2F02%2F12%2Fusing-local-context-to-disambiguate-source%2F&amp;title=Using%20local%20context%20to%20disambiguate%20source" id="wpa2a_2"><img src="http://shape-of-code.coding-guidelines.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://shape-of-code.coding-guidelines.com/2009/02/12/using-local-context-to-disambiguate-source/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Naming used to predict object lifetime</title>
		<link>http://shape-of-code.coding-guidelines.com/2008/12/05/naming-used-to-predict-object-lifetime/</link>
		<comments>http://shape-of-code.coding-guidelines.com/2008/12/05/naming-used-to-predict-object-lifetime/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 21:39:44 +0000</pubDate>
		<dc:creator>Derek-Jones</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[heap]]></category>
		<category><![CDATA[lifetime]]></category>
		<category><![CDATA[naming]]></category>

		<guid isPermaLink="false">http://shape-of-code.coding-guidelines.com/?p=20</guid>
		<description><![CDATA[One of the most surprising empirical results I heard about this year was that the name of a Java object could (reasonably) reliably be used to predict its lifetime on the heap. Being a huge advocate of the importance of naming I should not have been surprised. The author , Jeremy Singer, invited me to [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most surprising <a href="http://www.cs.man.ac.uk/~jsinger/pdfs/oopsla_sub.pdf">empirical results I heard about</a> this year was that the name of a Java object could (reasonably) reliably be used to predict its lifetime on the heap.  Being a huge advocate of the <a href="http://www.coding-guidelines.com/cbook/sent792.pdf">importance of naming</a> I should not have been surprised.</p>
<p>The author , <a href="http://www.cs.man.ac.uk/~jsinger/">Jeremy Singer</a>, invited me to Manchester to <a href="http://www.cs.manchester.ac.uk/research/seminars/school/abstracts.html?date=1224630000">talk about my own experiments</a> and I heard about his group&#8217;s latest project investigating how to subdivide a Java program so that bits of it can be executed on different processors.  I suggested various ways in which naming might be used to group semantically related functionality (would it do better than simple statement colocation you ask) and await to see if the group goes with any naming ideas (my suggestions were accompanied by a fair amount of arm waving, so I might have to wait a while).</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fshape-of-code.coding-guidelines.com%2F2008%2F12%2F05%2Fnaming-used-to-predict-object-lifetime%2F&amp;title=Naming%20used%20to%20predict%20object%20lifetime" id="wpa2a_4"><img src="http://shape-of-code.coding-guidelines.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://shape-of-code.coding-guidelines.com/2008/12/05/naming-used-to-predict-object-lifetime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

