<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>sneeu.com</title><link>http://sneeu.com/blog/</link><description>Blog posts on sneeu.com</description><language>en-gb</language><lastBuildDate>Thu, 25 Aug 2011 10:39:17 +0100</lastBuildDate><item><title>Why Accessors, and Mutators</title><link>http://sneeu.com/blog/2011/8/accessors-and-mutators/</link><description>&lt;p&gt;The reason is: you will anyway.&lt;/p&gt;
&lt;p&gt;Take the following Java code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class Employee {
    public String fullName, bossName;

    public Employee(String fullName, String bossName) {
        this.fullName = fullName;
        this.bossName = bossName;
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Over time we come to realise that our use of &lt;code&gt;bossName&lt;/code&gt; was a little naive,
and we should have used a reference to another &lt;code&gt;Employee&lt;/code&gt; object, but we've
built up a lot of code atop the &lt;code&gt;bossName&lt;/code&gt; attribute, and now we're now stuck.&lt;/p&gt;
&lt;p&gt;This is why in Java it's a good idea to write accessors, and mutators for every
public instance variable. If we were to reference a &lt;code&gt;boss&lt;/code&gt; instead of
a &lt;code&gt;bossName&lt;/code&gt;, our code would change from:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public String getBossName() {
    return this.bossName;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public String getBossName() {
    return this.boss.getFullName();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A pretty trivial change when the accessor is used.&lt;/p&gt;
&lt;h2&gt;Why this isn't this isn't required in Python (and Ruby)&lt;/h2&gt;
&lt;p&gt;Initially the above code in Python is as follows:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class Employee:
    def __init__(self, full_name, boss_name):
        self.full_name = full_name
        self.boss_name = boss_name
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And once we realise that we're going to use an instance of &lt;code&gt;Employee&lt;/code&gt; as the
boss, rather that the &lt;code&gt;boss_name&lt;/code&gt; property, we can do the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class Employee:
    def __init__(self, full_name, boss):
        self.full_name = full_name
        self.boss = boss

    def get_boss_name(self):
        return self.boss.full_name

    def set_boss_name(self, boss_name):
        self.boss.full_name = boss_name

    boss_name = property(get_boss_name, set_boss_name)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To the outside world, the second example's interface appears exactly the same
as the first's.&lt;/p&gt;
&lt;p&gt;As I understand it, attributes in Ruby are more like the second Python example,
although they're generated automatically with the &lt;code&gt;attr_reader&lt;/code&gt;, &lt;code&gt;attr_writer&lt;/code&gt;
methods.&lt;/p&gt;
&lt;p&gt;Java best practices encourage you to protect yourself from future changes,
while Python, and Ruby allow you to get on with it with as little noise as
possible, and make it easy to change your mind later.&lt;/p&gt;</description><pubDate>Thu, 25 Aug 2011 10:39:17 +0100</pubDate><guid>http://sneeu.com/blog/2011/8/accessors-and-mutators/</guid></item><item><title>Agency to Start–up</title><link>http://sneeu.com/blog/2011/2/agency-startup/</link><description>&lt;p&gt;My slides, notes, and photo credits, as promised are online.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://sneeu.com/talks/refresh-2011/"&gt;Agency to Start–up&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Thu, 17 Feb 2011 16:18:48 +0100</pubDate><guid>http://sneeu.com/blog/2011/2/agency-startup/</guid></item><item><title>2010 A Review; 2011 A Preview</title><link>http://sneeu.com/blog/2011/1/2010-review-2011-preview/</link><description>&lt;p class="caption"&gt;&lt;a href="http://www.flickr.com/photos/sneeu/5324497101/"&gt;2011&lt;/a&gt; by &lt;a href="http://www.flickr.com/photos/sneeu/"&gt;sneeu&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img alt="2011 by sneeu on Flickr" src="http://farm6.static.flickr.com/5041/5324497101_e59872b0b9.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;My goals for last year were pretty large:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Get Married;&lt;/li&gt;
&lt;li&gt;Attend EuroPython;&lt;/li&gt;
&lt;li&gt;Have a new kitchen &amp;amp; bathroom;&lt;/li&gt;
&lt;li&gt;Rebuild this website;&lt;/li&gt;
&lt;li&gt;Give blood 4 times (once a quarter);&lt;/li&gt;
&lt;li&gt;Read 6 books;&lt;/li&gt;
&lt;li&gt;Post 52 blog posts (one a week, this is #1);&lt;/li&gt;
&lt;li&gt;Brew 3 batches of homebrew;&lt;/li&gt;
&lt;li&gt;Launch 1 side project;&lt;/li&gt;
&lt;li&gt;Learn Haskell &amp;amp; Scala (to a useable level);&lt;/li&gt;
&lt;li&gt;Attend a football match;&lt;/li&gt;
&lt;li&gt;Go camping;&lt;/li&gt;
&lt;li&gt;Go SCUBA diving.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ro and I got married, got a new kitchen, attended a football match, went
camping, and SCUBA diving.&lt;/p&gt;
&lt;p&gt;I read 17 books, brewed one batch of homebrew, learnt a little Haskell, although
not what I would call a usable amount.&lt;/p&gt;
&lt;p&gt;Ro and I also circumnavigated the globe as our honeymoon, visiting Hong Kong,
Fiji, Los Angeles, and Seattle.&lt;/p&gt;
&lt;p&gt;We bought a new car.&lt;/p&gt;
&lt;p&gt;I left agency life at Line, and joined Bloop as a co-founder and lead
developer, and attended dconstruct.&lt;/p&gt;
&lt;p&gt;And we visited Matt, Alison, and Brian in Iceland at new-year.&lt;/p&gt;
&lt;h2&gt;So what are the goals for 2011?&lt;/h2&gt;
&lt;p&gt;A bit more of the same: I found that I enjoy reading a lot more than I thought
I did, so I have a goal of 20 books this year.&lt;/p&gt;
&lt;p&gt;I'm also planning to attend DIBI, dconstruct, Euro DjangoCon, EuroPython, and
Build this year, although with 5 weddings, that may not be entirely possible.&lt;/p&gt;
&lt;p&gt;I have a few side-projects on the go, but I'm kept busy with Bloop and the
freelance work that I'm planning to take a break at least for the first
6 months of the year.&lt;/p&gt;
&lt;p&gt;The bigger plans revlove around fitness. I've been saying for the last few
years:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The year after next I'll get fit.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The goal is known amoung friends as:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Get the body of Daniel Craig.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;These are my goals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Run: 1000km, including at least 1 marathon.&lt;/li&gt;
&lt;li&gt;Swim: 100km.&lt;/li&gt;
&lt;li&gt;Walk/run the West Highland Way.&lt;/li&gt;
&lt;li&gt;100 pushups &amp;amp; 200 situps.&lt;/li&gt;
&lt;li&gt;Reduce my alcohol intake.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I also plan on frequenting the gym to "do weights", and machines, although I'm
a little shy about going to the gym.&lt;/p&gt;</description><pubDate>Fri, 07 Jan 2011 11:41:20 +0100</pubDate><guid>http://sneeu.com/blog/2011/1/2010-review-2011-preview/</guid></item><item><title>Punctuation Typography Pet–Peeves</title><link>http://sneeu.com/blog/2010/8/punctuation-typography-pet-peeves/</link><description>&lt;p class="caption"&gt;&lt;a href="http://www.flickr.com/photos/suavehouse113/3268370096/"&gt;Multiple Pauses&lt;/a&gt; by &lt;a href="http://www.flickr.com/photos/suavehouse113/"&gt;suavehouse113&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img alt="Multiple Pauses by suavehouse113" src="http://farm4.static.flickr.com/3362/3268370096_ca032ff8de.jpg" /&gt;&lt;/p&gt;
&lt;h2&gt;Ellipsis&lt;/h2&gt;
&lt;p&gt;Use a space before and after, unless punctuation follows, in which case, use no spaces.&lt;/p&gt;
&lt;p&gt;On a Mac, type ellipsis with &lt;code&gt;Option, ;&lt;/code&gt;. In Windows, hold &lt;code&gt;Alt&lt;/code&gt;, and type &lt;code&gt;0133&lt;/code&gt; on the numeric keypad.&lt;/p&gt;
&lt;h2&gt;Hyphens &amp;amp; Dashes&lt;/h2&gt;
&lt;p&gt;Hyphens are used to join words, to space out the syllables of a word, for example: “hy-phen-a-tion”, and of course for hyphenation (wrapping words at the edge of a page or column).&lt;/p&gt;
&lt;p&gt;An en–dash is mostly used when typing ranges, for example “25–30 years old”, or to join two words, e.g. “lager–beer”. An en–dash is not surrounded by spaces, unless its meaning would be ambiguous.&lt;/p&gt;
&lt;p&gt;An em–dash is often used to parenthesise a a fragment, and in some situations where you might use ellipsis. An em–dash is never surrounded by white–space.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Nineteen Eighty–Four—sometimes written 1984—is a 1949 dystopian novel by George Orwell.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;On a Mac, type a en–dash with &lt;code&gt;Option, -&lt;/code&gt;, and an em–dash with &lt;code&gt;Option, Shift, -&lt;/code&gt;. Windows is &lt;code&gt;Alt, 0150&lt;/code&gt;, and &lt;code&gt;Alt, 0151&lt;/code&gt; respectively.&lt;/p&gt;
&lt;h2&gt;Curly Quotes&lt;/h2&gt;
&lt;p&gt;Without knowing it, it’s possible you’ve probably been typing prime, and double primes without knowing it; use curly quotes when ever possible. Opening, and closing double quotes can be typed with &lt;code&gt;Option, [&lt;/code&gt;, and &lt;code&gt;Option, Shift, [&lt;/code&gt; (Windows users use &lt;code&gt;Alt, 0147&lt;/code&gt; &amp;amp; &lt;code&gt;Alt, 0148&lt;/code&gt;). Single quotes are typed with &lt;code&gt;Option, ]&lt;/code&gt;, and &lt;code&gt;Option, Shift, ]&lt;/code&gt; (Windows users use &lt;code&gt;Alt, 0145&lt;/code&gt; &amp;amp; &lt;code&gt;Alt, 0146&lt;/code&gt;).&lt;/p&gt;</description><pubDate>Mon, 23 Aug 2010 22:41:03 +0100</pubDate><guid>http://sneeu.com/blog/2010/8/punctuation-typography-pet-peeves/</guid></item><item><title>Playlist: Surf</title><link>http://sneeu.com/blog/2010/7/playlist-surf/</link><description>&lt;p class="caption"&gt;&lt;a href="http://www.flickr.com/photos/clashed/2831951893/"&gt;dune&lt;/a&gt; by &lt;a href="http://www.flickr.com/photos/clashed/"&gt;SARAΗ LEE&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img alt="dune by SARAΗ LEE" src="http://farm4.static.flickr.com/3122/2831951893_b02ae10a94.jpg" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The Ventues – Hawaii Five-O (Instrumental)&lt;/li&gt;
&lt;li&gt;Weezer – Surf Wax America&lt;/li&gt;
&lt;li&gt;The Smashing Pumpkins – 1979&lt;/li&gt;
&lt;li&gt;Dick Dale &amp;amp; his Del-Tones – Miserlou&lt;/li&gt;
&lt;li&gt;Pearl Jam – Go&lt;/li&gt;
&lt;li&gt;Brand New – Okay I Believe You, But My Tommy Gun Don't&lt;/li&gt;
&lt;li&gt;The Shadows – Apache&lt;/li&gt;
&lt;li&gt;Nada Surf – Slow Down&lt;/li&gt;
&lt;li&gt;Seafood – Toggle&lt;/li&gt;
&lt;li&gt;The Lively Ones – Surf Rider&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Listen to it on &lt;a href="http://open.spotify.com/user/sneeu/playlist/4BqZkoxzW7UcQXuwSTqLRV"&gt;Spotify&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Fri, 02 Jul 2010 15:19:41 +0100</pubDate><guid>http://sneeu.com/blog/2010/7/playlist-surf/</guid></item></channel></rss>