<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.2" -->
<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/"
	>

<channel>
	<title>Henrik in Seattle</title>
	<link>http://seattle.henko.net</link>
	<description>And they lived happily ever after...</description>
	<pubDate>Wed, 27 Feb 2008 07:52:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>
	<language>en</language>
			<item>
		<title>Epilogue</title>
		<link>http://seattle.henko.net/2006/07/11/epilogue/</link>
		<comments>http://seattle.henko.net/2006/07/11/epilogue/#comments</comments>
		<pubDate>Tue, 11 Jul 2006 17:01:28 +0000</pubDate>
		<dc:creator>Henrik</dc:creator>
		
	<category>Traveling</category>
	<category>Seattle</category>
	<category>Studies</category>
	<category>Blabber</category>
	<category>Sports</category>
		<guid isPermaLink="false">http://seattle.henko.net/2006/07/11/epilogue/</guid>
		<description><![CDATA[One week has now passed since I left Seattle and the United States of America. Almost ten months has passed since I first got there. While I wouldn't be surprised to find my self back there one day, I feel that this is a good time to summarize my experiences from the large country 'over [...]]]></description>
			<content:encoded><![CDATA[<p>One week has now passed since I left Seattle and the United States of America. Almost ten months has passed since I first got there. While I wouldn't be surprised to find my self back there one day, I feel that this is a good time to summarize my experiences from the large country 'over there'.</p>

<p>I'll start with a one sentence summary of the greater Seattle area; Like Sweden, but bigger.</p>

<p>To elaborate, pretty much everything is bigger over there. The trees are bigger, the mountains are bigger, the cars are bigger, the stadiums are bigger and more numerous, the streets are wider, and the food portions are more generous. While we also have trees, mountains, cars, stadiums, streets and everything else they have over there, theirs are simply bigger. Whether that is positive or negative depends on the question at hand, and I guess I can't give a much better generic answer than "it depends".</p>

<p>The second most obvious thing I've noticed about Seattle is that people are more relaxed, hospitable, and easy-going. They are simply just very nice. Nicer than Swedes, I would say, at least on a shallow level. But when you think about how many people you talk to on any given day, you realize that you actually have a lot of rather shallow conversations. Americans are just so much better than Swedes at having those casual and spontaneous conversations. In fact, if there is one thing I would like to bring back home to Sweden, it would be this very skill.</p>

<p>One of the absolutely best things I did in Seattle, possibly even the best, was to start playing Ultimate. I've met a whole bunch of cool Americans, I've learned a great sport, and I've had so much fun! Not to mention that it has helped me stay in shape, and not gain any weight. I can wholeheartedly recommend both Ultimate as a sport, as well as playing some kind of team sport while studying abroad. It's a great chance to meet new people.</p>

<p>Also, I'm happy I took the chance to travel as much as I did. I've visited Hawaii, Las Vegas, Florida, Olympic Peninsula and California. During some trips, I either visited someone I knew, or had a visitor, which made them extra fun. Although I've spent thousands of dollars on these trips, I don't regret traveling for a second. The places I've visited are places I would have wanted to visit sometime in my life anyway, and why not do it when you've already paid for the trip over the Atlantic anyway? However, as a word of advice, don't forget to [bring a towel->http://www.bbc.co.uk/cult/hitchhikers/guide/towel.shtml]! <img src='http://seattle.henko.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<p>So, finally, for any and all of you out there - if you have the chance to study abroad, do it! For some reason, most people who have studies abroad tend to say that it was one of the best times of their lives, and that don't regret it. Although it might sound as a cliché, I can't help but chime in. Do it! You <em>will</em> have a great time, and you <em>won't</em> regret it.</p>

<p>Over and out,
Henrik</p>
]]></content:encoded>
			<wfw:commentRSS>http://seattle.henko.net/2006/07/11/epilogue/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>The Last Supper</title>
		<link>http://seattle.henko.net/2006/06/13/the-last-supper/</link>
		<comments>http://seattle.henko.net/2006/06/13/the-last-supper/#comments</comments>
		<pubDate>Wed, 14 Jun 2006 00:01:27 +0000</pubDate>
		<dc:creator>Henrik</dc:creator>
		
	<category>Seattle</category>
	<category>Blabber</category>
		<guid isPermaLink="false">http://seattle.henko.net/2006/06/13/the-last-supper/</guid>
		<description><![CDATA[I've been very efficient today. I met the landlord to get my deposit back, I've sold my bike and my bed, cleaned my room, sorted everything, thrown away what I don't need, burned a few things which I didn't want in the hands of the wrong person (personal checks for example), and a lot of [...]]]></description>
			<content:encoded><![CDATA[<p>I've been very efficient today. I met the landlord to get my deposit back, I've sold my bike and my bed, cleaned my room, sorted everything, thrown away what I don't need, burned a few things which I didn't want in the hands of the wrong person (personal checks for example), and a lot of other useful things.</p>

<p>To reward myself I just went down to my favorite Greek restaurant, sat down and had a nice dinner including almond baklava for dessert. Really good! As I've been to that restaurant on more than one occation, I've got to know the owner a little bit. So he was sad to hear that I was leaving (I guess I was a good customer). He also gave me his email address and asked me to write him a letter sometime. Great to know that at least someone is going to miss me. <img src='http://seattle.henko.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<p>Now it's about 15 hours until I should be at the airport, and the "only" things I have to do before that is pack my suitcases and sleep. Sounds easy, right? <img src='http://seattle.henko.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Let's hope for my sake that it is.</p>
]]></content:encoded>
			<wfw:commentRSS>http://seattle.henko.net/2006/06/13/the-last-supper/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Bush Cards</title>
		<link>http://seattle.henko.net/2006/05/31/bush-cards/</link>
		<comments>http://seattle.henko.net/2006/05/31/bush-cards/#comments</comments>
		<pubDate>Thu, 01 Jun 2006 03:40:07 +0000</pubDate>
		<dc:creator>Henrik</dc:creator>
		
	<category>Blabber</category>
		<guid isPermaLink="false">http://seattle.henko.net/2006/05/31/bush-cards/</guid>
		<description><![CDATA[I took a trip to the bookstore earlier today, and found those just lovely right-slated playing cards.





All cards feature one of the members of Bush's staff and gives a nice quote or a brief description of the person. My "favorite" so far is probably Karen Hughes, Under Secretary of State, Public Diplomacy and Public Affairs [...]]]></description>
			<content:encoded><![CDATA[<p>I took a trip to the bookstore earlier today, and found those just lovely <em>right-slated</em> playing cards.</p>

<div class="images">
<a class="imagelink" href="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_6189.jpg" title="Bush Cards Box"><img id="image209" src="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_6189.thumbnail.jpg" alt="Bush Cards Box" /></a><a class="imagelink" href="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_6188.jpg" title="Four (Doubtful) Aces"><img id="image210" src="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_6188.thumbnail.jpg" alt="Four (Doubtful) Aces" /></a><a class="imagelink" href="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_6183.jpg" title="Bush - the Ace of Spades"><img id="image212" src="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_6183.thumbnail.jpg" alt="Bush - the Ace of Spades" /></a>
</div>

<p>All cards feature one of the members of Bush's staff and gives a nice quote or a brief description of the person. My "favorite" so far is probably <cite>Karen Hughes</cite>, Under Secretary of State, Public Diplomacy and Public Affairs who made a "solid" connection between the 9/11 tragedy and of all things <em>abortion</em> by saying.</p>

<blockquote>
  <p>I think that after September 11, the American people are valuing life more, and we need 
  policies to value the dignity and worth of every life. [&#8230;] I think those are the kind of policies 
  the American people can support, particularly at a time when we're facing an enemy.</p>
</blockquote>

<p>I am speechless.</p>
]]></content:encoded>
			<wfw:commentRSS>http://seattle.henko.net/2006/05/31/bush-cards/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>All work for nothing</title>
		<link>http://seattle.henko.net/2006/05/31/all-work-for-nothing/</link>
		<comments>http://seattle.henko.net/2006/05/31/all-work-for-nothing/#comments</comments>
		<pubDate>Wed, 31 May 2006 21:36:28 +0000</pubDate>
		<dc:creator>Henrik</dc:creator>
		
	<category>Blabber</category>
		<guid isPermaLink="false">http://seattle.henko.net/2006/05/31/all-work-for-nothing/</guid>
		<description><![CDATA[Yesterday I tidied up my room, vacuumed it, did some laundry, cleaned the kitchen, swept the floor in the hallway and generally tried to make everything look as nice as possible. Why? Because it was needed? For sure, but no, that wasn't the reason. Because I'm such an orderly person? *cough* Well, no. So, why [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I tidied up my room, vacuumed it, did some laundry, cleaned the kitchen, swept the floor in the hallway and generally tried to make everything look as nice as possible. Why? Because it was needed? For sure, but no, that wasn't the reason. Because I'm such an orderly person? *cough* Well, no. So, why then?</p>

<p>I want to get rid of my room! I was making the room look all nice and shiney because today at 10am I was supposed to show the room to a girl who was interested in renting it. But when I came back to my room about 9:50am after taking a shower, I had a voice mail on my phone from her saying that she wouldn't come after all.</p>

<p>Too bad, but at least my room is a lot cleaner! <img src='http://seattle.henko.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRSS>http://seattle.henko.net/2006/05/31/all-work-for-nothing/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Swollen upper lip</title>
		<link>http://seattle.henko.net/2006/05/25/swollen-upper-lip/</link>
		<comments>http://seattle.henko.net/2006/05/25/swollen-upper-lip/#comments</comments>
		<pubDate>Thu, 25 May 2006 07:18:30 +0000</pubDate>
		<dc:creator>Henrik</dc:creator>
		
	<category>Sports</category>
		<guid isPermaLink="false">http://seattle.henko.net/2006/05/25/swollen-upper-lip/</guid>
		<description><![CDATA[Tonight I played Ultimate as I usually do on Mondays and Wednesdays. Before the actual game started, I was just throwing back and forth with some random guy. It was somewhat windy, and when I held my hands ready to catch the disc coming towards me, the wind moved it up about a decimeter right [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://seattle.henko.net/wp-content/uploads/2006/05/swollen-lip.jpg" alt="Henrik with swollen upper lip." title="Henrik with swollen upper lip." align="right" style="margin: 0.5em 0 0.5em 1em;" />Tonight I played Ultimate as I usually do on Mondays and Wednesdays. Before the actual game started, I was just throwing back and forth with some random guy. It was somewhat windy, and when I held my hands ready to catch the disc coming towards me, the wind moved it up about a decimeter right before I was about to catch it. This resulted in that the disc, instead of hitting my hands as planned, hit right on my upper lip instead. Bam! That hurt. And it's gonna look beautiful tomorrow.</p>

<p>Well, not much you can do about it.. (besides putting some ice on it, but I was too lazy to get some). I continued playing. Towards the end of the game, I was running for the disc and just about to score when one of my team mates (who was also going for the disc) accidentally macked it right into my face. On my upper lip, to be more precise. Bam! That hurt, again! It's going to be even more beautiful tomorrow.</p>

<p>After this, I actually convinced myself to go get some ice to put on my lip. I don't know how much it helped, I might have been to late, but it's better than nothing I guess.</p>
<p>Show this on a <a href="http://seattle.henko.net/postmap/?id=206">map</a>.</p>]]></content:encoded>
			<wfw:commentRSS>http://seattle.henko.net/2006/05/25/swollen-upper-lip/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Examples of a simple refactoring</title>
		<link>http://seattle.henko.net/2006/05/24/examples-of-a-simple-refactoring/</link>
		<comments>http://seattle.henko.net/2006/05/24/examples-of-a-simple-refactoring/#comments</comments>
		<pubDate>Wed, 24 May 2006 20:42:01 +0000</pubDate>
		<dc:creator>Henrik</dc:creator>
		
	<category>Software engineering</category>
		<guid isPermaLink="false">http://seattle.henko.net/2006/05/24/examples-of-a-simple-refactoring/</guid>
		<description><![CDATA[I just found an article named [Refactoring Demo Screencast->http://xp123.com/xplor/xp0605/index.shtml] featuring four short videos nicely showing four different ways of performing the simple refactoring [Extract Method->http://refactoring.com/catalog/extractMethod.html]. Starting with "Sloppy", making its way to "Automated att full speed".

UPDATE: I managed to incorrectly make the first link point to the wrong place. Now fixed.
]]></description>
			<content:encoded><![CDATA[<p>I just found an article named [Refactoring Demo Screencast->http://xp123.com/xplor/xp0605/index.shtml] featuring four short videos nicely showing four different ways of performing the simple refactoring [Extract Method->http://refactoring.com/catalog/extractMethod.html]. Starting with "Sloppy", making its way to "Automated att full speed".</p>

<p>UPDATE: I managed to incorrectly make the first link point to the wrong place. Now fixed.</p>
]]></content:encoded>
			<wfw:commentRSS>http://seattle.henko.net/2006/05/24/examples-of-a-simple-refactoring/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Thank God It&#8217;s Friday</title>
		<link>http://seattle.henko.net/2006/05/20/thank-god-its-friday/</link>
		<comments>http://seattle.henko.net/2006/05/20/thank-god-its-friday/#comments</comments>
		<pubDate>Sat, 20 May 2006 07:04:54 +0000</pubDate>
		<dc:creator>Henrik</dc:creator>
		
	<category>Studies</category>
		<guid isPermaLink="false">http://seattle.henko.net/2006/05/20/thank-god-its-friday/</guid>
		<description><![CDATA[Thank God It's Friday, or [TGIF->http://en.wikipedia.org/wiki/TGIF] as it is usually abbreviated, is the name of an event which takes place in (or near) the computer science building every friday afternoon. It is a way to round off the work week and relax before the weekend. Usually it means that students, faculty and staff join forces [...]]]></description>
			<content:encoded><![CDATA[<p>Thank God It's Friday, or [TGIF->http://en.wikipedia.org/wiki/TGIF] as it is usually abbreviated, is the name of an event which takes place in (or near) the computer science building every friday afternoon. It is a way to round off the work week and relax before the weekend. Usually it means that students, faculty and staff join forces in the atrium of the building and have some free or very cheap beer and snacks. Usually every TGIF is arranged by a grad student office (about five students) and has a specific theme, such as The Incredible Edible Egg TGIF, Football-ish TGIF, Cultures Collide TGIF or something else which does not make too much sense.</p>

<p>This time, the TGIF was a bit bigger, and took place at a lawn behind the CSE building. There were free burgers, hot dogs, soda and beer, as well as a number of ways to entertain oneself. Most notably a huge inflatable erm, thing, in lack of a better word, where two combatants joined by a rope were trying to put small basket balls in baskets as far from each other as possible. Another inflatable large thing allowed two people (with helms) to nock each other off small platforms with huge (but rather soft) clubs. The third and perhaps most popular thing was the hit-the-bullseye-with-a-ball-and-make-the-person-sitting-over-the-pool-fall-down-into-it thing. The people sitting there, waiting to be thrown into the water, were teaching assistants, staff and faculty. Even the chair of the department got his time. To the amusement of the crowd, the first person who managed to make the old chair (who also happens to be teaching one of the classes I'm currently taking) fall down into the water, was his about 5 year old daughter. <img src='http://seattle.henko.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>

<p>I also brought my faithful frisbee to the party, and it got used pretty heavily. Unfortunately, it was ran over by a car earlier on the day, so it was slightly cracked. But it worked pretty well anyway. A couple of us ended up staying for a few hours playing Ultimate in the slightly wet grass. It was very informal, very fun, and my pants are now very, very dirty. <img src='http://seattle.henko.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Show this on a <a href="http://seattle.henko.net/postmap/?id=203">map</a>.</p>]]></content:encoded>
			<wfw:commentRSS>http://seattle.henko.net/2006/05/20/thank-god-its-friday/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Implementing equals()</title>
		<link>http://seattle.henko.net/2006/05/18/implementing-equals/</link>
		<comments>http://seattle.henko.net/2006/05/18/implementing-equals/#comments</comments>
		<pubDate>Fri, 19 May 2006 06:51:09 +0000</pubDate>
		<dc:creator>Henrik</dc:creator>
		
	<category>Software engineering</category>
		<guid isPermaLink="false">http://seattle.henko.net/2006/05/18/implementing-equals/</guid>
		<description><![CDATA[Among Java developers, there exist different ideas about how to implement the <code>equals()</code> method. The disagreement is about whether to allow subclasses to be considered equal or not. In this post, I quickly describe the difference between the two alternatives and give my take on the problem.]]></description>
			<content:encoded><![CDATA[<p>Among Java developers, there exist [different ideas->http://www.artima.com/intv/bloch17.html] about how to implement the <code>[equals-&gt;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#equals(java.lang.Object)]()</code> method. The disagreement is about whether to allow subclasses to be considered equal or not.</p>

<h3>Two ways to see it</h3>

<p>Some say that it should be done using the <code>instanceof</code> operator, like this.</p>

<pre><code>public boolean equals(Object obj) {
    if (obj instanceof MyClass) {
        MyClass that = (MyClass) obj;
        // compare this and that
    } else {
        return false;
    }
}
</code></pre>

<p>Other says that it should be done by comparing the exact classes of the two objects, like this.</p>

<pre><code>public boolean equals(Object obj) {
    if (obj != null &amp;&amp; obj.getClass() == this.getClass()) {
        MyClass that = (MyClass) obj;
        // compare this and that
    } else {
        return false;
    }
}
</code></pre>

<p>The difference lies in how they treat subclasses. As <code>instanceof</code> returns <code>true</code> if <code>obj</code> is of the same class <em>or any subclass</em>, it will allow subclasses to be considered semantically identical to their superclasses. Comparing the result of <code>getClass()</code> on both objects will require that they are of exactly the same class. Using that method, no subclass can ever be semantically equal to its superclass.</p>

<p>To understand why this difference matters, it is important to remember one of the requirements Java has on any implementation of <code>equals()</code>; the equality relation must be symmetrical. In other words, for any objects <code>a</code> and <code>b</code> the expression <code>a.equals(b)</code> may return <code>true</code> <em>if and only if</em> <code>b.equals(a)</code> also does.</p>

<p>Because of this, the <code>getClass()</code> camp argues that since we can't predict how subclasses might want to implement <code>equals()</code>, we better implement <code>equals()</code> in such a way that it only compares objects of the same class. That way a subclass can safely override and implement <code>equals()</code> any way they want. For example, a subclass might have additional fields which it wants to use in the equality comparison. Otherwise we might end up in a situation where e.g. the superclass says that is equal to the subclass but not the other way around.</p>

<p>The argument from the <code>instanceof</code> proponents is that not allowing a subclass to be considered equal breaks the notion of [polymorphism->http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming]. It also violates the [Liskov substitution principle->http://en.wikipedia.org/wiki/Liskov_substitution_principle] as well as the [principle of least astonishment->http://en.wikipedia.org/wiki/Principle_of_least_astonishment].</p>

<h3>How I see it</h3>

<p>Okay, enough with the summary. Now I'll throw my own two cents in.</p>

<p>I think this whole question pretty much falls apart if we just make a better distinction between interface and implementation. An interface decides <em>what</em> a method is supposed to do, while a particular implementation knows <em>how</em> to do it. In other words, it is up to the interface to define what equality means for that interface. Being separated from its implementation(s), the interface must therefore define <code>equals()</code> in terms of comparisons of its own members. Thus, it cannot require the other object to "be of the same class" without having inappropriate knowledge about at least one of its implementations.</p>

<p>One problem is that a class in Java is somewhat ambiguous as it both has an interface and provides an implementation for it. This makes the interface more implicit. If you think it makes things clearer, extract an interface from your superclass and let it define (through documentation and unit tests) the exact behavior of the implementation. Then implement that exact behavior in any way you see fit in your class.</p>

<h4>Example: Collections in Java</h4>

<p>A good example of how things should work is the collections framework in Java. If we look at the documentation for the <code>equals()</code> method of e.g. the <code>[Set-&gt;http://java.sun.com/j2se/1.5.0/docs/api/java/util/Set.html]</code> interface, we see the following. Pay special attention to the last sentence.</p>

<blockquote>
  <p>Returns true if the specified object is also a set, the two sets have the same size, and every 
  member of the specified set is contained in this set (or equivalently, every member of this set 
  is contained in the specified set). This definition ensures that the equals method works 
  properly across different implementations of the set interface.</p>
</blockquote>

<p>This behavior is defined by the interface <code>[Set-&gt;http://java.sun.com/j2se/1.5.0/docs/api/java/util/Set.html]</code>. It is then implemented in the abstract class <code>[AbstractSet-&gt;http://java.sun.com/j2se/1.5.0/docs/api/java/util/AbstractSet.html]</code> which is in turn extended by <code>[HashSet-&gt;http://java.sun.com/j2se/1.5.0/docs/api/java/util/HashSet.html]</code> and <code>[TreeSet-&gt;http://java.sun.com/j2se/1.5.0/docs/api/java/util/TreeSet.html]</code>. None of the two subclasses override <code>equals()</code>.</p>

<h4>Example: Employees and Managers</h4>

<p>In a blog entry, Cay Horstmann uses [another example->http://www.artima.com/weblogs/viewpost.jsp?thread=4744]. However, he is arguing for using <code>getClass()</code> rather than <code>instanceof</code>. His example includes a class hierarchy where we have an <code>Employee</code> class as the base and then a <code>Manager</code> class which extends <code>Employee</code> by adding a <code>bonus</code> field. Expressing the example in code, it would look something like below.</p>

<pre><code>public Employee {
    // ...
    public boolean equals(Object other) {
        if (!(other instanceof Employee)) return false;
        // cast other to Employee and compare fields
        // ...
    }
}

public Manager extends Employee {
    // ...
    public boolean equals(Object other) {
        if (!super.equals(other)) return false;
        // cast other to Manager and compare fields
        return bonus == ((Manager)other).bonus;
    }
}
</code></pre>

<p>In other words, the subclass <code>Manager</code> changes the meaning of equality it inherited from its superclass <code>Employee</code>. Is this a sensible thing to do? As you might guess, I would say no. We (hopefully) decided when we wrote <code>Employee</code> that there was a given way to uniquely identify any specific employee. That might have been an employee id, combination of first name and last name, or any other combination of <code>Employee</code> members. For sake of discussion, let us say we compare the values of the function <code>getId()</code>. Being an <code>Employee</code> itself, what reason would <code>Manager</code> have to change this definition? To check if two <code>Manager</code> objects have the same id but different values for the field <code>bonus</code>? Well, if we do have two such objects, then <em>that</em> is the problem. We shouldn't have allowed them exist at the same time. The job of <code>equals()</code> is not to guard us from having corrupt data in our model!</p>

<h4>Final thoughts</h4>

<p>If a subclass truly has to override <code>equals()</code> to provide a semantically different implementation of <code>equals()</code> it might instead be a sign of that the subclass perhaps should not be a subclass after all. A subclass is supposed to extend or alter the behavior of a superclass or implement the behavior of an interface, but always doing so within the boundaries of all inherited interfaces.</p>

<p>One way to make sure subclasses does not break the contract is to make the <code>equals()</code> method in the superclass <code>final</code>. However, I think that is just overly protective. There could be a valid reason for wanting to override the <code>equals()</code> and still preserve its semantics. Performance optimization could be one such reason.</p>

<p>Thus, in my humble opinion, the correct way to implement <code>equals()</code> is as follows.</p>

<pre><code>public boolean equals(Object obj) {
    if (obj instanceof MyInterface) {
        MyInterface that = (MyInterface) obj;
        // compare public members of this and that
    } else {
        return false;
    }
}
</code></pre>

<p>However, my opinion might not be the same as yours, and your opinion might not be the same as mine (for symmetry purposes <img src='http://seattle.henko.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> ). If you happen to have another opinion, feel free to comment or trackback!</p>
]]></content:encoded>
			<wfw:commentRSS>http://seattle.henko.net/2006/05/18/implementing-equals/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Back to normal</title>
		<link>http://seattle.henko.net/2006/05/10/back-to-normal/</link>
		<comments>http://seattle.henko.net/2006/05/10/back-to-normal/#comments</comments>
		<pubDate>Thu, 11 May 2006 03:32:55 +0000</pubDate>
		<dc:creator>Henrik</dc:creator>
		
	<category>Studies</category>
	<category>Blabber</category>
		<guid isPermaLink="false">http://seattle.henko.net/2006/05/10/back-to-normal/</guid>
		<description><![CDATA[Today, [Göran->mt-rainier] flew home after a visiting me here in Seattle for ten days. After having first [Karin->gastinlagg-karin-i-seattle] and then Göran staying here in my room, I've started to get used to having someone around. But now things are back to normal, I guess. While "back to normal" include some nice things such as less [...]]]></description>
			<content:encoded><![CDATA[<p>Today, [Göran->mt-rainier] flew home after a visiting me here in Seattle for ten days. After having first [Karin->gastinlagg-karin-i-seattle] and then Göran staying here in my room, I've started to get used to having someone around. But now things are back to normal, I guess. While "back to normal" include some nice things such as less space occupied by beds, suitcases and other things, it is probably mostly a downgrade. I'll have to start doing some serious school work again, I probably won't do as many trips to different places as I've done lately, and I'll most likely have less fun in general. :-/</p>

<p>As a sidenote, I have found a [potential Master's Thesis->http://www.ce.chalmers.se/org/position/open/MindValue_(2).pdf] ("ex-jobb") at MindValue, a [Chalmers School of Entrepreneurship->http://www.entrepreneur.chalmers.se/] startup. We've got a meeting set up for when I come back to Gothenburg to discuss the work. Until then I don't know more than the linked-to document tells me, and they don't know more about me than my letter and CV told them. So in about two months we'll see if it is a match.</p>
]]></content:encoded>
			<wfw:commentRSS>http://seattle.henko.net/2006/05/10/back-to-normal/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Gästinlägg: Mt Rainier</title>
		<link>http://seattle.henko.net/2006/05/07/mt-rainier/</link>
		<comments>http://seattle.henko.net/2006/05/07/mt-rainier/#comments</comments>
		<pubDate>Sun, 07 May 2006 23:53:47 +0000</pubDate>
		<dc:creator>Göran</dc:creator>
		
	<category>Traveling</category>
	<category>Seattle</category>
		<guid isPermaLink="false">http://seattle.henko.net/2006/05/07/mt-rainier/</guid>
		<description><![CDATA[Efter en tidig väckning av dubbla väckarklockor och en snabb frukost begav vi oss ner mot centrum för att hämta ut hyrbilen. Väl nere i centrum fick vi vår bil (en Huyndai Accent) för att sedan sätta full fart mot berget. Resan gick först via I5 med dess 5 filer i varje riktning för att [...]]]></description>
			<content:encoded><![CDATA[<p>Efter en tidig väckning av dubbla väckarklockor och en snabb frukost begav vi oss ner mot centrum för att hämta ut hyrbilen. Väl nere i centrum fick vi vår bil (en Huyndai Accent) för att sedan sätta full fart mot berget. Resan gick först via I5 med dess 5 filer i varje riktning för att sedan gå upp i parken på en smal grusväg med helt enorma hål i. Väl uppe i parken möts man av en helt enastående natur; orörd "urskog" där naturen får sköta sig själv så när som på de träd som råkar falla över vägen eller på annat vis hindrar bilar eller personer att ta sig fram.</p>

<div class="images"><a class="imagelink" href="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_6062.jpg" title="Mt Rainiers topp"><img id="image197" src="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_6062.thumbnail.jpg" alt="Mt Rainiers topp" /></a><a class="imagelink" href="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_3355.jpg" title="Göran och Henrik på sten"><img id="image196" src="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_3355.thumbnail.jpg" alt="Göran och Henrik på sten" /></a></div>

<p>Vädergudarna var helt klart på vår sida denna dag, solen stod högt på himlen och ett par solglasögon hade verkligen inte suttit i vägen. Stigarna var fina och naturen som sagt magnifik, ju högre upp man kommer desto bättre blir utsikten mot berget och dess glaciär. Större delen av vandringen går stigen längs med Carbon River viket ger en fantastisk utsikt mot de omkringliggande bergen. Strax innan vi nådde fram till Carbon Glacier korsade vi vattnet via en hängbro.</p>

<div class="images"><a class="imagelink" href="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_6071.jpg" title="Hängbro över bäckravinen"><img id="image198" src="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_6071.thumbnail.jpg" alt="Hängbro över bäckravinen" /></a><a class="imagelink" href="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_6073.jpg" title="Berg (eller var det en glaciär? :-) )"><img id="image199" src="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_6073.thumbnail.jpg" alt="Berg (eller var det en glaciär? :-) )" /></a></div>

<p>Väl uppe vid glaciären tyckte vi den såg väldigt liten ut och efter att ha gått runt lite för att kika närmare bestämde oss för att äta vår medhavda matsäck. Under tiden vi åt satt jag och tittade ner mot vad vi först identifierat som en bergvägg och inser till sist vårt misstag. Vi hade på grund av allt grus som satt fast i ytan på isen misstagit den relativt stora glaciären för ett berg. Då vi äntligen insett detta valde vi att klättra en smula utanför ledan och ta oss ner till smältvattentunnelns utlopp från glaciären. Det kändes ganska imponerande att stå såpass nära en glaciär, men medans vi stod där damp det ner sten i en väldig fart en 10-15 meter från oss. Då insåg man lite varför det inte är rekomenderat (läs förbjudet) att gå ner till glaciären och vattnet.</p>

<div class="images"><a class="imagelink" href="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_3333.jpg" title="Smältvattenstunnel"><img id="image194" src="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_3333.thumbnail.jpg" alt="Smältvattenstunnel" /></a><a class="imagelink" href="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_3337.jpg" title="Henrik framför glaciär"><img id="image195" src="http://seattle.henko.net/wp-content/uploads/2006/05/IMG_3337.thumbnail.jpg" alt="Henrik framör glaciär" /></a></div>

<p>Efter detta begav vi oss tillbaks till bilen för att ta oss tillbaks, på vägen tillbaks såg vi dock ett vattenfall skymta fram mellan träden och stannade därför. En kort promenad så var vi precis vid vattenfallets nedre del, det var väldigt fint med härligt ljus som kom mellan träden, en mycket bra avstickare. Efter denna lilla avstickare åt vi resten av vår matsäck och begav oss sedan tillbaks till Seattle för att lämna tillbaks hyrbilen.</p>

<p>/Göran</p>
<p>Show this on a <a href="http://seattle.henko.net/postmap/?id=193">map</a>.</p>]]></content:encoded>
			<wfw:commentRSS>http://seattle.henko.net/2006/05/07/mt-rainier/feed/</wfw:commentRSS>
		</item>
	</channel>
</rss>
