Thursday, January 31, 2008

Cycle your Network Adapter with Powershell

My desktop goes to sleep after 1 hour of idling. When it wakes, the network adapter is pretty grouchy! Post nap network performance for file shares hosted by the desktop is absolutely terrible and completely ineffective. Installing the latest drivers didn't help.

Disabling and enabling the adapter does help. Manually reseting a network adapter in Vista, however, gets tired (pun intended) real fast.

Thanks to this post from David Aiken, when my desktop awakes from a power nap, I revive the network with a power script!

Wednesday, January 30, 2008

C#'s Syntatic Sugar gets a Little Spicy

So far I've bought into the "All of C# 3.0's new language features are just syntatic sugar" view. Today I realized that this sugar has some kick to it.

If Lambda Functions are syntatic sugar, then Expression Trees are habanero peppers.

A lambda function is a new way to declare an anonymous delegate, which is effectively a function pointer. Lambda functions are compiled into executable code.

Expression Trees are data structures that contain descriptions of lambda functions. They convert your code into data. Somewhere down the road in your application a block of code will call Compile() on the expression tree to get a reference to the lambda function and then call Invoke() to execute the lambda.

I found these articles helped me understand Expression Trees:

Expression trees are used heavily by Linq and Linq to Sql. It's important to understand Expression Trees if you want to develop your own Linq IQueryProvider, which is not a trivial task!

Tuesday, January 15, 2008

CodeMash 2008 Day 2

Concurrency: Past and Present
Brian Goetz

Brian's keynote on the challenges of concurrent programming was very interesting. Brian was the most intense of the three keynote speakers.

Shared, mutable state is the root of all evil when it comes to concurrency. Languages like Erlang solve this problem by not supporting mutable data structures. Erlang's syntax, however, is cryptic and not very readable. Object/functional hybrid languages like Scala and F# try to give the best of both worlds.

In C# or Java, you can make your code more concurrent by designing immutable objects whenever possible.


Introducing Behaviour-Driven Development
Andy Glover

Andy masterfully engaged the audience in his session. He started off with an intro to jbehave. If you're a .Net developer, nbehave is the C# equivalent. He then moved on to easyb, a story driven development framework that Andy is building. Code Ninja Challenge Part 2

The second challenge was coded in Java, so it was easier for me to follow than the first. The function recursively calculated the greatest common factor (GCF) for two numbers. I could describe what the function was doing, but I couldn't remember that it was called GCF. After going back and forth for 10 minutes, the guys guided me towards the answer. They gave me an "A" for effort and I received my second Code Ninja badge.

Jim Weirich apparently solved the problem in 20 seconds!


DSLs in Static and Dynamic Languages
Neal Ford

My ninja training caused me to miss the beginning of Neal's presentation. When I walked in, he was demonstrating how to develop an internal DSL using Java. He then implemented the same DSL in Groovy, and then in Ruby. You could see the line noise decrease as he changed languages. Neal is a huge Ruby fan. He believes Ruby is the best language out there for creating an internal DSL (internal vs. external dsl courtesy of Martin Fowler).


RESTful Web Services
Dave Donaldson

Dave was a decent presenter. The session, however, was geared towards REST newbies. I've been playing with RESTful services for a few months now and I'm pretty comfortable with the basics. Dave also spent a little too much time on HTTP and SOAP basics and not enough time on REST. For those who are new to Web Services, however, the intro to HTTP and SOAP may have been just right.

This was the last session I planned on staying for. I decided to leave early and start the 250 mile drive home.


Final Thoughts

CodeMash 2008 was totally worth it. I made a few new friends and I've got two areas to focus on in 2008

  1. Improve my TDD discipline

  2. Learn more about Scala or F# (haven't decided which one yet)

I absolutely plan on attending CodeMash 2009!

Sunday, January 13, 2008

CodeMash 2008 Day 1

OpenSpaces Conferences
Bruce Eckel

Bruce discussed the OpenSpaces conference technique. With this technique, the attendees determine the session schedule and topics. Kind of a like an in-person wiki. CodeMash 2008 had an OpenSpaces track. I didn't attend any OpenSpaces sessions as my schedule was filled with traditional sessions.

Software Engineering & Polyglot Programming
Neal Ford

Neal's presentations were, by far, the most thought provoking. He's an excellent presenter whose subtle humor makes his talks very entertaining.

Polyglot programming means developing multi-lingual software. Anyone who has developed a sql backed web app is most likely a polyglot programmer because you would have used

sql + c# / + html + javascript

Polyglot programming is about using the right language for the right problem.

Neal also presented a comparison of software engineering to traditional engineering.

The final output of a traditional engineering project is a set of drawings. Those drawings are the input into the manufacturing process. In traditional engineering, the design process is iterative, creative, and difficult to pin down to a schedule. The manufacturing process is very expensive.

The final output of software engineering project is the source code. As with traditional engineering, the design process is iterative, creative, and difficult to pin down. The manufacturing process, compilation and deployment, is incredibly cheap.

He contends that the primary tools of software developers are languages, not IDE's. He also states the the engineering rigor for software development is automated testing.

The critical importance of automated testing was one of the primary themes of the conference.

Testing Mandatory
Joe O'Brien

Joe is a Ruby guy, so his session was focused on testing in Ruby.

Joe described an interesting technique for improving your unit testing habit and for learning a language's api. He suggests writing unit tests against the language's api.

Say, for example, you're learning about the .Net String class. You could write a test like this:

