CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Raymond Lewallen

Framework Design, Agile Coach, President Oklahoma City Developers Group, Microsoft MVP C#, TDD, Continuous Integration, Patterns and Practices, Domain Driven Design, Speaker, VB.Net, C# and Sql Server

March 2007 - Posts

  • Publishing links I find interesting from my Google Reader shared items

    I've imported all my feeds into Google Reader, and am sharing out posts that I believe are interesting at this URL:

     http://www.google.com/reader/shared/13682218987470453170

  • Common Design Patterns Solution File from my presentations

    Sorry, I thought I had put this up.  This is the solution file that contains the quick presentation and simple examples on some common and basic design patterns.  This is quite the popular presentation, and I'll be doing it again April 2nd at the Oklahoma City Developers Group meeting.

    Download the zip file here.  As discovered by jdn, use FireFox to download the file from this link, as IE is messing up the zip file.

    Alternate location to download the zip file

  • The WPF Wiki - Good WPF Resource Center

    If you are looking for a good resource for WPF material, I came across this one this morning while looking for WPF stuff.  The WPF Wiki.  I just started out on the All Pages portion and there are quite a few pages already in place, of which the 2nd page listed is a WPF Resources page.  I was specifically looking for creating a collection in XAML, and found it right here with good code samples.  Some of the pages are lacking in meaty material (such as the What is XAML, which has a reference back to Wikipedia), but all in all it looks like a good resource and of course will get better.

  • Don't just CodeBetter, LiveBetter too!

    Update: Ok, this is not a reflection on conference food.  Microsoft catered in some rather healthy food for everybody to eat.  It was more a reflection on our computer knowledgable population in general.  Yes, I did observe some rather unhealthy habits at the conference, but that wasn't due to Microsoft bringing in truckloads of Ding Dongs and Twinkies (although I have heard that has happened in the past?  Just a rumor.). 

    Ok, I'm certainly not singling anybody out here, but as a collective, there is a decent percentage of programmers that are obviously overweight.  You've heard people talk: that fat, glasses wearing, backpack toting guy MUST be a geek!  Even if you don't wear glasses and tote a backpack with a laptop inside, if you're plain overweight, people assume you have a high probability of being a computer geek!

    So what can you do about it?  At the MVP summit, I observed many things (unhealthy things) that I believe people can do to curb their diets and become healthier, leaner people.  Am I the ideal role model for geek physique and healthy living?  Oh hell no!  I myself have unwanted weight that needs to be shed, but it takes time and effort.

    So I'm going to tell you about my "Programmer's Diet".  Its not any different from what you've heard in the past about other diets, but from geek to geek, maybe you'll take note of it as it works well for me.

    QUIT DRINKING ALL THAT SODA!!  For crying out loud, I think the software industry is in dire need of the programmer community.  The amount of sugary and caffeinated products that going into our collective system is enough to keep the entire soft drink producing business afloat.  Soda is not good for you, especially if you don't exercise.  You can't just sit and drink soda all day long.  You need to start making adjustments to your lifestyle that allow you to maintain your current rate of production but while eating more carbs more frequently during the day rather than supplementing your energy intake with energy drinks and sodas.  Once you drink a soda, you have to keep drinking it to sustain the pace of energy in which you started because you have to avoid that "crash".  Its like drugs, once you start, you have to keep taking more and more to sustain the same level of high you got the first time.  That soda first thing in the morning is like being a crack addict.  You have now given yourself up to the daylong exposure and consumption of sugar and caffeine.  Avoid it all together, especially in the morning hours.

    Understand your body.  Understand what makes you tick, your level of metabolism, your daily energy output and your base metabolic rate (BMR).  Your base metabolic rate is the amount of calories you must intake every 24 hours in order for your body to perform its base functions (pump blood, brain function, breathing) while at complete rest.  I am 6 ft 0 inches and 205 lbs.  I am a 31 year old male.  My BMR is right at 1950 calories.  BMR is calculated using the following formula:

    English BMR Formula

    Women: BMR = 655 + ( 4.35 x weight in pounds ) + ( 4.7 x height in inches ) - ( 4.7 x age in years )
    Men: BMR = 66 + ( 6.23 x weight in pounds ) + ( 12.7 x height in inches ) - ( 6.8 x age in year )

    Metric BMR Formula

    Women: BMR = 655 + ( 9.6 x weight in kilos ) + ( 1.8 x height in cm ) - ( 4.7 x age in years )
    Men: BMR = 66 + ( 13.7 x weight in kilos ) + ( 5 x height in cm ) - ( 6.8 x age in years )

    Now you have to start to consider the amount of exercise you perform each day.  There is an actual equation used to calculate this stuff, called the Harris Benedict equation:

    1. If you are sedentary (little or no exercise) : Calorie-Calculation = BMR x 1.2
    2. If you are lightly active (light exercise/sports 1-3 days/week) : Calorie-Calculation = BMR x 1.375
    3. If you are moderately active (moderate exercise/sports 3-5 days/week) : Calorie-Calculation = BMR x 1.55
    4. If you are very active (hard exercise/sports 6-7 days a week) : Calorie-Calculation = BMR x 1.725
    5. If you are extra active (very hard exercise/sports & physical job or 2x training) : Calorie-Calculation = BMR x 1.9

    I go to the gym 5 days a week, M-F, and lift weights for 60 minutes each day.  No cardiac.  This equates to moderate exercise.  So my daily calorie requirement is 1950 * 1.55 = 3021 calories.  This means that in order for me to do what I do and not gain or lose any weight, I need 3000 calories per day.

    Now gets to part about gaining and losing weight.  The most important thing about adjusting weight is to know how many calories you intake every day.  This is critical.  Without putting in the effort to figure that out, you're not going to be able to adjust your lifestyle.  This is critical.  Once you know, then you can adjust your caloric intake to whether or not you want to lose or gain weight.  If you want to lose weight, you need to both exercise and consume less calories than your daily calorie needs.  If you want to gain weight, well, there are 2 options.  One, you can take in more calories than you need and sit on your ass all day.  This will make you fat.  Or, you can take in more calories than you need and lift weights.  This will make you more muscular.  Its a pretty straightforward thing there.  Either gain fat, or gain muscle.  For you men, ask the lady's which they prefer.

    So now that you understand the whole calories thing, you need to understand something else crucial to healthier living.  Don't eat 3 meals a day.  For example, if you need 3000 calories per day, and you eat 500 for breakfast, 1500 for lunch and another 1000 for supper (that's dinner for you non-southern-USA people), you're still not doing well, but better.  When you consume too many calories at one time, well your body can't use them all at one time.  Your body needs them spread out over a long period of time.  Too many at once and the excess gets stored as fat.  You MUST eat 5 to 6 small meals throughout the day, about 500 calories each for you 3000 calorie people.  This insures that you do not overload more calories into your body that what can be consumed in a given time.  Eat first thing in the morning, 4 more times spread throughout the day, and then again right before you go to bed.  That is a much healthier eating habit.

    Also, eat good, quality protein.  This also is key.  You can't just eat any kind of calories, you need good calories with quality carbs and protein.  If you lift weights like I do, then your body needs LOTS of protein, about 1.5 grams per lb of body weight.  For me that's 300 grams of protein per day.  Muscle is built with protein and is HIGHLY IMPORTANT for gaining quality body mass.

    Its just as simple if you want to lose weight.  Most high protein foods are low in carbs and even lower in saturated fats.  Eating high protein diets is also usually eating a low carb diet.  In order to lose weight, in addition to what we already discussed about calorie intake, high protein, low carb low sat fat diets is a must.

    What are some of the common and basic high protein foods?  Chicken, turkey, lean meats and beef, any type of fish, egg whites, dairy products.  Its more difficult for those trying to add mass as opposed to lose weight, as we must consume both high protein and high carb diets.

    So I've laid out a great starting point for you to consider looking at to curb your diet and live a better and healthier lifestyle.  Know how many calories you need, know how many calories you eat, adjust accordingly, exercise, eat the right kinds of calories in the forms of proteins and low carbs to lose weight, high carbs to gain weight.

    Disclaimer: I have never in my life taken a nutrition, food, health, diet, etc course or training.  I know what I've studied on my own and what works for me.  ALWAYS consult your doctor before starting a new diet and/or exercise plan.  I can only be held responsible if in 12 weeks from now you start to resemble one of the Spartan actors from the movie 300 by following my advice.  Otherwise, I had nothing to do with it.

  • CodeBetter welcomes Jean-Paul Boodhoo!

    CodeBetter would like to welcome our newest member, Jean-Paul Boodhoo!

    JP (as everybody calls him) has been somebody that I have followed for quite some time, as well as some of the other CBers.  JP is like a smarter and well versed version of me: we both dig TDD, DDD, agile practices, design patterns, framework design and so much more, he's just better at getting ideas out to the masses in an understandable and comprehensive dialect.  Many of us here at CB had a chance to spend a great deal of time with JP while in Redmond last week, and immediately, after meeting face to face, knew that JP was a perfect fit for the CodeBetter team.  Its immediately felt like he was one of us, so we assimilated him.

    We all know that JP is going to make CB so much better because of his vast realm of experiences and the input and feedback he'll be able to provide to the rest of us.  He is just one more validator to the thought process that goes on here at CB and provides that one more unique perspective on things that many of us here hold dear to our developer souls.

    JP is an excellent writer and teacher, conveys his thoughts and ideas extremely well, and will be somebody you'll be happy to be reading in your aggregators.  Most importantly, he is passionate about making excellent software products using proper design practices and principles, and wants to make you feel the same way.  In essence, he wants to help you CodeBetter!

  • Another big splash in Redmond - NStatic

    NStatic is a tool I have followed for quite some time now, eagerly awaiting for it to become available for use.  I spoke with Wesner Moise, the creator of NStatic, and he mentioned the date will be very soon.

    For those of you who don't know, NStatic is a static code analysis tool.  NStatic is used to track things such as redundant parameters, expressions that evaluate to constants, infinite loops and many other metrics.  Unfortunately, my knowledge of NStatic is limited as I have not been able to find a copy of the tool to play with.  I spoke with Wesner and forgot to ask him about getting an eval copy to explore.  I actually saw a bit of a demo Wesner did for Hanselman while standing over Scott's shoulder.  I was very busy that day and going in a lot of different directions so I wasn't able to really get the full demo I would have liked or talked to Wesner as much as I would have liked.

    I know I like the tool and what it is able to do, and as of Thursday morning at the summit, a lot of people who had never heard of it before were talking about it, so that is great news.

    I'm such a code metrics and analysis junky, that I'm sure I'm going to get to know Wesner much better once NStatic comes out.  Its surely to be one of those tools, along side FxCop and NDepend, that I run as part of a formal build process, provided a console executable exists for it.  Although these tools overlap in some aspects, they have very different paths for getting their data and each provide their own unique set of information, which makes each tool valuable on its own or as part of a more complete analysis package.  Of course, the FxCop TFS team has started to delve into code metrics themselves, but as I have mentioned before, they don't come close to what NDepend is able to provide.  NStatic is another big product that doesn't do code metrics, and may not take the place of FxCop, but is certainly going to fill in some serious gaps, which will make the tool invaluable.

  • NDepend makes a huge splash in Redmond

    I couldn't be happier for my friend Patrick Smacchia - the creator of NDepend.  Anybody who knows me knows that I am NDepend's biggest fan, other than Patrick himself, and really, really want to see the product hit mainstream use and make Patrick rich beyond his wildest dreams!

    There wasn't a day that went by that I wasn't able to talk to Patrick, but that was quite difficult.  You see, everytime I ran into Patrick, he was being mobbed by groups of developers that were amazed at what NDepend is able to do, and what you are able to do with it.  There is no telling how many times he demo'd his product (he even had the opportunity to demo his product to a Microsoft developer group in private), but his enthusiam for the product is matched by nobody, and its great to see how his excitement during demos is passed into those around him, getting them just as excited about the product.

    Its amazing to see how many people still do not understand code metrics and how easily available the information is.  And then to add on a query language - that just blows people's minds.

    Congratulations to my friend Patrick.  He and his product were a big success.  If you haven't checked it out yet, you don't know what you are missing.

  • Code metrics available in Orcas March CTP

    The FxCop team announced that the new CTP of Orcas now has code metrics.  I have the VPC setup for the latest CTP, but have not dove into it yet to check out the new features.  But from reading what the FxCop team has put up, this is certainly good news.  I currently use CodeRush to watch things like CC in my apps via a docked window.

    However, VS code metrics have a long, long ways to go before its going to be something that I use for serious analysis.  That's where NDepend comes in.  NDepend supplies over 60 quality and useful code metrics, and also has its own query language that Patrick calls CQL.  Its easy to use and is part of my formal build process.  Its going to be very hard for anything to dethrone NDepend as the king of code metrics.

    Its certainly nice to see that over the past several years MS is making strides to catch up to the tools that are out there.  Orcas is supplying code metrics and will have some sort of continuous integration built into the next version of TFS, but I don't know exactly what all that entails.

    Sorry VS team, I know you're trying, but you still can't compete with NDepends for full bore code metrics, but it does seem useful to use as a "quick look" tool at some basic metrics.

More Posts