<?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: A Quick Tutorial on Casting</title>
	<atom:link href="http://flexblog.faratasystems.com/2010/06/10/a-quick-tutorial-on-casting/feed" rel="self" type="application/rss+xml" />
	<link>http://flexblog.faratasystems.com/2010/06/10/a-quick-tutorial-on-casting</link>
	<description>A blog about our experience with Adobe Flex</description>
	<lastBuildDate>Sun, 15 Jan 2012 16:29:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ron</title>
		<link>http://flexblog.faratasystems.com/2010/06/10/a-quick-tutorial-on-casting/comment-page-1#comment-73681</link>
		<dc:creator>Ron</dc:creator>
		<pubDate>Fri, 11 Jun 2010 03:36:05 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=849#comment-73681</guid>
		<description>@Yakov yes sir. type casting is used in lots of situations to implement polymorphic (one name, many forms) behavior with respect to references type (like what you already said). thanks for refreshing us about the essence of OOP using casting ^_^</description>
		<content:encoded><![CDATA[<p>@Yakov yes sir. type casting is used in lots of situations to implement polymorphic (one name, many forms) behavior with respect to references type (like what you already said). thanks for refreshing us about the essence of OOP using casting ^_^</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://flexblog.faratasystems.com/2010/06/10/a-quick-tutorial-on-casting/comment-page-1#comment-73675</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Fri, 11 Jun 2010 01:53:47 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=849#comment-73675</guid>
		<description>Yakov, your example has nothing to do with casting. It&#039;s all about RTTI. You can do the same with JavaScript or Python without *casting*</description>
		<content:encoded><![CDATA[<p>Yakov, your example has nothing to do with casting. It&#8217;s all about RTTI. You can do the same with JavaScript or Python without *casting*</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chinmay</title>
		<link>http://flexblog.faratasystems.com/2010/06/10/a-quick-tutorial-on-casting/comment-page-1#comment-73661</link>
		<dc:creator>Chinmay</dc:creator>
		<pubDate>Thu, 10 Jun 2010 19:39:35 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=849#comment-73661</guid>
		<description>Thats one of the best n simplest example i have ever read of typecasting. Hope to get more by u on such basic concepts Yakov.</description>
		<content:encoded><![CDATA[<p>Thats one of the best n simplest example i have ever read of typecasting. Hope to get more by u on such basic concepts Yakov.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yakov Fain</title>
		<link>http://flexblog.faratasystems.com/2010/06/10/a-quick-tutorial-on-casting/comment-page-1#comment-73659</link>
		<dc:creator>Yakov Fain</dc:creator>
		<pubDate>Thu, 10 Jun 2010 18:52:21 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=849#comment-73659</guid>
		<description>@Mykola My goal is to keep the code simple and use polymorphism that&#039;s nicely supported in Java.  I guess, I need to write a follow up blog showing such an  example.</description>
		<content:encoded><![CDATA[<p>@Mykola My goal is to keep the code simple and use polymorphism that&#8217;s nicely supported in Java.  I guess, I need to write a follow up blog showing such an  example.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mykola Golubyev</title>
		<link>http://flexblog.faratasystems.com/2010/06/10/a-quick-tutorial-on-casting/comment-page-1#comment-73658</link>
		<dc:creator>Mykola Golubyev</dc:creator>
		<pubDate>Thu, 10 Jun 2010 18:40:19 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=849#comment-73658</guid>
		<description>@Yakov, I would add some method to the base class if it is appropriate (make sense), or else I would create Strategy hierarchy and would use it&#039;s methods to process taxes or something.
Of course there is can be the place in the code which has to go through different subtypes and create for example appropriate strategies or something, but the idea is to keep that place isolated and not mess it with the business logic.</description>
		<content:encoded><![CDATA[<p>@Yakov, I would add some method to the base class if it is appropriate (make sense), or else I would create Strategy hierarchy and would use it&#8217;s methods to process taxes or something.<br />
Of course there is can be the place in the code which has to go through different subtypes and create for example appropriate strategies or something, but the idea is to keep that place isolated and not mess it with the business logic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yakov Fain</title>
		<link>http://flexblog.faratasystems.com/2010/06/10/a-quick-tutorial-on-casting/comment-page-1#comment-73656</link>
		<dc:creator>Yakov Fain</dc:creator>
		<pubDate>Thu, 10 Jun 2010 18:32:03 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=849#comment-73656</guid>
		<description>@Mykola I guess, you mean generics, but what do you do if an array has to store instances of different types - Employee and Contractor?

Can you offer a better solution if you need to populate an array with different instances and then process them in a uniform manner?</description>
		<content:encoded><![CDATA[<p>@Mykola I guess, you mean generics, but what do you do if an array has to store instances of different types &#8211; Employee and Contractor?</p>
<p>Can you offer a better solution if you need to populate an array with different instances and then process them in a uniform manner?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mykola Golubyev</title>
		<link>http://flexblog.faratasystems.com/2010/06/10/a-quick-tutorial-on-casting/comment-page-1#comment-73655</link>
		<dc:creator>Mykola Golubyev</dc:creator>
		<pubDate>Thu, 10 Jun 2010 18:21:00 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=849#comment-73655</guid>
		<description>Just would like to notice that before Java 5 casting was a normal way you write your program. And since Java 5 casting means you didn&#039;t design your classes properly. And thus, you should think twice before casting anything explicitly.</description>
		<content:encoded><![CDATA[<p>Just would like to notice that before Java 5 casting was a normal way you write your program. And since Java 5 casting means you didn&#8217;t design your classes properly. And thus, you should think twice before casting anything explicitly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yakov Fain</title>
		<link>http://flexblog.faratasystems.com/2010/06/10/a-quick-tutorial-on-casting/comment-page-1#comment-73652</link>
		<dc:creator>Yakov Fain</dc:creator>
		<pubDate>Thu, 10 Jun 2010 17:46:20 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=849#comment-73652</guid>
		<description>@Saverio Agree, if (workers[i] instanceof Insurable) can make it a little cleaner. I was implying that only Employee can be Insurable :)

@Ron casting is used in lots of situations that implement polymorphic behavior.

@rauch You may be surprised, but there are millions of software developers who never read anything by Stroustrup. But I hope that even those who did can use this blog as a refresher :)</description>
		<content:encoded><![CDATA[<p>@Saverio Agree, if (workers[i] instanceof Insurable) can make it a little cleaner. I was implying that only Employee can be Insurable <img src='http://flexblog.faratasystems.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>@Ron casting is used in lots of situations that implement polymorphic behavior.</p>
<p>@rauch You may be surprised, but there are millions of software developers who never read anything by Stroustrup. But I hope that even those who did can use this blog as a refresher <img src='http://flexblog.faratasystems.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rauch</title>
		<link>http://flexblog.faratasystems.com/2010/06/10/a-quick-tutorial-on-casting/comment-page-1#comment-73650</link>
		<dc:creator>rauch</dc:creator>
		<pubDate>Thu, 10 Jun 2010 17:02:35 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=849#comment-73650</guid>
		<description>It&#039;s quite simple, isn&#039;t it?
I think  Bjarne Stroustrup has already wrtitten enough about it.</description>
		<content:encoded><![CDATA[<p>It&#8217;s quite simple, isn&#8217;t it?<br />
I think  Bjarne Stroustrup has already wrtitten enough about it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ron</title>
		<link>http://flexblog.faratasystems.com/2010/06/10/a-quick-tutorial-on-casting/comment-page-1#comment-73649</link>
		<dc:creator>Ron</dc:creator>
		<pubDate>Thu, 10 Jun 2010 16:42:58 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=849#comment-73649</guid>
		<description>Sir, that is clear. We need to cast when we are assigning a super type to a sub type. We are more likely to use casting when working with the non-generic Java Collections Framework or passing parameters to a method call IMHO :)</description>
		<content:encoded><![CDATA[<p>Sir, that is clear. We need to cast when we are assigning a super type to a sub type. We are more likely to use casting when working with the non-generic Java Collections Framework or passing parameters to a method call IMHO <img src='http://flexblog.faratasystems.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Saverio Trioni</title>
		<link>http://flexblog.faratasystems.com/2010/06/10/a-quick-tutorial-on-casting/comment-page-1#comment-73648</link>
		<dc:creator>Saverio Trioni</dc:creator>
		<pubDate>Thu, 10 Jun 2010 16:30:42 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=849#comment-73648</guid>
		<description>Just a couple of comments:

First: in your last example if you are looking for the Insurable interface, you could just plainly use 

if (workers[i] instanceof Insurable) { ....

because otherwise you&#039;ll lose all other instances of classes which implement Insurable. It&#039;s much more interesting to work with interfaces anyway (many more pros than cons wrt using classes for type checking and type-dependant data process).

OTOS, in the main cycle (for (int i; i&lt;20; i++) { ), it&#039;s a mistake not to initialize the counter, even if all the implementations of the JVM automatically initialize integers to 0. Being that this post is aimed to novel programmers, I think it&#039;s worth to keep an eye over this kind of &quot;guru&quot;-style programming, which can lead juniors to make big mistakes.

Best regards and thanks for all the interesting content you post.</description>
		<content:encoded><![CDATA[<p>Just a couple of comments:</p>
<p>First: in your last example if you are looking for the Insurable interface, you could just plainly use </p>
<p>if (workers[i] instanceof Insurable) { &#8230;.</p>
<p>because otherwise you&#8217;ll lose all other instances of classes which implement Insurable. It&#8217;s much more interesting to work with interfaces anyway (many more pros than cons wrt using classes for type checking and type-dependant data process).</p>
<p>OTOS, in the main cycle (for (int i; i&lt;20; i++) { ), it&#039;s a mistake not to initialize the counter, even if all the implementations of the JVM automatically initialize integers to 0. Being that this post is aimed to novel programmers, I think it&#039;s worth to keep an eye over this kind of &quot;guru&quot;-style programming, which can lead juniors to make big mistakes.</p>
<p>Best regards and thanks for all the interesting content you post.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