public void TestStringTrimming()
{ Assert.AreEqual<string>("Trimmed", " Trimmed ".Trim()); }

If you're using Ruby and RSpec, your test could look like this:

describe String do
it "should remove leading/trailing whitespace when you call strip" do
"Trimmed" == " Trimmed ".strip

Joe also may an interesting point on code coverage. With Ruby, he goes for 100% code coverage. It's achievable because of Ruby's flexibility. He wouldn't try to get 100% coverage with C# or Java because the some things are just too hard to do, such as testing private methods.

FlexMock: We Don't Need No Stinkin' Objects
Robert Stevenson

I have to say that this was the weakest session I attended. Robert used wild west metaphors heavily in his presentation. I'm not a fan of westerns, so the metaphors didn't keep my interest. It's obviously not Robert's fault that he picked a metaphor that I'm not interested in.

In his presentation he shared a quote from Martin Fowler stating that stub objects and mock objects serve very different purposes. However, when he demonstrated FlexMock, he didn't highlight these differences. His session ended 30 minutes early. It would have been nice if he used that extra time to emphasize the difference between stubbing and mocking.

Mashing it up with IIS 7
Scott Hanselman

Scott gave the funniest presentation; a mockumentary about how great he was. The keynote audience was roaring with laughter. It was a great post lunch pick me up.

IIS 7 seems very impressive. Microsoft really seems to be embracing the polyglot programming world that we're entering. Scott's demo had a couple of technical difficulties, but overall it was a very nice presentation.

Surviving & Prospering as a Computer Industry Consultant
John Stout

John Stout is the founder of Stout Systems. His presentation was focused on marketing techniques for independent software developers. This was a vendor session, which meant he only had 30 minutes. That didn't leave much time for details. None the less, I liked how CodeMash tried to mix business sessions into the technical sessions.

Applied Service-Oriented Architecture
Brian Prince

Brian gave a good presentation on SOA. His presentation didn't contain much new material, but it was well organized.

Advanced Ruby Design
Jim Weirich

Jim Weirich is an excellent presenter. He's also one of the smartest people I've ever met. He presented real world problems he had to solve and the advanced Ruby techniques he used to solve them. He was quite good at getting the audience involved.

This presentation by Dave Thomas is another good source for advanced Ruby programming techniques (Dave Thomas wasn't at CodeMash, but I thought this was a good place to put the link). Code Ninja Challenge Part 1 had a booth at CodeMash and they are hiring. They posted a couple of code snippets on an easel, asking the attendees to explain what the code snippets did. The first snippet was a recursive function that took a list of strings as input. It prepends the string"Ninja" to each member of the list, unless the member was "Ninja", in which case it changes the member to "". I had to ask what language the snippet was written in. The snippet was in Perl, which shows what little experience I have with Perl. I was still able to give the answer they were looking for. I was rewarded with an Ninja Coder sticker. They were doing actual interviews right there, but the the jobs were in Seattle. I think it would be neat to work for, but not neat enough to move across the country.

Overall, I enjoyed my first full day at CodeMash. So far it's been worth the investment.

Wednesday, January 9, 2008

CodeMash Day 0 => Expert’s Panel

I'm here at CodeMash 2008 in Sandusky, Ohio. The first event was a Q&A session titled

Technology for Humans: Selling Your Ideas, Products, and Services

The panelists were:

All the panelists are consultants who work for or own small IT consulting shops. The advice from the panelists distilled into two main themes:

  1. Sell solutions and value, not technologies. There may be times when a Client wants you to use a specific technology for political or other reasons. The panelists recommended understanding why before agreeing to use it.

  2. Do not get into a "Battle of Costs" because you will lose, especially on "commodity like" projects. All panelists shared experiences where they walked away from a potential Client because the Client's only focus was cost. In their experience, those types of projects are best suited for shops that outsource the programming to low cost markets.

The session reaffirmed the critical success factors that I've heard about, read about, and experienced first hand. Even though the session didn't reveal "anything new", it was nice to see that the fundamentals of good consulting remain the same.

Sunday, January 6, 2008

Google Notebook

The Firefox and IE extensions for Google Notebook are great. If you use Google Notebook and Firefox / IE and you don't have the extentions, go get them now. I've been using both extensions for months and I've never had a problem.

For me, Google Notebook is bookmarks on steriods. When I find a good page while researching or troubleshooting, I highlight the appropriate text, right click, and pick "Note this". A new note is created containing a link to the page and the highlighted text. When you're viewing your notes, the highlighted text is displayed for each note. If the text you selected is the only information you need from the page, then you don't need to load the linked page (cause the text that you need is right there in your Notebook!). You can categorize, tag, and annotate your notes. If you wish, you can make your notes public.

The extension window rests in the lower right corner by default, but you can "pop it out" to a larger, new window if you wish. If you want to search your notes, you have to load the full Google Notebook site. You cannot search your notes from the extension. IMHO, this is not a big deal.

Google Notebook has come in very handy. It's a great addition to your Developer's Toolbox.

CodeMash 2008

CodeMash – I'll be there!
I'm heading out to CodeMash 2008 this week. I'm looking forward to spending a couple of days with a bunch of people much smarter than I. The conference center is supposed to have great wireless connectivity. As long as the meeting rooms have enough power outlets, I'll blog after each session. Otherwise, I'll blog until my battery dies :-)

For those who haven't decided, there is still time to register. Here's the session list and schedule.