Sunday, August 24, 2008

Goal

Well I haven't been good about posting for the last few weeks. Life has been very busy. I'm still adjusting to my new 4 10 hour work day schedule. Having Friday's off is great but it makes for a long week on the front side.

So this week I did it. I met my weight loss goal to be at 169 lbs. I actually came in a touch below that in Saturday's weigh in. I have to say I'm kind of amazed that I was able to do it and do it so fast. 18 lbs down and I don't feel like I've had to deprive myself. It did require work and dedication but everything worth doing does.

I've been reflecting a bit about what it took to meet this fitness goal. The biggest key for me was tracking what I eat. Using the weight watchers point system made it easy to figure out how much I should eat. Tracking things help me be sure I was on target and not eating to much. I realized in the past I would mindlessly eat and that can be really dangerous. I've also really started reading labels more. A lot of things I thought weren't that bad to eat really have more calories and fat in them than you realize.

Now being at my goal is the end either. I still have a couple more weeks in my work sponsored contest. I still want to lose a few more pounds too. I'm in my healthy weight range but I'd like to be a little further in it. I also want to now shift my focus to muscle tone.

Anyhow I'm going to try and get back into posting more often. I have a number of geek related software engineering posts I've been thinking about and just need to sit down and write.

Sunday, July 27, 2008

Consistency or lack there of

I've been wanting to write a posting about consistency for a little while now. I feel a bit hypocritical in doing so as I haven't been real consistent in posting for a little while. Nevertheless I would like to comment on how important I believe consistency is in issues of fitness, software development and life in general.

First off a quick report on my weight loss progress. I lost 1.4 pounds last week and .4 pounds this week. Both those numbers are inconsistent for me. I've been at a steady 2 pounds per week. I can attribute the change though to some inconsistencies in my behavior. We had a number of clients in town at work which changed my schedule 2 weeks ago. It also introduced a bunch of food in the office, dinner with clients etc. While I worked to eat healthy I didn't follow things as rigidly and the results show. I also got off my normal exercise routine. This last week my wife was out of town. I don't have a problem cooking, but I spent a couple nights at my parents house and then went out with family to eat as well. I also missed one of my regular workouts. Hence the results.

Now I'm not particularly disappointed as I still lost some and I've been doing really well. However it did remind me that we have to consistently make choices in accordance with our goals if we want to make progress. When we don't have that consistency our results will vary.

There are some interesting applications to software development here I believe. Producing quality software requires that we consistently do those things that result in success. Coding standards have to be followed to keep code understandable. Test driven design needs to be followed consistently or its benefits will not be seen.

If we are using an XP style estimating mechanism where velocity is tracked and used to predict when things will be finished you have to be consistent in getting things done or your estimates will be off. If you push hard to get a certain velocity that isn't maintainable, that you can't do consistently and base estimates on it you will be in trouble.

Now being consistent isn't easy. It requires a real commitment as life always throws curves at you. It is easy to be disrupted but you have to plow through and when you aren't consistent, take it as a learning opportunity.

Sunday, July 13, 2008

Motivation

We all deal with motivation on a daily basis. Something motivates us to get out of bed in the morning and do all the things we do. I've been thinking of motivation lately in terms of software development teams and getting a large project done. I realized this crosses over into my efforts to get fit as well. So here are some of my recent thoughts, random as they may be about motivation.

I had a weigh in Saturday morning and found out I was down 2 more pounds. That brings the grand total to 9 pounds since I officially started tracking. I also set my official Weight Watchers weight goal to 169 pounds. That is in my ideal weight range with a little padding from where I really want to be, 165- 167 pounds.

These weekly weigh ins are providing me with a lot of motivation to keep going with my fitness efforts. Every week that I see the results of my efforts and it makes me want to keep going. When I started 20 pounds seemed like a lot, but as I see progress made it seems more and more obtainable.

Motivation is a common problem for large software projects. If you aren't going to complete your ultimate goal for many months or weeks you often feel like you are making no progress. It is therefore very important that you create smaller goals you can complete. Extreme Programming talks about this as having a sense of completion. The idea is to make sure the team feels it completes things as it goes. This is one of the purposes behind having iterations. A large project can be divided into many smaller pieces. Each piece can be completely completed thereby bringing a feeling of completion and progress.

I think with any long term project you have to celebrate the progress you are making. This is key to mainting the desire to keep going forward. It is also one thing I need to do a better job of with my team. We need to celebrate our successes better. It is something I hope to work on. Even a little recognition/celebration can go a long way.

Sunday, July 6, 2008

Taking Control

This Saturday brought another weigh in for me. I was a little nervous being that it was right after the 4th of July. However my efforts paid off and I was down 2 more pounds this week. I did a nice 3.5 mile brisk walk Friday morning to prepare for the BBQ later that day. I also ended up doing a lot of walking where we watched fireworks (to and from the car, around the vendor booths etc). That along with my planning and control to not eat to much resulted in me not undoing my work for the week.

