<?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>alecmce.com &#187; naming conventions</title>
	<atom:link href="http://alecmce.com/tag/naming-conventions/feed" rel="self" type="application/rss+xml" />
	<link>http://alecmce.com</link>
	<description></description>
	<lastBuildDate>Thu, 10 Nov 2011 21:56:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Vector &#8211; Annoying Naming Conventions</title>
		<link>http://alecmce.com/as3/vector-annoying-naming-conventions</link>
		<comments>http://alecmce.com/as3/vector-annoying-naming-conventions#comments</comments>
		<pubDate>Mon, 31 Aug 2009 14:39:22 +0000</pubDate>
		<dc:creator>alecmce</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[opinion]]></category>
		<category><![CDATA[clean code]]></category>
		<category><![CDATA[naming conventions]]></category>
		<category><![CDATA[voronoi]]></category>

		<guid isPermaLink="false">http://alecmce.com/?p=306</guid>
		<description><![CDATA[When Adobe released the Flash Player 10 last year, it facilitated a new class, a strongly-typed array: Vector.&#60;T&#62;. I suppose we should all be grateful; now we can finally type arrays, leading to more robust code. I don&#8217;t feel very grateful, though. Adobe has given me a headache. In Geometry the word &#8220;vector&#8221; has a [...]]]></description>
			<content:encoded><![CDATA[<p>When Adobe released the Flash Player 10 last year, it facilitated a new class, a strongly-typed array: <a href="http://livedocs.adobe.com/flex/gumbo/langref/Vector.html"><code>Vector.&lt;T&gt;</code></a>. I suppose we should all be grateful; now we can finally type arrays, leading to more robust code. I don&#8217;t feel very grateful, though. Adobe has given me a headache.</p>
<p>In Geometry the word &#8220;vector&#8221; has a clear meaning: a vector describes a translation in space. To differentiate from other uses of the word, Wikipedia offer the terms <a href="http://en.wikipedia.org/wiki/Euclidean_vector">Euclidean, Spatial or Geometric Vector</a>. We recognise this use of the word because every single Flash coder understands the distinction between vector graphics and raster (or bitmap) graphics.</p>
<p>I have been working on a Geometric library recently (<a href="http://code.google.com/p/as3voronoi/">my as3voronoi library</a>), and have found the need to create an interface to encapsulate a translation in Cartesian space. What will I call it? It&#8217;s a vector, but &#8220;Vector&#8221; is going to cause a lot of headaches, because Adobe&#8217;s new Vector class is in the default namespace.</p>
<p>Which leads me to an utterly futile question: why on earth would they call their strongly-typed array class &#8220;Vector&#8221;? Why not facilitate the strong-typing of Arrays, since Array is the existing term? Untyped Arrays could be considered functionally equivalent to <code>Array.&lt;*&gt;</code> or <code>Array.&lt;Object&gt;</code>. I realise that Adobe cannot change this decision now it has been made, but why did they do it in the first place?</p>
<p>The only answer that I can see is that the vector class is in the C++ standard template library as a one-dimensional array. Was the decision made on the basis that if it&#8217;s good enough for C++, then it&#8217;s good enough for Flash? I hope not, because the Array class is not like the C++ array, and I don&#8217;t see &#8220;bitset&#8221;, &#8220;deque&#8221;, &#8220;list&#8221;, &#8220;map&#8221;, &#8220;queue&#8221;, &#8220;set&#8221;, or &#8220;stack&#8221; anywhere in the Flash library. Why adopt the C++ convention in just this context?</p>
<p>Flash has a different context to C++. Flash is a word used to describe a player that uses ActionScript and a <em>vector drawing tool</em> rolled into one. Surely the word &#8220;vector&#8221; has particular significance for the users of Adobe technology?</p>
<p>So what do I call my vector interface? &#8220;Vector2D&#8221;? &#8220;EuclideanVector&#8221;? I haven&#8217;t called my Polygon interface &#8220;Polygon2D&#8221; or &#8220;EuclideanPolygon&#8221;, nor my line interface &#8220;Line2D&#8221; or &#8220;EuclideanLine&#8221;. I don&#8217;t need to. The terse name does the job perfectly well. If I only target Flash Player 9 I don&#8217;t need to call my vector interface anything other than &#8220;Vector&#8221;.</p>
<p>The headache is unresolved; I am stuck with wanting an array to be an <code>Array</code> and a vector to be a <code>Vector</code>, but will have to accept that an array will be a <code>Vector</code> and a vector &#8230; something else.</p>
]]></content:encoded>
			<wfw:commentRss>http://alecmce.com/as3/vector-annoying-naming-conventions/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

