Tuesday, November 16, 2010

My Treadmill Desk



Overview
At July’s Ignite San Diego, I saw Ernesto give a talk where he showed his treadmill desk. Yesterday, I made one for myself.

Am I able to work while using it? I’m writing this blog right now while walking at 1.5 mph. 

Verdict
I’m happy with the desk. I’m walking at 1.5 mph which is about right for me, sometimes I need to slow it down to 1 mph depending on the detail of work I am doing or if I am worried about sweating. You don’t sweat a lot but even so 2 hours of small sweat isn’t great if you are going to a meeting. I have not yet gotten to try it out pair programming (except remotely, which doesn’t count). I’m not sure whether or not you need 2 treadmills for that.

Cost
$1250 total.  
Let’s break that down.
Treadmill - $1,000
Desk - $250
I’m happy with my choices, but I believe a treadmill bought off of craigslist can dramatically improve the bottom line here.



F.A.Q
Q. Do the controls on the floor matter?
A. No, you aren't changing the speed often or at all, and it's moving slow.

Q. Do you like it?
A. Yes

Q. Do you sweat?
A. Not at 1 mph, a little at 1.5 mph

The Parts
The Tread Mill

I got a AFG 3.0 AT treadmill. It cost $800 on sale at sports chalet. I also got the extended 5 year warranty which was an additional $200. I don’t usually get the warranty, but thought I might be using this a bit more than the average person.
It’s worth noting this thing is HEAVY (350 lbs) so get some help moving it. 
The Desk

Ikea came thru nicely with the Fredrik 50 inch long desk($200). I modified the setup to put the top self at the bottom (which you need to do 1st) but otherwise it works perfectly.
Extras. I also got a 48 inch power strip ($25 at Fry’s) which I love and would recommend for any desk. A Belkin usb hub ($25), which makes it easier to hook up the laptop to the keyboard and mouse. 



The Build
The assembly of the treadmill looks quite complicated, but I wouldn’t know because it turns out you don’t have to do it. You don’t want the hand rails anyways. and the console is just sitting at the side of the base.
The desk is likewise easy to assemble. I placed the main desk layer so that when walking on the treadmill my arms naturally bent to that height. I am also liking having the  screen at the higher height, so i don’t have to bend over, which is a bit hard while walking.


Links

Saturday, September 25, 2010

Extension Methods

Extension Methods allow for the readability you expect in code you don't own. C# and Ruby have had them for a while, and I created a jar to so you can use them in java as well. (you can read the original post here)

I vBlogged my thoughts here:



Here's the simple reason you want a fluent interface for your code.











Download Extension Methods for Java

Thursday, September 23, 2010

Lamdbas in Java 1.6

If you've ever heard that java is a poor language because it doesn't have lambdas, that ends today!

I created a way to do lambda's in java 1.6 without changing: the JDK, the compiler, the ByteCode or the Syntax.

I vBlogged my thoughts here:


It's only a jar file, no special requirements or changes.

You can down load it here at www.approvaltests.com

You might also be interested in my similar addition of extension method in java

Here's the diagram of the syntax :

I also made a small tutorial here : http://blog.approvaltests.com/2010/10/java-lambdas.html


Tuesday, September 14, 2010

Theory Based Testing

Most of us are familiar with classic unit testing. Today, I wanted to talk a about a different form of unit testing, that is much more powerful when it is possible.

Theory based test take the normal form of
Given A & B expect C
and change it to
Given A & B expect C theory
This removal of the expected C, allows you to test MANY more cases, because you don't need to pre-plan the results for a given A & B

I vBlogged my thoughts here:


btw: if you are interested in attending an open spaces, check out Open Agile So Cal. There's one coming up in San Francisco Oct. 11, 2010

Saturday, September 4, 2010

Rewriting Vs Refactoring

Once again, I found myself having a discussion about the dangers of doing a legacy code rewrite. Durning this client meeting, I came up with an illustration I wanted to share.

I vBlogged my thoughts here:



These 3 graphs sum up the Massive Risk at the end.

The Rewrite Scenario





The Hidden Question at the End






The Refactor Scenario

Tuesday, August 31, 2010

The importance of your Compile Time

Lot's of time i find myself working to shorten compile and build times. While most people agree with shorter is better for compile times, the questions of what is short? and how important is it? seem to remain vague and seemly open to judgement.

It's not. So I wanted to take a moment to clarify it.


 I vBlogged my thoughts here





You can see the excel sheet here
and read the Joel on Software Thread here

Monday, January 18, 2010

Recipes in Java

 Learning to Program Java with Recipes


 

 14 amazing kids showed up yesterday for a session at Wintriss Techinical school on learning to program Java! We tackled 2 recipes durning these 2 hours, and wanted to show how to setup your own computer so you can continue at home.

 
 
 

Here's What you need to do to get started with the Recipes. First the quick-links, then detailed instructions below.

 







  1. Import Workspace

Download Java SDK


 If you don't already have java on your machine you'll have to download it. How can you tell if you do have java? open an terminal window.