I've decided as I started my fitness journey that one of the big keys to becoming more fit or making any change in your life is the decision to take control. Too often we along other things to control us. I tend to allow stress, difficulties at work, etc to take control and cause me to "comfort eat". I tended to allow my busy schedule to control me and say I didn't have time to exercise. I tended to allow my stomach to get the better of me and control me and eat more and things I shouldn't.

The reality of my situation is that I really wasn't in that bad of shape and I don't have a huge amount of weight to lose. However by taking control of the situation now and deciding I will control my fitness level I'm seeing immediate benefits now and hopefully won't be totally out of control in a few years when it is really important and harder to change. By controlling my life now hopefully it won't control me keeping me from doing things I want in the future or causing me all sorts of medical problems that would end up controlling me.

Now I want to switch gears completly and talk about another type of control, the Inversion of Control Pattern in object oriented software design. Those who aren't interested in the geeky side of my life may stop reading now.

So this pattern isn't anything new to me, but I've been wanting to build my own implementation of it for a while. The problem I've seen with many of the existing frameworks is that they are rather complicated, more so than I need for most of what I do. Microsoft' has their Unity application block (previously ObjectBuilder) in the latest release of their Enterprise Library. An internet search will bring you several more for .NET and Java. I decided though I really wanted something a bit more simple.

So Saturday I wrote a implementation of the Service Locator pattern mentioned in Martin Fowler's article I mentioned above. I really like the concept of a service locator because it allows you to have objects request the objects they need when they need them. Generally when you do dependency injection any dependencies a class has are provided to it when it is constructed. This may result in object instances being created or work being done that a class may not need right away. Additionally a dependency a class, for example a presenter may have may only be needed if the user selects a particular option in an application. If the user doesn't ever try and do a certain thing the dependency may never be needed.

In light of this I like the concept of the Service Locator which can find object instances a class needs and provide them on demand. In this way a class asks the service locator for what it needs when it needs it. In my case I created a class called DependencyLocator which can return the implementation of a given interface, abstract class, or concrete class for a given type. So I can say for example that I need a ILoginService instance and it would return me an instance of the class registered with the locator that implements the ILoginService interface. In my version types are registered along with their corresponding implementation type. A new instance of the implementation type is created each time it is requested. Additionally a type can be registered with a specific object instance as its implementation. Then it functions like a singleton so any time the implementation of the given type is requested the same object instance is returned.

That is as far as I have gotten to this point. My next step is to create a mechanism for registering types with the service locator so that at app start up each type doesn't have to be manually registered. I can see two options for doing this. The first would be to use a config file and specify each type along with its implementation type. This would work and is a viable option but requires a config file me maintained. The option I want to pursue is to use reflection to scan an assembly and add a custom attribute that can identify classes which are to be registered with a service locator. Then classes with that attribute would be registered.

One minor gotcha with the service locator is that you have to have a reference to the service locator to use it. I plan to build a simple dependency injection mechanism to allow certain dependencies to be "injected". My plan is to build a simple factory that can do property style injection so I could use dependency injection to provide the service locator instance to a class that needs it.

Anyhow I'm excited to have a simple inversion of control framework I can use. There may be some simpler ones out there than what I've seen, but I'm enjoying implementing it myself.

Saturday, June 28, 2008

Stepping it up

So in one of my early posts I discussed my overall goal for this blog. I wanted to blog about both my life as a software engineering geek as well as my new goal to be more fit and lose about 20 pounds. This posting is about the later goal.

Today was time for another weigh in at weight watchers. I lost 3.6 lbs since my last visit putting my total losses at 5 lbs. For me that is about 1/4 of the way there. I'm very happy with that progress so far. It feels a little awkward perhaps to say that I go to weight watchers, but it works and I feel better and have more energy than I have had. I've always tried to eat healthy and exercise but since I've started I feel like I have more direction in that regard and motivation. I'm also trying to earn lots of tickets in my company's summer health slim down contest so I can earn cool prizes.

As a geek I'm used to working with numbers. I like things that are cut and dry. That is one thing that works well for me is the weight watchers point system. At the end of the day it comes down to counting calories and giving more preference to high fiber foods and less preference to high fat foods. Their point system just gives you easy cut and dry numeric guidelines to help you in those endeavours.

Now the reason for the title of this post is I also attribute much of my progress to "Stepping it up" so to speak and my pedometer. My wife had been wanting a pedometer and so at Mother's Day when I saw a sale for one online I decided to get her one as part of her gift and get me one as well. Of course being a geek this isn't just any old pedometer. It has a nice USB upload cable to allow me to download my stats onto my computer.

Since I got the pedometer I've been trying to walk 10,000 steps a day. I remember reading somewhere that indicated a healthy level of activity or something. In fact my personal health goal this month at work was to walk 160,000 steps from the day (10,000 a day during the week) we started with the goal (June 9th) to the end of the month. So far I have 181,337 steps, so I surpassed that goal. Another goal at work which gives you tickets is having 5 days in a week with 30 minutes or more of continuous exercises So I've been trying to have my 10,000 steps a day include at least 30 minutes of continuous fast walking. I've made that goal every week so far as well.

