Thursday, March 11, 2010 1:09:49 PM (Pacific Standard Time, UTC-08:00)
I'll be in Boston, MA on March 22 to teach an open enrollment course for DevelopMentor. If you want to learn about WCF, WPF, Silverlight, LINQ, Entity Framework, and more there is still time to sign up (note the date may no longer appear on the public calendar). http://www.develop.com/course/new-net3-net35-linqMention this blog post and you'll receive a discount as well.
Posted in DevelopMentor | Talks |
Thursday, February 25, 2010 9:32:15 PM (Pacific Standard Time, UTC-08:00)
I'm working on a fantastic website that I hope will have significant impact when it's ready. I'm planning on launching in roughly one month. I came across what I think is an awesome technique for seeing how your web page will look as you edit it. This is WAY beyond WYSIWIG: - Load the page you're working on in ALL the browser you care about. I'm using Chrome 4, FireFox 3.6, and IE 8.
- If you have the monitor space, cascade these browsers side-by-side.
- Add a meta-refresh tag to the header of that HTML file you're working on (or which consumes the CSS you're building)
<meta http-equiv="refresh" content="5" />
- Now here's the sweet part:
Edit the page in Visual Studio, notepad, whatever. When you press save all browsers reload their view in a few seconds!
- Now you get real WYSIWIG on real browsers.
That's it. The technique is totally low tech and would have worked for years. But I found it really helpful. Hope you do too. Be sure to keep watching here. I promise a cool site will be announced soon! Cheers! Michael @mkennedy
Posted in ASP.NET | Visual Studio | web2.0 |
Saturday, January 30, 2010 9:46:04 PM (Pacific Standard Time, UTC-08:00)
In this article I'm going to give you a simple, step-by-step overview of how to create
a Windows 2008 server image in Amazon's Elastic Cloud Compute (EC2)
infrastructure. Now I must admit I'd rather have found a good tutorial on The Internets
or even in a book. Feel free to send me any I missed. My experience is they are either
dated or about Linux and so on...
First, briefly why does one care about EC2? Well maybe you are buying into the whole
cloud computing story which lets you cheaply out-source your computer hardware for amazingly
cheap prices (staring around $0.20 / hour for a dedicated machine). That's a great reason
and Microsoft and
Google have interesting plays there too.
Personally I just want a simpler way to create virtual machines. We'll
have full admin access over remote desktop to our system to install whatever we want.
I'm putting Visual Studio 2010 Beta on mine to play around with that software without
'polluting' my real system.
Here we go. If you don't delay I suspect this would take you about 20 minutes
from start to login! Subsequent virtual machines are much faster to create
and launch because the can be based on pre-configured images.
1. Create an Account
Register for an Amazon Web Services account at http://aws.amazon.com/.
2. Enable EC2 Features
Enable Elastic Compute Cloud for your AWS account at http://aws.amazon.com/ec2/.
3. Launch a New Instance
Use the AWS Management Console to launch and manage your virtual images:
http://aws.amazon.com/ec2/home.
As the console says, choose "Launch Instance" under the "Getting Started" section. You
will be presented with a list of pre-configured images. We'll start with a stock
Amazon Windows 2008 server image.
4. Choose a Base Image
Now you'll be presented with a list of pre-configured virtual disk images.
This time we'll setup a 64-bit Windows 2008 Server (Data Center Edition).
Just choose "select" out of the list below:
5. Use the Request Instances Wizard
Use the Request Instances Wizard to configure the newly created instance
which includes configuring the security, choosing an encryption key,
opening ports in the firewall, and kicking off the new instance. Below you'll
see the encryption key step - be sure to download the key pair as you'll
need it for retrieving the administrator password.
6. Launch!
Here's what you can expect for the review screen of the Request Instances Wizard.
Press launch and you're almost there.
7. Launching... (AKA Wait 5 Minutes)
After you launch you're instance you'll get a confirmation screen to
show you it's being prepared and allow you to configure durable storage
and IP addresses (both entirely optional).
8. Back to the Management Console
Now if you choose "View your instances..." you'll see that your instance
is being prepared - it has a yellow pending status. This screen doesn't
always refresh on its own so use the refresh button in the upper right
of the console (rather than your browser's refresh button).
9. Running!
After a few minutes your instance with the yellow icon will turn
green and be in the running state. Note that at first this really
means booting up so you can't get to it right away. Give it another
minute or two...
10. Login Part 1: Getting the Credentials
Now you'll want to login. Of course, the system was created with
an administrator account which has a strong password. You'll need to
retrieve that password using the "Instance Actions -> Get Windows
Admin Password" option.
11. Login Part 2: A Little Hasty
You're probably excited to get this thing running and
if you try right away you'll get another message telling you
to be patient and try again in a few minutes. Just keep trying.
12. Login Part 3: Using Private Key
Eventual the new system is up and running and you can get the
password. The first step here is to pass in your encryption key
from the wizard step before.
13. Login Part 4: Administrator Account and Password
Pass in the encryption keys and you'll see the username and password
(don't get excited, I already changed the password!).
14. Login Part 5: Finding the Machine Address
When your instance starts, it'll be given an Internet visible DNS name
that you can use to connect via Remote Desktop. You'll find it in
several places. One of them is highlighted below. Note that this address
changes as you start and stop your instance.
15. Connected!
Now just fire up Remote Desktop, use the Administrator account and password
from step 13 to log in. Now you have full access to your Windows 2008 machine.
You can do with it what you will, install software, start serving web pages,
etc.
16. A Word of Caution
If your intent is to run a web server, then let it run. But if you are just
using this for your own purposes and don't need it when you're not logged in to
the machine, be sure to return to the Management Console and stop the instance. You can
alternatively do that by choosing "Shutdown" instead of logging out of your
Remote Desktop instance.
I hope you found this walk-through helpful. I just learned most of this myself
so I figured I'd blog it and everyone can learn from it.
Cheers!
Michael
Posted in Articles | Tools |
Monday, January 04, 2010 10:49:40 AM (Pacific Standard Time, UTC-08:00)
Rob Barry and Jack Vaughan interviewed me for their article on SearchCloudComputing.com entitled Azure cloud on horizon: The devil is in the data architecture detailsHere's a small excerpt. If you're interested in Windows Azure and Cloud Computing, read on...Microsoft did a good job when they designed Azure, according to Kennedy. "The company encourages you to build scalable reliable systems by basically making it really hard to do the stuff that makes systems unreliable," he said.
There are many developers curious about cloud computing, but most are being rather cautious. Directions on Microsoft's Sanfilippo said he's talked to more developers that are concerned about building on top of their existing work than re-coding everything to work in the cloud.
"There's still an education bit that has to happen about what kind of applications are appropriate for Azure. But I think there's a lot of curiosity about Azure," Kennedy said.
Still, he continued, "I don't know many projects that are betting the bank on Azure yet."
Note: This is a little dated as it was publish in July 2009 - some how I missed the original publication - but it's still an interesting read. Thanks Rob and Jack for the article and conversation.
Posted in Articles | Azure |
Wednesday, December 16, 2009 2:36:23 PM (Pacific Standard Time, UTC-08:00)
I recently wrote another article for DevelopMentor's Developments newsletter (not subscribed yet? see top-right of this page). This one is entitled
10 Features in .NET 4.0 that made Me Smile
Read it on the DevelopMentor website: http://www.develop.com/tenfeaturesdotnet4
I am republishing it below for you all to enjoy on your RSS readers.
Cheers, Michael
10 Features in .NET 4.0 that made Me Smile
I have been reviewing some of our upcoming classes at DevelopMentor this week. One
of those classes, What’s New in .NET 4.0,
left me excited for things to come.
There are a bunch of small but
wonderful features discussed in that class. I thought I’d take this opportunity
to write a few of them up and share the joy. I bet some of them make you smile too.
- The Parallel Extensions for The .NET Framework will be built into mscorlib.dll.
The fact that PFx will be part of the core .NET library says a lot about how much
faith and support it’s getting within Microsoft. BTW, here are some really great
demos for PFx in .NET 4.0.
- PFx introduces a new threading construct: Barrier<T>.
Barrier lets you define
rendezvous points in your code where multiple concurrent operations can automatically
sync-up. Here’s an example.
- Code contracts.
Code contracts allow you to assert truths about your code as if
you are writing a unit test. But these assertions live within your production code
and are both verified by the compiler as well as the runtime. Here’s the original
research project that lead to this feature on Microsoft Research.
- The WPF and Silverlight designers mostly work.
Now this shouldn’t be a point to
make me smile or get excited about, but it is. The pain and suffering around the
Visual Studio support for WPF and Silverlight designers has been so bad that a mostly-working,
and sometimes truly innovative design-time experience within Visual Studio gives
me real hope for these technologies. I’m actually excited about them now.
- Support for the MVVM pattern across both WPF and Silverlight.
Speaking of that XAML
stuff, if you write WPF or Silverlight code and don’t know MVVM, stop reading this
article and learn about it here. I’ll wait.
Ok, now you too should be excited to hear that there is improved support for MVVM
across Silverlight and WPF in a unified way. Smiles baby!
- WF (Windows Workflow Foundation) has an AsyncCodeActivity class.
If you have looked
at long-running workflows in .NET 3.5 you know they were hard. I even wrote about
them. WF 4 has a
class which has a BeginExecute / EndExecute pair of methods which much more closely
models the regular .NET async design patterns.
- WF has a rehostable designer (really, they mean it this time).
There are some great
uses for giving regular users a WF designer experience with the right granularity
of activities. Now it’s much easier. Here’s an app that rehosts the designer:

- Configuration-free WCF Hosting.
Hosting WCF services is now like hosting ASMX web services
if you like the defaults. Just throw out a service + contract + address and it’s
up and running. That’ll save a bunch of
<system.serviceModel>
configuration goo. Smiles!
- No more *.svc in our RESTful urls in IIS.
With the ASP.NET routing framework
and WCF REST introduced in .NET 3.5, we can create beautiful, expressive Uri’s for
our websites. For example:
http://lookatthiswith.me/watch/intro
But this falls apart
with WCF REST when we host it in IIS. Our service Uri’s look like this:
http://lookatthiswith.me/services/lookieservice.svc/lookup/json/cf7
And now we have this ugly .svc part-way through our Uri! Ick. Well, in .NET 4 that
Uri is much more customizable and the .svc is gone. Smiles!
- ASP.NET MVC has wicked JavaScript support.
JQuery is there by default. That’s awesome.
But there is also a class similar to the Html class (for HTML helpers) called Ajax.
This static class has functions like Ajax.ActionLink and effectively brings the
functionality of UpdatePanel to MVC!
Well there you have it. 10 awesome things in .NET 4 that made me smile this week.
I hope you find some to be welcome additions yourself! If you want to learn more
about .NET 4.0, check out our recorded webcasts here: http://www.develop.com/dotnet4webcasts.
Also have a look at my article from last month
Six Things That’ll Surprise You About
.NET 4.0.
Finally, if you have some training funds laying around, I’d love to spend a week
talking about these ideas with you in our What’s New in .NET 4.0 What’s New in .NET 4.0 class.
Michael Kennedy is an instructor for DevelopMentor where he specializes in core
.NET technologies as well as agile and TDD development methodologies. Keep up
with Michael via his Web site and blog at http://www.michaelckennedy.net or on
Twitter: @mkennedy.
Posted in Articles | DevelopMentor |
Wednesday, December 09, 2009 11:38:45 AM (Pacific Standard Time, UTC-08:00)
Posted in ASP.NET | DevelopMentor | Screencasts | Talks | web2.0 |
Wednesday, November 11, 2009 4:23:00 PM (Pacific Standard Time, UTC-08:00)
I recently wrote an article for DevelopMentor’s Developments entitled “Six Things That’ll Surprise You About .NET 4.0” You can read the entire article (republished just below this introduction) or if you’d rather see it as a quick set of 6 sides, you can see those here: Six Things That’ll Surprise You About .NET 4.0 In this article, we will explore some of the new features of the .NET 4.0 as well as Visual Studio 2010. Some of these features are well-known, but others haven't gotten the press that they deserve. I've combed through .NET 4 to pull out the cool features that maybe didn’t get all the press – but should have. Read on and be pleasantly surprised!
#1 Visual Studio 2010
You may have already known...
code-oriented features are a major focus of the improvements for VS 2010. For example, one style of development where developers sketch out a scenario in code involving a set of classes before they are completely written was painful in VS 2008 (e.g. TDD).
In this style of working, intellisense did all it could to get in your way and the IDE offered little to help move you forward. This gap was filled by 3rd party tools, most notably Resharper (http://www.jetbrains.com/resharper/).
In VS 2010, this capability will be built into the IDE -- can you say "CTRL-." anyone? See the sequence below for details.
(click image for full size view) But did you know...
that VS 2010 was rewritten in WPF and as part of that rewrite now has true multi-monitor support?
Yes, previously you could drag a build output window to a second monitor or the properties window to the side. But the part you really needed to split up, the code and designers, were solidly grounded in the one IDE window.
Not in 2010, you can pull these free and put them on your second, or third monitors. This aids both when working on UIs (you can see the designer and code-behind) as well as when doing TDD (you can see the test code and production code side-by-side).
(click image for full size view) #2 ASP.NET
You may have already known...
ASP.NET MVC is now integrated into VS 2010 and ships as part of .NET 4.0. In case you haven't heard of it, ASP.NET MVC is an alternative to the WebForms model that has been the backbone of ASP.NET for so many years. You can build well-factored, testable, and clean web applications more easily in MVC. for the very first time a true open source project will become and integral and supported part of Visual Studio and .NET? JQuery will now be part of all web projects created by VS 2010 by default. That goes for ASP.NET WebForms, not just MVC projects. In fact, you can even open a support ticket with Microsoft concerning JQuery. You can read Scott Guthrie's original announcement for more details here.
#3 WF 4.0
You may have already known...
that Windows Workflow 4 has been completely rewritten for .NET 4.0. It's not even backwards compatible with .NET 3.5's version of WF. Basically WF 3 was a good try, but suffered from a couple of major problems that could not be overcome by simply refactoring the library. WF 4 has a nice GUI workflow building designer that is part of the VS 2010 tools and moreover that designer is rehostable in your own Windows Forms or WPF applications.
Why might you do this? Consider an application where there is a scriptable aspect that is for non-developer types of users. Instead of giving them a scripting language such as Python, you can build WF activities and provide them with the designer to wire them together. This would give your application essentially a visual programmability.
(click image for full size view)
#4 Base-class Libraries
You may have already known...
.NET 4.0 has threading constructs like Parallel.For which are designed for leveraging parallelism and multi-core hardware in CPU-bound situations. These are a perfect compliment to things like the ThreadPool class which are intended for parallelism when latency in external systems (databases, web services, file IO, etc) is the bottleneck. there will be a new collection namespace called System.Collections.Concurrent?
Here you will find lock-free, thread-safe collections such as ConcurrentQueue . As we move from single core systems, to multi-core systems, and then into many-core systems (say 64 cores) these types of lock free objects will become increasingly important.
#5 WPF
You may have already known...
that the WPF and Silverlight designers in VS 2010 are greatly improved. You now have some features available that were only available in Expression Blend previously (e.g. data-binding). (click image for full size view)
But did you know...
the text rendering stack in WPF 4 has been completely rewritten.
Now text looks as clear in WPF as it does in GDI+ with ClearType enabled. This includes a host of edge cases, such as when the text is re-rendered via a VisualBrush, is used in animations, or even 3D text. Once again Scott Guthrie comes through with a great WPF 4 writeup on his blog.
#6 CLR and Base-class Libraries
You may have already known...
that .NET 4 ships with an entirely new runtime. There have been a number releases of .NET lately (2.0, 3.0, 3.5, 3.5 SP1) but all of these versions of .NET have run on the 2.0 runtime. For the first time since 2005, .NET 4 we'll have a completely updated runtime with new GC modes, side-by-side in-process execution of the 2.0 and 4.0 runtime, the loosening of COM interop rules with the No PIA feature (no Primary Interop Assemblies required). there are new numerical types including BigInteger which supports arbitrarily big integers and ComplexNumber for modeling systems with advanced mathematical formulas which involve the complex number system.
You'll have to look around a bit to find these types however as they are not referenced by default. They are in the new System.Numerics library.
.NET 4 is going to be an exciting release with a some very polished libraries and tools. This article just touched on a few of them.
- Visual Studio 2010 Multi-monitor Support
- JQuery is now part of ASP.NET
- WF 4 Has a Rehostable Designer
- BCL has New Thread-Safe Collections
- WPF has Real Text Support
- CLR and BCL has new Numerical Types
Posted in Articles | DevelopMentor | Visual Studio |
Thursday, November 05, 2009 8:20:00 PM (Pacific Standard Time, UTC-08:00)
At DevelopMentor we have been running a bunch of free webcasts. Last month it was TDD and Agile. This month we are running 4 webcasts celebrating the announcements around .NET 4.0, Visual Studio 2010, and PDC 2009. Join me Monday, November 23rd and register here: http://bit.ly/aspwebforms We’ll talk about integrating ASP.NET’s routing infrastructure into existing an ASP.NET WebForms application. This allows you to build SEO websites with URLs like http://dotnet.ubbuzz.com/tag/.NET+4.0 while still taking advantage of all the productivity features of WebForms such as post-backs, controls, UpdatePanel, and so on. We have room for a couple hundred more attendees so please register and be part of the fun. I promise lots of demos and somedisdainful comments about PowerPoint! Share it with your friends (social, virtual, real, and other types) using the widgets below! ASP.NET MVC: What’s that, you’d rather hear about ASP.NET MVC, not this creaky old WebForms stuff? That’s Brock Allen’s talk: http://bit.ly/intromvc WF 4: Is WF 4 and visual programming your thing? Check out Maurice de Beijer’s WF 4 talk: http://bit.ly/meetwf4 New Parallel Extensions your thing: Check out Andy Clymer’s PFX talk. (link to follow soon). Cheers, Michael
Posted in ASP.NET | DevelopMentor | Screencasts | Talks | Visual Studio |
Wednesday, November 04, 2009 11:17:00 PM (Pacific Standard Time, UTC-08:00)
Recently Llewellyn Falco and I did a webcast for DevelopMentor where we demonstrated some TDD techniques and introduced Approval Tests. We let the audience choose our project and they chose Space Invaders. It was all great fun. Now the videos and MP3 streams are online and available for download.
Be sure to check out the write-up we did afterward where we talked about the tools and gave you a chance to try it for yourself: TDD Space Invaders Write-up You can also watch two other, higher level agile webcasts by Bill Nazzaro here: Agile Webcasts at DevelopMentor Cheers! Michael
Posted in DevelopMentor | Screencasts | Talks | Unit Testing |
Wednesday, October 28, 2009 1:13:21 PM (Pacific Standard Time, UTC-08:00)
A joint post by Llewellyn Falco and Michael Kennedy
[Update: Get
the videos and additional downloads for this webcast.]
As a follow-up to our " Avoiding 5 Common Pitfalls in Unit Testing" article we did a webcast where we took a problem from the audience and solved it live and unrehearsed on stage. These kinds of performances are always a risk but that's part of what makes them fun. Of course, the question is could we have done it better? Here's your chance to try it for yourself (details below). The Problem: Our viewers chose to have us build the game Space Invaders. The first thing we had to do to sketch out a basic scenario we could implement. We started with a picture to remind what Space Invaders even was: This was too big of a scenario for us to tackle in the allotted 40 minutes for programming. So then we started by creating a simpler scenario which we sketched out on the "whiteboard": Click for full size image. Flushing Out the Scenario: In doing this, a couple of things were revealed about the game. First, we wanted to make the tank and aliens all be the same size so we could put them on a grid. But then we saw that our bullet wouldn't fit that story, so we introduced the idea of relative sizes. We also realized that even though we drew the block, it was too complex for the first scenario and it would have to wait. Notice that as we started writing the scenario in English, there are mistakes, irrelevancies, and problems with the order. This is OK. The thing to remember is that all of this was done for the sole purpose of creating a recipe for a scenario we could test. That scenario is the following:
[TestMethod]
public void TestSimpleKill()
{
// 1. Create a 15x10 board.
// 2. Place a 3x2 tank at 1x8.
// 3. Place a 2x2 alien at 7x3 heading west.
// 4. tank shoots
// 5. advance 4 turns
// 6. not won
// 7. advance
// 8. win
}
Now that we had the recipe, we could go about writing the code.
Here's your chance to play at home!
- Set your timer to 40 minutes.
- Create a new test project.
- Paste that method above.
- Translate the comments into code.
If you believe there's a better process, we invite you to try that as well.
We made it to step 4 during our presentation (download code below) and estimate another 15 minutes would have had the whole scenario done, tested, and well-factored.
Stories vs. Requirements (stories win):
We'd like to point out a couple of things about the story. First, it was quick to write the story. We did it in 5 minutes. Second, it translates well to code because it has behavior and objects working together. Let's compare that to the requirements that this story flushed-out.
- Need a board
- Boards should have width & height
- Boards contain game objects
- Game objects have a witdth, height
- Game objects have the ability to move each turn
- Aliens move either left or right each turn
- Bullets move either up or down each turn
- Bullets are 1x1
- Tanks are 3x2
- Aliens are 2x2
- The game is not won until all the aliens are killed
- The game is won if alll the aliens are killed
- An Alien is killed if it is hit by a bullet
- Tanks can fire
- Firing with a tank creates a bullet going up from the space directly above the tank
|
Now we want to point out that this requirements doc is much hard to understand than our story. For example, if you were to add more requirements (e.g. an alien also shoots) is that easy to determine whether we have complete requirements? It also takes much more effort to create and especially to tell if it is complete. People aren't made to handle requirement documents well but we are story-telling machines. We embrace this in our coding techniques.
We'd also like to mention some of the tools discussed at the end.
For remote collaboration we use:
Skype (audio / video)
VNC for screen keyboard sharing
RDP (windows remote desktop) -- requires Windows 2003/2008 server for pairing.
Source Control:
TortoiseSVN
TortoiseGit
Developer Tools:
Resharper
CodeRush
Testing Tools:
MsTest (in Visual Studio Professional and up)
NUnit
NCover
TortioseDiff
Approvals Tests
Approvals Tests CodeRush add-in
Rhino Mock
TypeMock
If you try this scenario yourself, please leave a comment about your experience.
Download the code and slides from the webcast here:
Code: TddWithLlewellynAndMichael.zip
Slides dmtdd.pdf
Cheers -- Michael and Llewellyn
Posted in DevelopMentor | Screencasts | Talks | Unit Testing |
Just a site note: I'm doing my part to rid the world of IE 6. Visit this site with IE 6 and you'll
get a shameful message telling you to "Stop Living in the Past".
|