Mac : command+space then type terminal and hit enter
Windows : windowskey+r then type CMD and hit enter
In the terminal/command window type
java -version
if you see something like
java version "1.6.0_15"
you've got it, otherwise download it from Sun at http://java.sun.com/javase/downloads/widget/jdk6.jsp
  

Download Eclipse


You want to download the "Eclipse IDE for Java Developers (92MB)"
it's here
http://www.eclipse.org/downloads/

Download the Workspace


Download the "Learn To Program - In Java" workspace from CodePlex. http://learntoprogram.codeplex.com/
Unzip it to the directory of your choice. But remember the location, you will need in the next step.

Import the Workspace

In Eclipse, right click in the Navigator Window and select "Import Workspace".
A Window will appear asking for an import source, select "Existing Projects into Workspace", if you can't find it start typing existing and it will appear.
Click next.
The root directory is the location where you unzipped the workspace.  then simply hit finish.

If you are successful you should see the IntroToProgramming folder in the navigator window.

That's it, Happy Programming!
If you have any questions, please feel free to email me.


 

Recipes in Java

 Learning to Program Java with Recipes


 

 14 amazing kids showed up yesterday for a session at Wintriss Techinical school on learning to program Java! We tackled 2 recipes durning these 2 hours, and wanted to show how to setup your own computer so you can continue at home.

 
 
 

Here's What you need to do to get started with the Recipes. First the quick-links, then detailed instructions below.

 







  1. Import Workspace

Download Java SDK


 If you don't already have java on your machine you'll have to download it. How can you tell if you do have java? open an terminal window.
Mac : command+space then type terminal and hit enter
Windows : windowskey+r then type CMD and hit enter
In the terminal/command window type
java -version
if you see something like
java version "1.6.0_15"
you've got it, otherwise download it from Sun at http://java.sun.com/javase/downloads/widget/jdk6.jsp
  

Download Eclipse


You want to download the "Eclipse IDE for Java Developers (92MB)"
it's here
http://www.eclipse.org/downloads/

Download the Workspace


Download the "Learn To Program - In Java" workspace from CodePlex. http://learntoprogram.codeplex.com/
Unzip it to the directory of your choice. But remember the location, you will need in the next step.

Import the Workspace

In Eclipse, right click in the Navigator Window and select "Import Workspace".
A Window will appear asking for an import source, select "Existing Projects into Workspace", if you can't find it start typing existing and it will appear.
Click next.
The root directory is the location where you unzipped the workspace.  then simply hit finish.

If you are successful you should see the IntroToProgramming folder in the navigator window.

That's it, Happy Programming!
If you have any questions, please feel free to email me.


 

Saturday, January 16, 2010

Mock Smells


Today, Bob Martin tweeted :

unclebobmartin

I use mocking frameworks as little as possible. I think heavy reliance on a mocking framework is a smell. I usually write my own mocks.

 

 

I agree with this. Of course the 140 characters allowed in a tweet don’t really give much space to explain what that smell is. So let’s refine our nose.

Mocks let you test implementation. Anyone who ever gets uppity about the use of stubs, fakes & mocks is paying a lot of attention to this. With a mock you can verify that something has been called. While this can be useful, it is rarely part of the Behavior of a system, and often part of the implementation. Since there are literally 1,000’s of way to program the exact same behavior, Unit tests that lock a particular implementation will actually in up “protecting” your code from being refactored.  This smell tends to come up in newly written code, and is usually accompanied by the phrase

anytime I want to change anything a bunch of tests break and I have to go and fix them”.

 

Mocks let you fake very hard to fake calls. Ever need to mock out a call to HttpServletRequest?  There are over 40 methods on that interface. Even with the help of your IDE, that’s a pain. A good mocking framework (I prefer EasyMock) will let you do it in 2-3 lines. This is great, especially in legacy code, or API’s you don’t control. But it’s a cover for a much more insidious smell that exists in HttpServletRequest. Simply put, an interface should not have 40 methods. Now you might argue that was how many were needed to handle something as complex as a web call. And you would be wrong. Take a look at Rack (or our Port of it - JRack) it handles everything with 1 simple abstraction. 

When mocks are the easiest way to gain an handle into your code, you have coupled you code too tightly, and not left enough inserts points.

 

Mocks let you fake calls. Lastly, mocks let you fake easy calls too. One example I use a lot is Loaders. My Loader interface looks like this:


public  interface Loader<T>

{

  public T load() throws Exception;

}

 

 

I will constantly be making calls like


request.init2Edit(new MockLoader<Member>(member));

 

 

 

But here a mocking framework is overkill. It’s so easy to write the above line, than


Loader<Member> loader = EasyMock.createMock(Loader.class);

EasyMock.expect(loader.load()).andReturn(member);

request.init2Edit(loader);

 

 

If  I’ve kept my code clean, mocking frameworks just aren’t that useful.

 

So hopefully you will start to sense the same things in your code. Of course if your nose is prickling over some hard to test piece of code, grab your mocking framework. It’s your first line of attack.  Like grabbing some cologne when you are a bit smelly and guest are coming over, just realize that eventually you have to take a bath.