There was an interesting point made at the weight watchers meeting this morning. Someone used the analogy of how if you have a nice sports car you buy premium gas for it. Shouldn't we be putting premium gas in our bodies. Especially since they can't be replaced like a car. I hadn't thought of it that way before but by eating healthy and exercising we are putting premium in our bodies.

Wednesday, June 25, 2008

Team Building

When I hear the phrase team building I think of ropes courses or trust falls. However I was thinking about team building differently the other day. I was thinking about how one goes about building a good team, development team specifically. Over the course of the last 10 months or so I have been tasked with building a development team for my company. We went from mainly me to a four person team (myself and three other developers). This of course involved interviewing, hiring etc.

Anyone who has done hiring knows that the process of finding the perfect candidate is uncertain at best. One never really knows for sure how well someone will turn out until they are hired. You also never know if everyone will really gel together.

In my case I have to say that I've been able to build a very good team. We just finished an iteration that went really well and have started another. Everyone is working well together. We are getting tasks done and turning out a high quality product.

Looking back on it I'm trying to figure out what I did right to put together such a great team. While I did end up picking the people much of it I believe is not just the person but their willingness to adapt, learn and make the team work. To truly have a good team everyone has to put in the effort to make it work. I guess it goes back to a philosophy I picked up that when you hire the skills aren't the most important but the person and their personality. That isn't to say you can take a bunch of unskilled people and have a great team, but skills can be taught, work ethic, flexibility, and being a team player cannot be taught so easily.

At the end of the day I've got a great team and I'm grateful for them and their efforts. There is nothing to get you excited about developing a product like having a good team to develop it with.

Sunday, June 22, 2008

Carbs = Code

So a friend of mine will say that Carbs = Code referring to the need to eat to think and produce code. I was thinking about it the other day in relation to my new desires to be fit and my life as a geek. I decided to do a quick Google search about carbs and brain function. The first article I found confirmed something I have long suspected. Your brain requires carbs to function. What is interesting is that neurons cannot store glucose which is what powers them and therefore your brain. They require a steady stream of glucose from your blood supply. Also interesting is that they require two times the amount of energy as other cells in your body. The above mentioned article goes into all of this in more detail. What follows is my understanding of this and its application to life as a geek/software engineer.

Because your brain cannot store glucose it requires a steady supply to help you think at peak efficiency. When you eat simply carbs or sugary foods your blood stream gets an injection of sugar quickly. This sets off alarms in your body which cause insulin to be produced to remove the excess sugar from your brain. Your brain basically gets a bunch of energy and then as your body regulates itself the sugar supply dries up hence the infamous sugar high and then the crash afterwords.

We've heard of companies that try and keep snacks always within easy reach of their employees. The problem is that when these snacks are sugary you end up creating a vicious cycle of sugar highs and lows then needing more to boost your body again. It seems a lot like the drug addiction cycle, you need the drug to feel good when it is out of your body you want more and hence the cycle.

Now the alternative to simple carbs is complex carbs. Complex carbs such as whole grains, fruits and veggies etc release their glucose into the blood stream over time. This allows the brain to get a steady supply of energy without the high low effect. Clearly this would lead to better brain efficiency.

Now there is more to brain efficiency than just carbs, Omega-3 oils help build brain structure, water keeps things from being dehydrated etc. At the end of the day being healthy will make you more productive and be able to code better.

There are a few things I've noticed personally really help me.

1. I eat smaller meals more frequently. These allows me to make sure my brain has a steady supply of energy and I don't get that full bloated feeling.

For example I get up early early and have a light breakfast before I leave for work. When I get in I usually take a packet of instant oatmeal with me and use the hot water dispenser in the water cooler to make me some oatmeal right after I start work. Come mid morning I usually get a piece of fruit and like a light/low fat string cheese. Then I try and eat a healthy lunch and have another healthy snack before I leave for the day. I've noticed this really helps me to concentrate.

2. If I have a coding problem or issue and I just can't seem to get past it and I'm getting frustrated I try and think if I've had something to eat recently or did I just work through lunch. If I haven't had anything a snack is in order to feed my brain and hopefully work through the problem.

3. Sugary drinks, sodas, etc can really hurt you with sugar highs and lows not to mention caffeine etc. I know the sterotypical geek does the dew or drinks energy drinks. I think this can lead to an addiction cycle where you need the drink to pick you up from your last sugar low caused by the sugar high the drink gave you. I've found I prefer drinking a lot of water. This started after my mom who is a math teacher told me about a study they did that students did better in math class when allowed to have water during class. Given that your brain is mainly made up of water it would make sense that it needs water to stay healthy. So stay hydrated.

Anyhow at the end of the day the better we treat our bodies the better they will treat us. Coding is a complex and difficult thing that requires a lot of brain power. The better you treat your brain the better you will be able to code, at least that is my opinion.

So I know not everyone will agree with me on all of this but I think eating well can really help one be a better developer.