« July 2010 | Main | September 2010 »

August 24, 2010

20x2x20 Week 1

A week ago I laid out my plan to try and spend a hour a day working on personal projects. Now that I've been at this a week I thought I'd assess if it was working. Turns out the "work method" I'm using already had a name called Pomodoro Technique as one of the commenters pointed out. While I'm using 20 minutes instead of 25, it is nice to know that others have found such a pattern helpful. The other part I wanted was some visual reenforcement of my progress and status. For that I chose a simple offline method.

Each day I'm marking the calendar that hangs next to my desk with an R if I spent my 20 minutes reading or with a W if I spent my 20 minutes writing. Thinking more about the goal to get back into the habit of working on personal projects I'm finding myself more interested in doing a little work every day instead of marathon sessions that I'm prone to. I know some of those writing sessions on the weekend were much longer than 20 minutes, but the fact that I've not been procrastinating about doing them to me is the bigger goal than the total hour count.

Along those same lines, thinking about the 20 days number, if I instead think of that as 20 days over 4 weeks or 20 days out of 28 days, that means I'm skipping each task twice a week. That feels about the right kind of flow and adjustment for doing other fun stuff. Net result: week 1 was a success and now onto week 2.

Tags: 20x2x20 life

Optional int

I've recently run across the need to have a optional int field. That is a property on a class that is of type int but can be left unset (or null). AS3 doesn't provide the Java equivalent of the Integer class so I was curious what my options are. Below are four options that I played with. If you know of others leave a comment.

Option 1: type it as Number

public class Temp {
    public var value:Number;
}

Pro: Test if value has been set using isNaN(temp.value). No compiler warnings for assignment to another int and mathematical operations.
Con: Doesn't convey that the value is of type int. Allows user to set non integer values.

Tweak: Provide a get/set that downcasts the incoming Number to an int and possible throw ArgumentError if a non int value is passed.

Option 2: type it as *

public class Temp {
    public var value:*;
}

Pro: Test if value has been set using temp.value == null or temp.value == undefined. No compiler warnings for assignment to another int and mathematical operations.
Con: Doesn't convey that the value is of type int. Allows user to set anything.

Option 3: get/set/isSet

public class Temp {
    private var _value:Number;
    public function set value(value:int):void { _value = value; }
    public function get value():int { return _value; }
    public function isValueSet():Boolean { return !isNaN(_value); }
}

Pro: Test if value has been set using temp.isValueSet(). Clear that value is of type int.
Con: Bunch of code. Not a common AS3 paradigm

Option 4: Integer class

public class Integer {
    private var _value:int;
    public function Integer(value:int) { _value = value; }
    public function valueOf():int {return _value; }
}
public class Temp {
    public value:Integer;
}

Pro: Test if value has been set using temp.value == null. Clear that value is of type int and is optional. Safe to use in mathematical operations.
Con: No direct assignment to another int. Bigger memory footprint.

Note: The use of the valueOf() function makes the Integer class do the right thing in most contexts such as var sum:int = 12 + temp.value. You do need to use valueOf() when doing direct assignment var value:int = temp.value.valueOf();.

Conclusions

I can see each of these options working based on the situation. Out of all of them Option 1 is the most appealing from a minimal code perspective and is a typical AS3 paradigm. Wrapping the setting with a conversion of the Number to int improves correctness.

Tags: as3 flex

August 22, 2010

HTML5 for Web Designers

This isn't the technical book I'm reading as part of my 20x2x20 experiment, instead it was one kicking around the office. By far the best introduction to HTML5 I've come across yet.

HTML5 For Web DesignersHTML5 For Web Designers by Jeremy Keith

My rating: 5 of 5 stars


Great introduction to what HTML5 is and how to start using it today. Having heard the term HTML5 tossed around a lot over the past year this book finally presented it in a concise and useful format. This isn't a technical deep dive but instead clearly outlines what HTML5 adds and provides plenty of links to find out more. Definitely spend the hour a quick read through requires.



View all my reviews

Tags: books html5

August 17, 2010

20x2x20

Over the last year since graduating I've succumbed to a hedonistic lifestyle. That really isn't me. At this point though I'm really out of practice of about focusing on something. As such I'm going to try a little strategy that revolves around setting aside an hour a day for "me time".

Why then, you may ask, is this entry not entitled an hour a day? In being realistic about my growing inability to work on anything, I'm hoping to within that hour focus 20 minutes on 2 different tasks for at least 20 days each month. Why 2 tasks? Well one thing that I know I've not been doing recently is reading technical books. 20 minutes, with a 10 minute buffer to clear my head, jot down thoughts unrelated to what I'm reading, is about what it takes I've found to get through a chapter of most technical books. I'm not a speed reader so that feels like a good pace and amount.

Now with a little reading out of the way, the goal would be to use the other half of that hour to work on a side project. I've read that it usually takes 10 - 15 minute of uninterrupted time to "get into the flow". Which means that if I think optimistically that it takes 10 minutes, that gives me 20 minutes of good flow time and the other half of the hour.

To me the balance between learning and do always has to be there, part of the reason that I loved Northeastern's cooperative education program so much. The last part about 20 days a month is to help me keep in mind that not every day do I necessarily have that hour. In fact I'd say spending that hour socializing and having fun with friends on board game night is probably a better spent hour in the long run. As such 20 days a month still means that the majority of the month I'm still making progress on the mountain of books and some itch that I like to scratch. The quantified self in me says that I'll also want to track that I'm doing just that.

Update: Had the thought this morning that I should have called this post my "20-20 vision". Ha, I pun me.

Tags: life plan

About