<?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: Programmeerijad ja rähnid</title>
	<atom:link href="http://www.targotennisberg.com/tarkvara/2008/05/14/programmeerijad-ja-rahnid/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.targotennisberg.com/tarkvara/2008/05/14/programmeerijad-ja-rahnid/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=programmeerijad-ja-rahnid</link>
	<description>Tarkvarast, tarkvaraprojektidest, tarkvaratööstusest ja muust seonduvast</description>
	<lastBuildDate>Wed, 08 Feb 2012 20:04:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Targo</title>
		<link>http://www.targotennisberg.com/tarkvara/2008/05/14/programmeerijad-ja-rahnid/comment-page-1/#comment-12375</link>
		<dc:creator>Targo</dc:creator>
		<pubDate>Fri, 13 Nov 2009 13:19:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.targotennisberg.com/tarkvara/?p=113#comment-12375</guid>
		<description>uudishimulik, vaata minu vastuseid Juri kommentaarile ülal, seal on seda teemat käsitletud.</description>
		<content:encoded><![CDATA[<p>uudishimulik, vaata minu vastuseid Juri kommentaarile ülal, seal on seda teemat käsitletud.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: uudisimulik</title>
		<link>http://www.targotennisberg.com/tarkvara/2008/05/14/programmeerijad-ja-rahnid/comment-page-1/#comment-10536</link>
		<dc:creator>uudisimulik</dc:creator>
		<pubDate>Tue, 27 Oct 2009 11:17:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.targotennisberg.com/tarkvara/?p=113#comment-10536</guid>
		<description>Aga, kas selline kood lahendaks selle probleemi, kui tahetakse lihtsalt massiivis
punased ja rohelised pallid sorteerida(p ees ja rohelised taga) kui teada et pallide arv ei ulatu miljonitesse vaid piirdub paarisajaga.
Sry vbl rumal küssa see, aga olen alles avastamas seda sorti maailma.

public static void Main(string[] arg)
    {
        ArrayList pallid = new ArrayList();
        pallid.Add(&quot;Punane_pall&quot;);
        pallid.Add(&quot;Roheline_pall&quot;);
        pallid.Add(&quot;Punane_pall&quot;);
        pallid.Add(&quot;Punane_pall&quot;);
        pallid.Add(&quot;Roheline_pall&quot;);
        pallid.Add(&quot;Punane_pall&quot;);
        pallid.Add(&quot;Punane_pall&quot;);

        pallid.Sort();
        for (int i = 0; i &lt; pallid.Count; i++)
        {
            Console.WriteLine(pallid[i]);
        }
    }
}</description>
		<content:encoded><![CDATA[<p>Aga, kas selline kood lahendaks selle probleemi, kui tahetakse lihtsalt massiivis<br />
punased ja rohelised pallid sorteerida(p ees ja rohelised taga) kui teada et pallide arv ei ulatu miljonitesse vaid piirdub paarisajaga.<br />
Sry vbl rumal küssa see, aga olen alles avastamas seda sorti maailma.</p>
<p>public static void Main(string[] arg)<br />
    {<br />
        ArrayList pallid = new ArrayList();<br />
        pallid.Add(&#8220;Punane_pall&#8221;);<br />
        pallid.Add(&#8220;Roheline_pall&#8221;);<br />
        pallid.Add(&#8220;Punane_pall&#8221;);<br />
        pallid.Add(&#8220;Punane_pall&#8221;);<br />
        pallid.Add(&#8220;Roheline_pall&#8221;);<br />
        pallid.Add(&#8220;Punane_pall&#8221;);<br />
        pallid.Add(&#8220;Punane_pall&#8221;);</p>
<p>        pallid.Sort();<br />
        for (int i = 0; i &lt; pallid.Count; i++)<br />
        {<br />
            Console.WriteLine(pallid[i]);<br />
        }<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Targo</title>
		<link>http://www.targotennisberg.com/tarkvara/2008/05/14/programmeerijad-ja-rahnid/comment-page-1/#comment-2546</link>
		<dc:creator>Targo</dc:creator>
		<pubDate>Thu, 11 Sep 2008 10:35:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.targotennisberg.com/tarkvara/?p=113#comment-2546</guid>
		<description>Hi Juri, sorry for not replying earlier, these days have been super busy.
First, I don&#039;t think we have any disagreement about the fact that code reuse is good. Obviously, you should use as much of the framework functionality as you can, *as long as you don&#039;t sacrifice any other important tenets*. As long as you&#039;ve only got 6 balls to sort, and swapping them takes a microsecond, who cares how you do it.
In this particular interview I had with this guy, he failed on multiple counts though:
- First, when someone asks you to create an algorithm for something and doesn&#039;t provide much extra information, you should never, ever just jump into coding. You should always ask the critical questions about the data and the expected behavior. In this super-simplified problem, the obvious questions are: how many balls are we talking about? If you have one hundred million balls, the difference between the optimal algorithm and Array.Sort() is huge and your solution will fail miserably. What is the nature of the balls? In code, things usually look simple, but if we are actually programming an industrial robot that is physically sorting some physical balls, every operation we save counts. Asking these questions is one of the things that separates developers from coders :)
- Second, it&#039;s absolutely critical to know how your underlying algorithms behave. We can usually assume that framework providers use good algorithms, but there are countless components and methods where this is not the case. And even when the algorithm is good, it might have some quirks that make it unsuitable for your particular problem. For example, do you know if Array.Sort is &lt;a href=&quot;http://en.wikipedia.org/wiki/Sorting_algorithm#Stability&quot; rel=&quot;nofollow&quot;&gt;stable&lt;/a&gt; or not? It doesn&#039;t matter in this case, but it might in some others (Array.Sort uses QuickSort, which is not stable).

cheers,
Targo</description>
		<content:encoded><![CDATA[<p>Hi Juri, sorry for not replying earlier, these days have been super busy.<br />
First, I don&#8217;t think we have any disagreement about the fact that code reuse is good. Obviously, you should use as much of the framework functionality as you can, *as long as you don&#8217;t sacrifice any other important tenets*. As long as you&#8217;ve only got 6 balls to sort, and swapping them takes a microsecond, who cares how you do it.<br />
In this particular interview I had with this guy, he failed on multiple counts though:<br />
- First, when someone asks you to create an algorithm for something and doesn&#8217;t provide much extra information, you should never, ever just jump into coding. You should always ask the critical questions about the data and the expected behavior. In this super-simplified problem, the obvious questions are: how many balls are we talking about? If you have one hundred million balls, the difference between the optimal algorithm and Array.Sort() is huge and your solution will fail miserably. What is the nature of the balls? In code, things usually look simple, but if we are actually programming an industrial robot that is physically sorting some physical balls, every operation we save counts. Asking these questions is one of the things that separates developers from coders <img src='http://www.targotennisberg.com/tarkvara/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
- Second, it&#8217;s absolutely critical to know how your underlying algorithms behave. We can usually assume that framework providers use good algorithms, but there are countless components and methods where this is not the case. And even when the algorithm is good, it might have some quirks that make it unsuitable for your particular problem. For example, do you know if Array.Sort is <a href="http://en.wikipedia.org/wiki/Sorting_algorithm#Stability" rel="nofollow">stable</a> or not? It doesn&#8217;t matter in this case, but it might in some others (Array.Sort uses QuickSort, which is not stable).</p>
<p>cheers,<br />
Targo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Juri</title>
		<link>http://www.targotennisberg.com/tarkvara/2008/05/14/programmeerijad-ja-rahnid/comment-page-1/#comment-2539</link>
		<dc:creator>Juri</dc:creator>
		<pubDate>Tue, 02 Sep 2008 10:59:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.targotennisberg.com/tarkvara/?p=113#comment-2539</guid>
		<description>No, I am not supporting laziness in programming. I just don&#039;t like some places at this article. You doing punishment of this man without improvements. Next code snippet improve part of truth at his solution. i don&#039;t need know how to Sort() function work. I think this is the good framework reuse.


class Program
    {
        static void Main(string[] args)
        {
            Ball[] balls = new Ball[] 
            { 
                new Ball(Color.Green), 
                new Ball(Color.Red),
                new Ball(Color.Green),
                new Ball(Color.Green),
                new Ball(Color.Green),
                new Ball(Color.Red),
            };
            Array.Sort(balls);

            foreach (Ball b in balls)
            {
                Console.WriteLine(b.Color.ToString());
            }
            Console.ReadLine();
        }
    }

    public enum Color : int
    {
        Red = 1,
        Green = 2
    }

    public class Ball : IComparable
    {
        public Color Color
        {
            get;
            private set;
        }

        public Ball(){}

        public Ball(Color color)
        {
            Color = color;
        }

        #region IComparable Members

        public int CompareTo(Ball other)
        {
            return this.Color.CompareTo(other.Color);
        }

        #endregion
    }</description>
		<content:encoded><![CDATA[<p>No, I am not supporting laziness in programming. I just don&#8217;t like some places at this article. You doing punishment of this man without improvements. Next code snippet improve part of truth at his solution. i don&#8217;t need know how to Sort() function work. I think this is the good framework reuse.</p>
<p>class Program<br />
    {<br />
        static void Main(string[] args)<br />
        {<br />
            Ball[] balls = new Ball[]<br />
            {<br />
                new Ball(Color.Green),<br />
                new Ball(Color.Red),<br />
                new Ball(Color.Green),<br />
                new Ball(Color.Green),<br />
                new Ball(Color.Green),<br />
                new Ball(Color.Red),<br />
            };<br />
            Array.Sort(balls);</p>
<p>            foreach (Ball b in balls)<br />
            {<br />
                Console.WriteLine(b.Color.ToString());<br />
            }<br />
            Console.ReadLine();<br />
        }<br />
    }</p>
<p>    public enum Color : int<br />
    {<br />
        Red = 1,<br />
        Green = 2<br />
    }</p>
<p>    public class Ball : IComparable<br />
    {<br />
        public Color Color<br />
        {<br />
            get;<br />
            private set;<br />
        }</p>
<p>        public Ball(){}</p>
<p>        public Ball(Color color)<br />
        {<br />
            Color = color;<br />
        }</p>
<p>        #region IComparable Members</p>
<p>        public int CompareTo(Ball other)<br />
        {<br />
            return this.Color.CompareTo(other.Color);<br />
        }</p>
<p>        #endregion<br />
    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Targo</title>
		<link>http://www.targotennisberg.com/tarkvara/2008/05/14/programmeerijad-ja-rahnid/comment-page-1/#comment-2531</link>
		<dc:creator>Targo</dc:creator>
		<pubDate>Thu, 28 Aug 2008 12:41:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.targotennisberg.com/tarkvara/?p=113#comment-2531</guid>
		<description>Hi Juri, thanks for commenting. As an advocate of &lt;a href=&quot;http://www.targotennisberg.com/tarkvara/?p=108&quot; rel=&quot;nofollow&quot;&gt;laziness in programming&lt;/a&gt;, I&#039;m a big time believer in code reuse, and I cringe every time when I see people reinventing the wheel.
However, I also believe that it is very important to pick the right tool for the job, and understand the properties of these tools well.
In this particular case the data had a very powerful constraint on it, as there were only two types of items in the array. Also, the way I phrased the problem to the interviewee implied that switching the balls was a costly operation, and we wanted to save as much time as possible. The idea here was that he would recognize these two special circumstances, and adapt his approach accordingly, as opposed to using a hammer to drive in a screw.
Regarding whether it&#039;s better to ask about the sorting algorithms, I think the time for such questions is in school. Once we are in real life, our customers don&#039;t care about algorithms, they care about whether we can take their data and apply the best approach to it. So I tend to ask somewhat vague, open-ended questions in interviews, because this is the nature of problems we face every day.

cheers,
Targo</description>
		<content:encoded><![CDATA[<p>Hi Juri, thanks for commenting. As an advocate of <a href="http://www.targotennisberg.com/tarkvara/?p=108" rel="nofollow">laziness in programming</a>, I&#8217;m a big time believer in code reuse, and I cringe every time when I see people reinventing the wheel.<br />
However, I also believe that it is very important to pick the right tool for the job, and understand the properties of these tools well.<br />
In this particular case the data had a very powerful constraint on it, as there were only two types of items in the array. Also, the way I phrased the problem to the interviewee implied that switching the balls was a costly operation, and we wanted to save as much time as possible. The idea here was that he would recognize these two special circumstances, and adapt his approach accordingly, as opposed to using a hammer to drive in a screw.<br />
Regarding whether it&#8217;s better to ask about the sorting algorithms, I think the time for such questions is in school. Once we are in real life, our customers don&#8217;t care about algorithms, they care about whether we can take their data and apply the best approach to it. So I tend to ask somewhat vague, open-ended questions in interviews, because this is the nature of problems we face every day.</p>
<p>cheers,<br />
Targo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Juri</title>
		<link>http://www.targotennisberg.com/tarkvara/2008/05/14/programmeerijad-ja-rahnid/comment-page-1/#comment-2530</link>
		<dc:creator>Juri</dc:creator>
		<pubDate>Tue, 26 Aug 2008 08:12:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.targotennisberg.com/tarkvara/?p=113#comment-2530</guid>
		<description>And you write sort method each time when you need sort array? 
Why did you take existing site template and adapt it for your? Write site by your self :). The main purpose of class or class library it is reusing in future!

Maybe you question was wrong and question should be: what is the better sort algorithm? What algorithms do you know?</description>
		<content:encoded><![CDATA[<p>And you write sort method each time when you need sort array?<br />
Why did you take existing site template and adapt it for your? Write site by your self <img src='http://www.targotennisberg.com/tarkvara/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . The main purpose of class or class library it is reusing in future!</p>
<p>Maybe you question was wrong and question should be: what is the better sort algorithm? What algorithms do you know?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

