<?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/"
		>
<channel>
	<title>Comments on: Faster Rectangle Class</title>
	<atom:link href="http://www.stephencalenderblog.com/?feed=rss2&#038;p=293" rel="self" type="application/rss+xml" />
	<link>http://www.stephencalenderblog.com/?p=293&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=faster-rectangle-class</link>
	<description></description>
	<lastBuildDate>Thu, 29 Nov 2012 03:10:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Stephen Calender</title>
		<link>http://www.stephencalenderblog.com/?p=293&#038;cpage=1#comment-6394</link>
		<dc:creator>Stephen Calender</dc:creator>
		<pubDate>Fri, 12 Aug 2011 06:40:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.stephencalenderblog.com/?p=293#comment-6394</guid>
		<description><![CDATA[This is a good question.  For simple data structure like classes like points, vectors, and in this case rectangles I typically break the encapsulation rule of OOP.  Notice that I left the class members rx and ry public and rwidth and rheight as internal.   Since Flash is pass by value (you get a copy of the data, not the actual reference to the data) for the simple data types (Boolean, Uint, Int, Number, String) using a getter function is actually a pretty heavy operation since it creates memory.  If I wanted to maintain top, bottom, left, and right I would have to either always calculate them on the fly or enforce the use of setter functions for x, y, width, and height (more memory allocations).  I provided getters and setters as a courtesy to those that would frown on this practice, I personally avoid using getters and setters if I think I can get away with it.  Data structures for basic geometry have a pretty standard implementation, so it felt like it made sense. 

It was a tough call to make, the logic for my intersect and intersection functions would be clearer with those logical reference points.  However, I think I clocked the weight of a memory allocation / creating local variables in another post far exceeding the cost of some additional math. Every programmer is different, we all weigh the pros and cons differently, I put a high value on speed, particularly with data structures.]]></description>
		<content:encoded><![CDATA[<p>This is a good question.  For simple data structure like classes like points, vectors, and in this case rectangles I typically break the encapsulation rule of OOP.  Notice that I left the class members rx and ry public and rwidth and rheight as internal.   Since Flash is pass by value (you get a copy of the data, not the actual reference to the data) for the simple data types (Boolean, Uint, Int, Number, String) using a getter function is actually a pretty heavy operation since it creates memory.  If I wanted to maintain top, bottom, left, and right I would have to either always calculate them on the fly or enforce the use of setter functions for x, y, width, and height (more memory allocations).  I provided getters and setters as a courtesy to those that would frown on this practice, I personally avoid using getters and setters if I think I can get away with it.  Data structures for basic geometry have a pretty standard implementation, so it felt like it made sense. </p>
<p>It was a tough call to make, the logic for my intersect and intersection functions would be clearer with those logical reference points.  However, I think I clocked the weight of a memory allocation / creating local variables in another post far exceeding the cost of some additional math. Every programmer is different, we all weigh the pros and cons differently, I put a high value on speed, particularly with data structures.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kenny</title>
		<link>http://www.stephencalenderblog.com/?p=293&#038;cpage=1#comment-6388</link>
		<dc:creator>Kenny</dc:creator>
		<pubDate>Fri, 12 Aug 2011 00:55:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.stephencalenderblog.com/?p=293#comment-6388</guid>
		<description><![CDATA[Is there a reason you omitted the public properties such as &#039;left&#039;, &#039;top&#039;, etc.?]]></description>
		<content:encoded><![CDATA[<p>Is there a reason you omitted the public properties such as &#8216;left&#8217;, &#8216;top&#8217;, etc.?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tweets that mention Stephen Calender Programming Blog -- Topsy.com</title>
		<link>http://www.stephencalenderblog.com/?p=293&#038;cpage=1#comment-5987</link>
		<dc:creator>Tweets that mention Stephen Calender Programming Blog -- Topsy.com</dc:creator>
		<pubDate>Mon, 15 Nov 2010 12:58:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.stephencalenderblog.com/?p=293#comment-5987</guid>
		<description><![CDATA[[...] This post was mentioned on Twitter by Snorre Berge, Stephen Calender. Stephen Calender said: Its been a while but the blog is alive again: http://www.stephencalenderblog.com/?p=293 something for the Fellow Flash Developers [...]]]></description>
		<content:encoded><![CDATA[<p>[...] This post was mentioned on Twitter by Snorre Berge, Stephen Calender. Stephen Calender said: Its been a while but the blog is alive again: <a href="http://www.stephencalenderblog.com/?p=293" rel="nofollow">http://www.stephencalenderblog.com/?p=293</a> something for the Fellow Flash Developers [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todd</title>
		<link>http://www.stephencalenderblog.com/?p=293&#038;cpage=1#comment-5986</link>
		<dc:creator>Todd</dc:creator>
		<pubDate>Mon, 15 Nov 2010 11:43:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.stephencalenderblog.com/?p=293#comment-5986</guid>
		<description><![CDATA[It doesn&#039;t surprise me that their code would be clunkier. When dealing with a development team with several hundred coders, I&#039;m guessing not everyone is doing their best to optimize each class. 

Also, I would venture to say they were not focused on this entirely because their target market doesn&#039;t do this type of development much. Kind of like when there were all those companies doing 3d-esque engines with Flash, and Adobe didn&#039;t touch it; after a few years, they built their own into the IDE (if they didn&#039;t just buy one of the companies outright). 

Good stuff!]]></description>
		<content:encoded><![CDATA[<p>It doesn&#8217;t surprise me that their code would be clunkier. When dealing with a development team with several hundred coders, I&#8217;m guessing not everyone is doing their best to optimize each class. </p>
<p>Also, I would venture to say they were not focused on this entirely because their target market doesn&#8217;t do this type of development much. Kind of like when there were all those companies doing 3d-esque engines with Flash, and Adobe didn&#8217;t touch it; after a few years, they built their own into the IDE (if they didn&#8217;t just buy one of the companies outright). </p>
<p>Good stuff!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
