<?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>d3orn.ch</title>
	<atom:link href="http://www.d3orn.ch/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.d3orn.ch</link>
	<description></description>
	<lastBuildDate>Fri, 25 Feb 2011 21:23:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>News</title>
		<link>http://www.d3orn.ch/2011/news/</link>
		<comments>http://www.d3orn.ch/2011/news/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 21:11:12 +0000</pubDate>
		<dc:creator>d3orn</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.d3orn.ch/?p=1274</guid>
		<description><![CDATA[hey there, I know it has been a long time since I posted something here but I did had a lot of work and I still have. Therefore it was kind of impossible to keep up my blog column the way I did before and I&#8217;m very sorry about that. I know I have disappointed [...]]]></description>
			<content:encoded><![CDATA[<p>hey there,<br />
I know it has been a long time since I posted something here but I did had a lot of work and I still have. Therefore it was kind of impossible to keep up my blog column the way I did before and I&#8217;m very sorry about that. I know I have disappointed a lot of people and I try to make it up to you somehow.<br />
But I also do have good news!<br />
First of all like I already said I do work a lot currently it&#8217;s like 150% work every week! But as a result I do have more to tweet and blog about and I&#8217;m reducing my WoW time quite a bit, not because it&#8217;s boring it&#8217;s still the best game out there but it consumes so much time I could sometimes use better. I&#8217;m cutting down on this time and try to use my &#8220;free&#8221; time for other things like blogging, working and probably I&#8217;m going to try out &#8220;Magic &#8211; The Gathering&#8221; again &#8211; who knows.<br />
What does that mean for you?<br />
Mhm first of all you will see blogposts again! (btw I wrote a post on <a href="http://p2unibe.tumblr.com/">p2unibe-blog</a> and you should check it out!)<br />
You will not see a column currently cause I&#8217;m a creative person and I can&#8217;t work with such strict posting routine it&#8217;s just not working for me!<br />
I do like to continue the column not every month but whenever I like to. Therefore I&#8217;m trying to make my first Screencast soon.<br />
Secondly you&#8217;ll probably see some post about my work as a University assistant and my other job (I have to check what I can post on the internet first) and you will see post about a CS-students life again.<br />
Thirdly I would really like to use Screencasts and make some cool tutorials for git, TDD (Test-Driven-Design) and process analysis.<br />
Finally expect some none CS related stuff on this page (different category)<br />
So final result: You should see a positive improvement of this blog soon and <strong>I&#8217;m back</strong> but I&#8217;ll not post on a regular basis.<br />
You should also checkout the blog mentioned above for some posts from me.<br />
Cheers and I hope you&#8217;ll like my blog again!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.d3orn.ch/2011/news/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Write Tests Part 2.1 &#8211; How to Write Tests in Java</title>
		<link>http://www.d3orn.ch/2010/write-tests-part-2-1-how-to-write-tests-in-java/</link>
		<comments>http://www.d3orn.ch/2010/write-tests-part-2-1-how-to-write-tests-in-java/#comments</comments>
		<pubDate>Thu, 14 Oct 2010 17:44:23 +0000</pubDate>
		<dc:creator>d3orn</dc:creator>
				<category><![CDATA[How I write code]]></category>

		<guid isPermaLink="false">http://www.d3orn.ch/?p=1144</guid>
		<description><![CDATA[hey there, last month I wrote about UnitTests and this time I would like to show you how such tests can be written in Java and in two weeks I&#8217;ll show you how it&#8217;s done in Pharo. Isn&#8217;t this cool? Two column articles in one month! Although the new semester has started a few weeks [...]]]></description>
			<content:encoded><![CDATA[<p>hey there,<br />
last month I wrote about UnitTests and this time I would like to show you how such tests can be written in Java and in two weeks I&#8217;ll show you how it&#8217;s done in Pharo. Isn&#8217;t this cool? Two column articles in one month! Although the new semester has started a few weeks ago I&#8217;m more into writing articles then ever.</p>
<h2>How to Write Tests</h2>
<p>First of all like I mentioned last month there are a few different methods for testing. The most important in Java is <em><strong>assertEquals</strong></em> as it gives more helpful output if the test fails. There are other assertion methods and if you want, have a look at the <a title="Assert JDoc" href="http://www.junit.org/apidocs/org/junit/Assert.html">Assert-JavaDoc</a>.</p>
<p>I showed you how to create test cases and the important testing methods so let&#8217;s start writing tests. Since <strong>JUnit 4</strong> it&#8217;s much easier to write tests because you<strong> don&#8217;t have to care</strong> about <strong>testsuites</strong> and tests don&#8217;t need the word &#8220;test&#8221; in their method name to be recognized as a test. To go on with there are only a few things you have to do to write tests.</p>
<p>Firstly if you want to test complex classes and programs you have to <strong>initialize the required objects and their states</strong>. To do so the first method in our test case is named <strong>setUp</strong> and in front of this method you have to write <strong>@Before</strong> and import the necessary package. This setUp method will be called before each test you execute.</p>
<p>The next step is to write the actual test methods. You create a new test method by simply writing <strong>@Test</strong> in front of the method, isn&#8217;t it easy? Note that it&#8217;s considered good style to use method names starting with <strong>should </strong>or<strong> shouldNot</strong> and then write what you want to test so that it is clear, what is asserted. Have a look at the following test skeleton to see how this all would look like:</p>
<pre>	@Test
	public void shouldBeEmpty(){
		...
	}</pre>
<p>Sometimes you like to <strong>test if an error is thrown</strong>, probably see if the check for meaningless input works. For example if you pop an empty stack there should be an error &#8211; and it&#8217;s a failure, if there is not! To test this you have to write the expected error right after @Test. It should look like this:</p>
<pre>	@Test (expected=AssertionError.class)</pre>
<p>Now if and only if this error is raised the test will pass.</p>
<p>Last but not least I&#8217;m going to show you an example with a few tests. It&#8217;s a very simple and trivial one and it&#8217;s not a thing you should write tests for, especially not chained ones, but you should see <strong>how it&#8217;s supposed to work</strong>. In this example I&#8217;m only going to test the basic calculation functions with Integers. Therefore I&#8217;ll test addition, subtraction, multiplication and division should work correct and the result should always be an Integer.</p>
<p>Example:</p>
<pre>public class CalculaterTest {

	public int testValue;

	@Before
	public void setUp(){
		testValue = 0;
		assertEquals(testValue, 0);
	}

	@Test
	public void shouldAddFive(){
		testValue = testValue + 5;
		assertEquals(testValue, 5);
	}

	@Test
	public void shouldSubTwo(){
		testValue = testValue + 5;
		testValue = testValue - 2;
		assertEquals(testValue, 3);
	}

	@Test
	public void shouldMultWithFour(){
		testValue = testValue + 5;
		testValue = testValue - 2;
		testValue = testValue * 4;
		assertEquals(testValue, 12);
	}

	@Test
	public void shouldDivWithTwo(){
		testValue = testValue + 5;
		testValue = testValue - 2;
		testValue = testValue * 4;
		testValue = testValue / 2;
		assertEquals(testValue, 6);
	}

	@Test (expected=AssertionError.class)
	public void shouldRaiseError(){
		testValue = testValue + 5;
		testValue = testValue - 2;
		testValue = testValue * 4;
		testValue = testValue / 2;
		testValue = testValue / 4 * 3;
		assertEquals(testValue, 4.5, 0.00000001);
	}
}</pre>
<p>As you can see a lot of the <strong>code has to be copied</strong> every time which leads to <strong>long and hard to maintain tests</strong> but next month I&#8217;ll write about a cool Framework to improve this tests and to write even better tests.</p>
<p>That&#8217;s it for almost this month, &#8220;How to Write Test in Pharo&#8221; will be online 31<sup>th</sup> of October.<br />
Stay tuned and leave comments below.<br />
cheers d3orn</p>
]]></content:encoded>
			<wfw:commentRss>http://www.d3orn.ch/2010/write-tests-part-2-1-how-to-write-tests-in-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Macro Macro Man</title>
		<link>http://www.d3orn.ch/2010/macro-macro-man/</link>
		<comments>http://www.d3orn.ch/2010/macro-macro-man/#comments</comments>
		<pubDate>Sun, 10 Oct 2010 15:54:35 +0000</pubDate>
		<dc:creator>zombiecalypse</dc:creator>
				<category><![CDATA[@zombiecalypse]]></category>

		<guid isPermaLink="false">http://www.d3orn.ch/?p=1243</guid>
		<description><![CDATA[I love meta-programming. I really do. Making the computer not only do what I program it to do, but making it writing my programs just gives you the feel of power and makes you want to shout It&#8217;s alive in disbelieving ecstasy. Or something like that. But that being said, there are some precautions that make meta-programming often quite [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>I love <a title="Wikipedia" href="http://en.wikipedia.org/wiki/Metaprogramming" target="_blank">meta-programming</a>. I really do. Making the computer not only do what I program it to do, but making it writing my programs just gives you the feel of power and makes you want to shout <strong><em>It&#8217;s alive</em></strong> in disbelieving ecstasy. Or something like that.</p>
<p>But that being said, there are <strong>some precautions</strong> that make meta-programming often quite different from normal programming.</p>
<ul>
<li><strong>Care how it works</strong>: If you don&#8217;t know how a process normally works, you can not dream of interfering with it in a meaningful manner. Sometimes this is rather easy, as for example the macro system of modern LISPs, or in Ruby, sometimes it is quite different from the way you&#8217;d normally do, as in Java, and sometimes, it seems more or less impossible &#8211; yeah, I&#8217;m looking at you, C.</li>
<li><strong>There is no copy-and-paste</strong>: Depending on how easy the programming process is, there might be few if any tutorials and helpful sites out there. Ironically, the more you&#8217;d need a helpful hand, the less likely it is that you&#8217;ll find it.</li>
<li>Your code probably won&#8217;t be all that self-explanatory, so <strong>document it well</strong>. Few people are familiar with the Craft, so explain what you do. Depending on your background, you&#8217;d do that anyway, but others write their code self-documenting, which relies on others getting the basic idea of what you are doing.</li>
<li><strong>Expect the unexpected</strong>. Ok, this is quite similar to what you would normally do, but in my experience, the WTF per minute rise significantly when dealing with meta-programming.</li>
</ul>
<p>So&#8230; <em><strong>why</strong></em> would you even deal with this? The answer is the usual:<strong> to save time and to make hard things easier</strong>.</p>
<p>I once wrote a decorator for Python, that automated the generation of a test suite, so instead of setting up these things by hand, you&#8217;d just write <em>@Test </em>in front of any test method, leading to more concise and arguably more readable code. A simple note <em>@commutative</em> could generate a test case to check, if<em> f(x,y)</em> is<em> f(y,x)</em> (for a given example at least). Or imagine a Ruby meta class, that automates the generation of a wrapper class by translating most calls with the help of a dictionary. So meta-programming can help you to jump over the boring parts and get to the hopefully less boring parts.</p>
<p>I hope, I encouraged someone to give the meta-weirdness a try.</p>
<p>Cheerio,</p>
<p>zombiecalypse</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.d3orn.ch/2010/macro-macro-man/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Digital Strom</title>
		<link>http://www.d3orn.ch/2010/digital-strom/</link>
		<comments>http://www.d3orn.ch/2010/digital-strom/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 08:13:37 +0000</pubDate>
		<dc:creator>d3orn</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.swissmtg.ch/blog/?p=877</guid>
		<description><![CDATA[hey there, because we moved to a new house in May we could somehow manage to get into the test phase of so called &#8220;digitalSTROM&#8221;. Therefore I like to write about this feature and what possible things you can do with it because I really think this is going to be something very nice in [...]]]></description>
			<content:encoded><![CDATA[<p>hey there,</p>
<p>because we moved to a new house in May we could somehow manage to get into the test phase of so called <strong>&#8220;digitalSTROM&#8221;</strong>.</p>
<p>Therefore I like to write about this feature and what possible things you can do with it because I really think this is going to be something very nice in the future.</p>
<p>&#8220;digitalSTROM&#8221; is a very new technology to program every single electric device in a house with the help of <a title="Scrrew terminal" href="http://en.wikipedia.org/wiki/Luster_terminal">screw terminals</a> and one little server, but before I go into any detail just <strong>watch the video</strong> below.  (Could take sometime to download)</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="600" height="450" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=8550584&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed type="application/x-shockwave-flash" width="600" height="450" src="http://vimeo.com/moogaloop.swf?clip_id=8550584&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>For more informations about &#8220;digitalSTROM&#8221; please visit the their page <a title="DigitalSTROM page english" href="http://www.digitalstrom.org/index.php?id=115&amp;L=2">http://www.digitalstrom.org</a></p>
<p>See the following summary about the <strong>most important features</strong>:</p>
<ul>
<li>dim light without special lamps</li>
<li>turn off the power in the whole house/building</li>
<li>control any electrical device via IP</li>
<li>program different scenarios for different situations</li>
</ul>
<p>I hade a few thoughts about the use of this feature:</p>
<p>First of all, I really like the idea of having <strong>one button</strong> near your door<strong> turn off all electricity and all devices </strong>in your house with one click or on the other side turn on all the things you turned off when you left.</p>
<p>Secondly, it will be possible to <strong>start almost any electrical device while you are away from home</strong>. Imagine the last days of your holidays and you could simply use a mobile application to start the heater and when you arrive home your house is warm and you feel pleasant. Another thing you could do is to put something (like pizza) in the oven before you leave for work and when you&#8217;re on the way home you can start the oven and eat right after.</p>
<p>To go on with I like to mention that with the help of &#8220;digitalSTROM&#8221; enterprises could<strong> save a lot of money</strong> due to electrical savings. They could control the heater, light, air conditioner and many more only with the help of a tool &#8211; for example they could program it such that all the light turns off at 2&#8242;o clock PM.</p>
<p>Finally, the way I would definitely use &#8220;digitalSTROM&#8221; is to turn on my computer of my server while I&#8217;m in the University or away to send/get data or to remote control my devices. I also in favour with the dim feature because a good light ambiance is really helpful for work and for non-work stuff.</p>
<p>That&#8217;s it for today, I hope I did have some good ideas and I could tell you what &#8220;digitalSTROM&#8221; is (mostly with the help of the video). If you have another good way to use it or any other things you like to tell please leave comments below.</p>
<p>cheers d3orn</p>
<p><a href="http://vimeo.com/8550584"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.d3orn.ch/2010/digital-strom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Quad Tree (I)</title>
		<link>http://www.d3orn.ch/2010/the-quad-tree-i/</link>
		<comments>http://www.d3orn.ch/2010/the-quad-tree-i/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 15:12:13 +0000</pubDate>
		<dc:creator>zombiecalypse</dc:creator>
				<category><![CDATA[@zombiecalypse]]></category>

		<guid isPermaLink="false">http://www.d3orn.ch/?p=1200</guid>
		<description><![CDATA[Today I&#8217;m going to introduce an interesting data structure for graphical applications: The Quad Tree. Imaging a game with many more or less rectangular objects, with huge levels, in which only a small part actually has to be drawn &#8211; the rectangular screen. The naive idea of checking all objects if they intersect with the screen is [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;m going to introduce an interesting data structure for graphical applications: <strong>The Quad Tree</strong>.</p>
<p>Imaging a game with many more or less rectangular objects, with huge levels, in which only a small part actually has to be drawn &#8211; the rectangular screen. The naive idea of checking all objects if they intersect with the screen is nice &#8211; you don&#8217;t have to draw all objects, but that can be quite difficult to compute if you have thousands of rectangles.</p>
<p>The question the quad tree tries to answer is the following: <em>Given this set of rectangles, is there a faster way to find all the rectangles that intersect with this one, than to iterate over all of them? </em>Lets call that<em> </em><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">rectangles.allIntersecting(R)</span></p>
<p>The basic idea behind the Quad Tree (QT) is to<strong> sort out parts of the picture</strong>, that can not possibly contain any rectangles hitting R.</p>
<p>Take the rectangle <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">[[0,0],[1,1]]</span> as an example. Can R=<span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">[[0.1,0.1],[0.25,0.25]]</span> hit the top right quadrant? Nope, so never mind even checking if there are rectangles in there, that hit R.</p>
<div id="attachment_1214" class="wp-caption alignright" style="width: 310px"><a href="http://www.d3orn.ch/wp-content/uploads/2010/10/quad1.png"><img class="size-medium wp-image-1214" title="quad1" src="http://www.d3orn.ch/wp-content/uploads/2010/10/quad1-300x226.png" alt="A QT finding all intersections with a rectangle" width="300" height="226" /></a><p class="wp-caption-text">The quadtree only checks part of the subtrees for intersections.</p></div>
<p>Every QT is either a leaf or <strong>has exactly four subtrees</strong>. Because of the ease of computation, the subtrees divide their bounds in four equal parts. The rectangles are stored in the trees, <em>not</em> the leaves, which are essentially <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">nil</span>.</p>
<p>Let&#8217;s start with</p>
<pre>tree.allIntersecting(R):=
    hits := rects in self.items that hit R
    for all subtrees s overlapping with R:
        hits.addAll(s.allIntersecting(R))
    return hits</pre>
<p>What happens, when a new rectangle is added to the tree? Let&#8217;s call that</p>
<pre>tree.addRect(rect):=
   if rect hits all subtrees
       self.items.add(rect)
    else
        for all subtrees s getting hit by rect
            s.addRect(rect)</pre>
<p>By this, the rect possibly <strong>gets stored in multiple places</strong>, but that can&#8217;t be helped, else one<strong> couldn&#8217;t be sure</strong>, there is no rectangle lingering in another quadrant, that <strong>intersects with the screen, but wouldn&#8217;t been found</strong>.</p>
<div id="attachment_1217" class="wp-caption alignleft" style="width: 310px"><a href="http://www.d3orn.ch/wp-content/uploads/2010/10/evilrecur.png"><img class="size-medium wp-image-1217" title="evilrecur" src="http://www.d3orn.ch/wp-content/uploads/2010/10/evilrecur-300x190.png" alt="A tiny rectangle is added" width="300" height="190" /></a><p class="wp-caption-text">Adding a tiny rectangle leads to many steps down the tree.</p></div>
<p>Does that solve the problem? That &#8211; as always &#8211; depends: The<strong> worst case </strong>for <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">allIntersecting</span> is the bounds of the tree, thus recursing all the way down. That makes it <em><big>O(</big>n*4<sup><small>maxdepth</small></sup><big>)</big></em>, which is worse than the <em><big>O(</big>n<big>)</big></em> of the naive approach. Even worse: there is <strong>no upper bound to inserting a rectangle</strong>: Imagine adding a very small rectangle <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">[[0,0][epsilon,epsilon]]</span> to the tree. Now it takes <em><big>O(</big>log</em><sub><small><em>2</em></small></sub><em>(1/epsilon)<big>)</big></em> steps until the rectangle hits a tree&#8217;s centre. And that function approaches infinity as epsilon gets small. That&#8217;s why QT&#8217;s should implement a maximal recursion depth, after which all pending rectangles are just inserted into the tree, no matter if they hit the centre.</p>
<p>However in the <strong>average case</strong>, there is a<strong> fixed size screen</strong> that is <strong>much smaller than the initial tree</strong>. Let&#8217;s assume the size of the screen is 2<sup><small>k </small></sup>times smaller than the tree&#8217;s bounds, now we can discard 2-3 trees each step down until the bounds of the next trees are as big as the screen (that is after k steps). We get <big>O(</big>2<sup><small>-k</small></sup>n4<sup><small>(maxdepth-k)</small></sup><big>)</big> runtime &#8211; a <strong>huge improvement to the naive approach</strong>. If we set the maxdepth so that maxdepth=k, we don&#8217;t get to feel the problems of the tree at all!</p>
<p>Next time, I&#8217;ll show you how I implemented it in Clojure, so stay tuned!</p>
<p>zombiecalypse</p>
]]></content:encoded>
			<wfw:commentRss>http://www.d3orn.ch/2010/the-quad-tree-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>September 2010 News</title>
		<link>http://www.d3orn.ch/2010/september-2010-news/</link>
		<comments>http://www.d3orn.ch/2010/september-2010-news/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 08:26:20 +0000</pubDate>
		<dc:creator>d3orn</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.d3orn.ch/?p=1185</guid>
		<description><![CDATA[hey there, today I like to start a new monthly article called &#8220;News&#8221;. Every month I&#8217;m going to write about what I learned, I did and was especially interesting in this month lectures and work. Because the semester started last Monday I like to share my first impressions and thoughts with you. I have two [...]]]></description>
			<content:encoded><![CDATA[<p>hey there,</p>
<p>today I like to start a <strong>new monthly article called &#8220;News&#8221;</strong>. Every month I&#8217;m going to write about what I learned, I did and was especially interesting in this month lectures and work.</p>
<p>Because the semester started last Monday I like to share my first impressions and thoughts with you.</p>
<p>I have two very good lectures; the first is about <strong>analysis and modeling of business processes</strong>. I&#8217;m very excited to learn more about many different ways to model processes and other things. We are going to learn <strong>UML, petri net</strong> and many more. Although it&#8217;s a business administration lecture it will be a great help in the future for <strong>contract driven design</strong> and I can&#8217;t wait to learn more!</p>
<p>The second one is <strong>introduction to software engineering</strong> and in my opinion this is one of the most interesting lectures in computer science so far. We are going to make a <strong>Web-App as exercise</strong>, I don&#8217;t know what we are going to program but I&#8217;m really excited because I never made a Web-App. The first lecture was about engineering as an<strong> iterative process</strong>.</p>
<p>And good news I started to like mathematics again, linear algebra is interesting if you make the homework and learn for it but I&#8217;ll have a lot of fun with it this year and I hope I&#8217;ll pass xD.</p>
<p>At the moment I do work a lot on excercises and blog articles (yes you may see this soon) and because this month different visitors skyrocket to <strong>over</strong> 400, I like to <strong>increase my frequency of blog articles even more</strong>, starting with this new column. I&#8217;m currently aiming for over 1000 visitors a month, you could spread the words.</p>
<p>About SCodeBubbles we are going to have a meeting next week sometimes and zombiecalypse is currently trying to get a working <a href="http://hthttp://en.wikipedia.org/wiki/Quadtree">quadtree</a> for Pharo (Smalltalk). To go on with I&#8217;m playing around with <a href="http://squeaksource.com/@zYTT8pZqIQpk2PI5/tsaSDagx">Seuss</a> (Dependency Injection framework for Pharo) to get more used to Smalltalk. You will see an <strong>article about Dependency Injection (DI) soon</strong>.</p>
<p>That&#8217;s it for September 2010 News, I like to post this News every month but I&#8217;m not sure yet which date it will be but I&#8217;ll tell you if I fixed a date.</p>
<p>Leave comments below</p>
<p>cheers d3orn</p>
]]></content:encoded>
			<wfw:commentRss>http://www.d3orn.ch/2010/september-2010-news/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Take a Day Off!</title>
		<link>http://www.d3orn.ch/2010/take-a-day-off/</link>
		<comments>http://www.d3orn.ch/2010/take-a-day-off/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 10:54:28 +0000</pubDate>
		<dc:creator>d3orn</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.d3orn.ch/?p=1052</guid>
		<description><![CDATA[hey there, today I recommend you&#8217;d take a day off - and not only from coding but from the computer all together. Don&#8217;t sit behind your desk staring into shiny computer lights, stirring the chunk of plastic, that is your mouse, and hacking on the keyboard. Just go out, read a book (no work, no learning), watch [...]]]></description>
			<content:encoded><![CDATA[<p>hey there,</p>
<p>today I recommend <strong>you&#8217;d take a day off </strong>- and not only from coding but from the computer all together. Don&#8217;t sit behind your desk staring into shiny computer lights, stirring the chunk of plastic, that is your mouse, and hacking on the keyboard. Just<strong> go out, read a book (no work, no learning), watch a movie or get a drink with some friends</strong>.</p>
<p>There are a lot of things you can do, but start with<strong> shutting down your computer</strong>.</p>
<p>Why do I recommend this to you?</p>
<p>That&#8217;s because if you take a day off today your<strong> mind can rest</strong> from your task, your<strong> (brain-) muscles and you will be more relaxed</strong> tomorrow. Therefore you can <strong>work much better and even more efficient</strong>. In addition you might even come up with a solution or an idea for a problem you have tomorrow because you&#8217;ll have a different point of view on it and you&#8217;re more relaxed. Plus: You&#8217;ll feel much better.</p>
<p>Believe me it does help a lot and it&#8217;s not only for your work, it&#8217;s <strong>good for you and your social life</strong> (Yeah we got one^^).</p>
<p>Hey you&#8217;re still reading this article! Shutdown and do something else!</p>
<p>cheers d3orn</p>
]]></content:encoded>
			<wfw:commentRss>http://www.d3orn.ch/2010/take-a-day-off/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Write Tests Part 1 &#8211; UnitTests</title>
		<link>http://www.d3orn.ch/2010/write-tests-part-1/</link>
		<comments>http://www.d3orn.ch/2010/write-tests-part-1/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 16:53:09 +0000</pubDate>
		<dc:creator>d3orn</dc:creator>
				<category><![CDATA[How I write code]]></category>

		<guid isPermaLink="false">http://www.swissmtg.ch/blog/?p=912</guid>
		<description><![CDATA[hey there, this month topic is tests, there are many different kinds of tests and because I like to have more but smaller articles I&#8217;m going to split this article up into more then one article. As a result you will probably see my first ScreenCast I ever made, I like to make a Screencast [...]]]></description>
			<content:encoded><![CDATA[<p>hey there,</p>
<p>this month topic is tests, there are many different kinds of tests and because I like to have more but smaller articles I&#8217;m going to split this article up into more then one article. As a result you will probably see my first <strong>ScreenCast</strong> I ever made, I like to make a Screencast in the last article about this topic because I want to show you a good example.</p>
<p>I&#8217;m going to split this articles up into:</p>
<ul>
<li>UnitTests</li>
<li>How to write Tests in Java and Pharo</li>
<li>JExample</li>
<li>Write Tests First</li>
</ul>
<p>As you can see I&#8217;m going to start with <strong>UnitTests</strong> today.<strong> </strong></p>
<h2>UnitTests</h2>
<p>What are UnitTests?</p>
<p>A unit is the <strong>smallest piece of source code you can test</strong> and therefore a UnitTest is a method to determine if such an <strong>Unit works as intended</strong>.</p>
<p>In most programming languages there are tools to write tests. For example in Java you can use <strong>assertTrue, assertFalse and assertEquals</strong> to create tests or to check conditions in you&#8217;re methods (more about this later) and in Smalltalk (Pharo) you do have <strong>self assert</strong>. To go on with there are test frameworks like <strong>JUnit and SUnit</strong> which helps you organize and running you&#8217;re tests.</p>
<p>With the help of these methods you can start to write tests, in Java you have to create a JUnit Test Case in Eclipse and import the java.util.assert.* lib. Please notice that I&#8217;m using JUnit 4 and not JUnit 3, you should always check the used version before running a Test Case. To check this in Eclipse you right-click on the<strong> Test Case -&gt; Run As -&gt; Run Configurations&#8230;</strong> and in this window you can select the test runner you like.</p>
<p><em>To go on with there are only a few rules for writing UnitTests:</em></p>
<ul>
<li><em><strong>KISS </strong>(keep it short and simple)<br />
</em></li>
<li><em>At least <strong>one test per method</strong></em></li>
<li><em>test coverage of approximately<strong> 60%</strong> or higher (more about test coverage later)<br />
</em></li>
<li><em>tests shouldn&#8217;t be longer than <strong>ten lines</strong></em></li>
<li><em>tests should represent a <strong>scenario</strong> how the unit is used </em></li>
</ul>
<p>Tests should be written during the<strong> development phase</strong> or the <strong>debugging phase</strong>. During Development you should create tests whenever you encounter one of the following problems:</p>
<ol>
<li>You need to add new functionality</li>
<li>You need to redesign your software to add new features or adapt to new requirements</li>
</ol>
<p>In the first case it&#8217;s very helpful to<strong> write the tests</strong> for this new functionality<strong> first</strong> and then implement the functionality, I&#8217;ll cover this in the third article. In the second case you already have a working program and you want to add new features, you therefore should refactor the old version in small, <strong>very small steps</strong> and after each of these steps you should run the tests you have again. You then have to fix everything that&#8217;s broken and when all test pass you can proceed with refactoring. As you can see tests will help you a lot during the development phase of a project but you can also use them during the debugging phase.</p>
<p>During Debbuging whenever you encounter a bug or a defect in your code you should<strong> write a test to demonstate that bug</strong> and as soon as this test passes you&#8217;re bug is fixed!</p>
<p>That’s it for this month and I hope you enjoyed the reading ^^</p>
<p>It&#8217;s a big goal of mine to show all of you that <strong>tests are good</strong>, a lot people I know think that tests are only a waste of time and not worth to be written. I think UnitTest will help you a lot in the future to <strong>maintain or refactor a program</strong> and you definitly get your invested time back. The best part of UnitTests is, once written, you can run them as many times as you want whitout using much time.</p>
<p>Please leave comments below and stay tuned for the next months article about JExample .</p>
<p>cheers d3orn</p>
]]></content:encoded>
			<wfw:commentRss>http://www.d3orn.ch/2010/write-tests-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fooling Around</title>
		<link>http://www.d3orn.ch/2010/fooling-around/</link>
		<comments>http://www.d3orn.ch/2010/fooling-around/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 13:55:44 +0000</pubDate>
		<dc:creator>d3orn</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.d3orn.ch/?p=1027</guid>
		<description><![CDATA[hey there, zombiecalypse wrote an article about &#8220;How to Learn a New Language&#8221; earlier. He brought up the idea of &#8220;Fooling Around&#8221; and although I haven&#8217;t learned as much languages as zombiecalypse did, I&#8217;d like to write about how I do fool around with a new language. First of all when you start learning and [...]]]></description>
			<content:encoded><![CDATA[<p>hey there,</p>
<p>zombiecalypse wrote an article about &#8220;How to Learn a New Language&#8221; earlier. He brought up the idea of &#8220;Fooling Around&#8221; and although I haven&#8217;t learned as much languages as zombiecalypse did, I&#8217;d like to write about how I do fool around with a new language.</p>
<p>First of all when you start learning and fooling <strong>don&#8217;t try to understand everything</strong> because it&#8217;s not necessary you do. There is one rule which is perfect for the start and also for <strong>every object-oriented</strong> progamming language: <strong>I don&#8217;t care how it works as long as it works!</strong> To go even a step further the receiver should care but not the sender, that&#8217;s you. Therefore fool around and don&#8217;t care how it works just try to make a little program. When you&#8217;re done go on and make another more complex program and probably<strong> start to look a few things up</strong>.</p>
<p>There is only one important thing left to say. Just do something<strong> get your fingers up, </strong><strong>write code or do something you wanted to do</strong> for a long time but just <strong>don&#8217;t be lazy</strong>. You can&#8217;t learn a language when you don&#8217;t start to do something!  Sometimes it&#8217;s hard to start but let me tell you one thing, it&#8217;s definitively <strong>worth it</strong>.</p>
<p>By the way, I made a little twitpoll a few days ago to see about which topic you would like to read an article in the future. As a result of this poll I&#8217;m going to write about &#8220;<strong>Take a Day Off!</strong>&#8220;. You&#8217;re opinion is very important for me so leave comments, vote in the twitpolls or just send me an email.</p>
<p>cheers d3orn</p>
]]></content:encoded>
			<wfw:commentRss>http://www.d3orn.ch/2010/fooling-around/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Functional Performance</title>
		<link>http://www.d3orn.ch/2010/functional-performance/</link>
		<comments>http://www.d3orn.ch/2010/functional-performance/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 17:12:15 +0000</pubDate>
		<dc:creator>zombiecalypse</dc:creator>
				<category><![CDATA[@zombiecalypse]]></category>

		<guid isPermaLink="false">http://www.d3orn.ch/?p=1068</guid>
		<description><![CDATA[There was once a famous dispute of Greek philosophers about a ship that was said to have been owned by an hero centuries ago. Of course, the boat had changed: every bit of wood, every rusty nail and every string of linen had to be exchanged during all that time. Now the thinkers were wondering [...]]]></description>
			<content:encoded><![CDATA[<p>There was once a famous dispute of Greek philosophers about a ship that was said to have been owned by an hero centuries ago. Of course, the boat had changed: every bit of wood, every rusty nail and every string of linen had to be exchanged during all that time. Now the thinkers were wondering whether or not it was still the same ship.The morale of this little tale is that things can get complicated if stuff changes. But that&#8217;s just the way it is, right? That things change is the whole point of programming. Or maybe not&#8230; most think of programming as changing states of a machine, however it can be shown, that just <a title="Lambda Calculus" href="http://en.wikipedia.org/wiki/Lambda_calculus" target="_blank">calling functions</a> is equivalent to our beloved Turing Machine. And I mean functions as in mathematical functions &#8211; they always return the same output for the same input.</p>
<p>So you can program without ever changing anything. But that begs the question: Why would you do that? It seems quite counter-intuitive. Yeah,welcome to the wondrous world of functional programming, where nothing ever changes!</p>
<h2>Techniques</h2>
<h3>Memory</h3>
<p>What is the clockrate of the computer you are working on? Chances are, it&#8217;s about 2.5GHz. However you probably got at least two cores, the newer the more. That&#8217;s the trend, you don&#8217;t get faster processors, but you get more. There are problems with that. If you can do more things in parallel, but want to do something as fast as possible, your CPU power does not just add. And if something changes, it can not spread very well across processors, because different parts of the program might change the same value at the same time making them inconsistent. Or you lock access while you access it, but then you&#8217;d have to wait.</p>
<p>Or you don&#8217;t change it at all and copy it in a smart way. You&#8217;d expect this to make your code even slower, but scientist did a great job inventing datastructures, that make this easy. In fact, you&#8217;ll probably never see a case that would make your code more than a factor of <code>log(n)</code>slower, as experiments have shown.</p>
<p>As memory access is the performance bottleneck today, being able to perform it in parallel helps quite a bit.</p>
<h3>Remember your Calls</h3>
<p>Another cool bit is memoization. To show students why recursion sucks, professors like to use the following example</p>
<h3>Recursive version</h3>
<div class="highlight">
<pre><span class="k">def</span> <span class="nf">fibonacci</span><span class="p">(</span><span class="n">n</span><span class="p">):</span>
	<span class="k">if</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mi">2</span><span class="p">:</span>
		<span class="k">return</span> <span class="mi">1</span>
	<span class="k">else</span><span class="p">:</span>
		<span class="k">return</span> <span class="n">fibonacci</span><span class="p">(</span><span class="n">n</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">+</span><span class="n">fibonacci</span><span class="p">(</span><span class="n">n</span><span class="o">-</span><span class="mi">2</span><span class="p">)</span></pre>
</div>
<h3>Iterative version</h3>
<div class="highlight">
<pre><span class="p"><span class="k">def</span> <span class="nf">fibonacci</span><span class="p">(</span><span class="n">n</span><span class="p">):</span>
	<span class="n">a</span> <span class="o">=</span> <span class="n">b</span> <span class="o">=</span> <span class="mi">1</span>
	<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">n</span><span class="p">):</span>
		<span class="n">a</span><span class="p">,</span><span class="n">b</span> <span class="o">=</span> <span class="n">b</span><span class="p">,</span><span class="n">a</span><span class="o">+</span><span class="n">b</span>
	<span class="k">return</span> <span class="n">a</span></span></pre>
</div>
<p>The first one is usually slow as hell, because you keep computing the same numbers over and over again. But as fibonacci is just dependent on n, you could just make a table for it and only compute the number, if it hasn&#8217;t been done already. That makes the performance the same as the iterative approach. We call that memoization and you can perform that only if your function is pure, because otherwise, there might be other influences on the outcome, which would not be taken into account with the caching. If the function is pure however, you can use it for all of dynamic programming without real performance penalty.</p>
<h3>Being Lazy pays off</h3>
<p>Quite possibly my favorite part is laziness. If the return value of a function call does not depend on its environment and thus the precise moment, in which it is called, you don&#8217;t need to compute it right away. Wait &#8217;til you actually use the value and maybe, you don&#8217;t even need to calculate it at all. This extends so far, that you can simply make an infinitely big datastructure, for example a list of all natural numbers.</p>
<p>That&#8217;s it for today, but there might be other articles following up on this topic.</p>
<p>Have fun!</p>
<p><a title="My home blog" href="http://aaron.karper.ch/?p=28" target="_blank">Zombiecalypse</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.d3orn.ch/2010/functional-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

