I will be giving a talk on 1 topic, but it will be separated into two parts because of the amount of material to cover.
Fundamentals of modern programming
Join C# MVP Jeffrey Palermo for a talk that gets back to the basics of programming with .Net in the 21st century. This talk will not venture into Test-Driven Development, Domain-Driven Design, O/R Mapping or other recent advances in programming. Instead, I’ll focus on fundamentals that few colleges or training courses are equipped to cover. Some fundamentals include the actual differences between procedural programs, object-oriented programs as well as how to leverage both for service-oriented programs. Code presented herein will be basic and geared toward illustrating specific fundamentals. An example presented will be what a class should look like and how to decide when to create a class. If you feel a bit rusty on your fundamentals or if you’d just like a refresher course, this talk is for you. (Level 200)
In my career, I’ve found that many programmer focus on certain technologies and become very skilled in them, but the foundation of programming knowledge is lacking. Granted, many of us may get along these days without having to write a compiler from scratch, but there is plenty of knowledge missing from the common base of programmer knowledge. My talk will not cover net glitzy technology. Instead, it will cover more foundational knowledge and extensively reference well-known works and software studies.
My goal is that those who attend my talk will leave with a better understanding for how to go about constructing software.
This weekend I was a groomsman at Kevin Dulaney’s (great friend from grade school) wedding in Missouri. I drove from Austin, TX on Friday and returned Sunday. 11-hour drive each way. I stocked up my Windows Mobile phone with podcasts and listened the whole way there and back. For those who ask “why would you do that”? It’s my study time. Constant learning. I get to attend virtual lectures by industry experts. Invaluable.
This is a configuration management tool that does the basics of integrating CruiseControl, automated testing, NAnt, MSBuild and other build-related things.
So far Vista isn’t the smashing hit many hoped it would be. I’m currently running XP on my home machines, XP on one work machine and Vista Business on my main work desktop machine (no issues so far). I’m curious to see what changes will be in Windows in less than 2 years!
From James Avery and Jim Holmes, this book covers so many tools and frameworks including many open-source ones I use on a daily basis. This book reaches out and brings to light that there are many, many great things out there that are not from Microsoft but aid in Microsoft development.
I’m still 3 weeks behind on my podcast list!!!! Arg!
There it is. A pile of ripped up note cards denoting all the engineering tasks completed by my pair. This was an unusual day because it started at 7:30am with some white board modeling and brain-crunching a very, very tough problem. We wrote out some tasks to get us started, and we played the TDD game. It was such a tough problem that neither my pair partner nor I could imagine the complete solution, but we could imagine a few things that would be included. We wrote down the items to do on note cards and ordered them. The navigator manned the note card deck. In the course of completing some of the engineering tasks (all part of the same story), we uncovered new tasks that needed to be done. We wrote those down and added them to the bottom of the pile. We also ran into a brick wall and had to stop to do another task before we could continue. We wrote that down and added it to the TOP of the stack. We used these note cards as a true STACK. FILO. It helped us stay on track. We finally got through the stack, and when we did, the story was implemented. We didn't have the complete plan at the beginning, but we adapted and changed the plan along the way.
This pile of ripped up note cards is all that's left of that nasty story. It did take us all day, though, and at 6PM, we both were wiped out! It was the last day of the iteration, and we had committed to the story. We ate a quick lunch at our desks and worked straight through. It was great that we were able to meet our iteration through micro-adaptive planning.
I hope I don't have to do that again for a long time because that was the most difficult pair-programming I have ever done. We were talking through the problems _all day_. My brain was hurting on the way home.
My pair partner commented that it would have taken him 3 days if he had had to work through this nasty story by himself. Pairing on the entire solution cut the delivery by 2/3.
I'm going to present you with a very exciting new feature of StructureMap that is available in the 2.0 release. You can download StructureMap from SourceForge.
There are plenty of articles about StructureMap's service location capabilities, and the documentation is quite good, but I'll throw out the bread-and-butter usage scenario for service location. Here is is.
I have an ICustomerRepository, and an "impl" class that implements the interface, CustomerRepository. As the names suggest, this interface will return an array of Customer(s) given a whole or partial phone number. Here is the full code.
Now that you get the gist of it, I'm going to use StructureMap to enable the Model-View-Presenter pattern in a cleaner way with ASP.NET UserControls. First consider the following usage:
I have a page that has a complicated piece which has been delegated to a usercontrol-presenter pair. The page, of course, will embed this usercontrol in the appropriate place. Immediately you can spot the problem: The "Foo" view is responsible for creating the "Widget" view. Then the Widget view creates its presenter and uses it. This is too much responsibility for both views.
Now consider an alternative:
Now notice that the FooPresenter is responsible for creating and using WidgetPresenter. WidgetPresenter, in return, uses StructureMap to service-locate its view, which implements IWidgetView. Because Widget.ascx.cs implements IWidgetView, this wiring works easily. The StructureMap change that made this possible is the following usage of the configuration. Here is the code:
Now that we can service-locate asp.net usercontrols, we can inject them as well. The next step is having the WidgetPresenter receive IWidgetView in the constructor. StructureMap will chain-create the usercontrol in order to create WidgetPresenter. Now, our presenter is in control, and the views can concentrate on presenting information to the user and not worry about control flow.
This month's speaker is Jeffrey Palermo. Jeffrey is an independent
software consultant with special skills in Scrum, XP, and .NET. He runs
the Austin .NET User Group and is the South Texas INETA Membership
Mentor. He enjoys spending time with his wife Liana, riding his
motorcycle and country dancing. He is a member of Journey Bible
Fellowship where he helps with the youth group ministry. Jeffrey is an
Eagle Scount and graduated from Texas A&M University. He recently
served in the Army in Iraq during Operation Iraqi Freedom.
Topic abstract: Developer testing
includes unit testing, integration testing, and acceptance testing.
Jeffrey will present how to test software in an automated way and how
to design code to be testable. He will provide a special focus on
testing ASP.NET and using mock objects.
To receive email notification of C# SIG announcements, please send a message to Harry Nystrom
Debugging can be easy or hard. It’s easy if you have an easily reproducible error. This morning I wrestled a bug where a screen just stopped showing data. Nothing. Zilch.
When I debugged through, I watched every piece of data get properly set to labels in my Winforms view that were visible, but the screen shows up without the data!! What gives?
Ultimately, I was looking at the wrong instance of my screen/view.
Here’s a debugging tip to use if you watch the code executing properly but it still doesn’t work in the end:
Make sure you are looking at the right object.
In the debugger, set a breakpoint in the constructor and ensure you are watching the right instance. In the immediate window, use the hashcode to track the instance:
I knew that Resharper had Nant and MSBuild support, but I don’t use it that much because once my build scripts are working, I modify them much more seldom than code. Today, however, I made some modifications, and I happened upon a Nant target that didn’t appear to be used: Dead code. . . er. . . xml. With cursor on the target name, I pressed CTRL+ALT+F7 to find usages, and it found none. I then proceeded to delete the target but in the safest way I know how, with R#’s safe delete, ALT+DEL. Here is a screenshot.
I continue to discover that the Nant support has so many of the features I rely on for C# work. Just had to share.
On May 5th (Cinco de Mayo, for those of you like me who live in a State that was once a part of Mexico), ADNUG is holding its second Code Camp. I’ll be giving a talk entitled Fundamentals of modern programming. Here is the abstract:
Join C# MVP Jeffrey Palermo for a talk that gets back to the basics of programming with .Net in the 21st century. This talk will not venture into Test-Driven Development, Domain-Driven Design, O/R Mapping or other recent advances in programming. Instead, I’ll focus on fundamentals that few colleges or training courses are equipped to cover. Some fundamentals include the actual differences between procedural programs, object-oriented programs as well as how to leverage both for service-oriented programs. Code presented herein will be basic and geared toward illustrating specific fundamentals. An example presented will be what a class should look like and how to decide when to create a class. If you feel a bit rusty on your fundamentals or if you’d just like a refresher course, this talk is for you.
Now, a question for you, my handful of readers: What should my outline look like? I have a rough one, but I would love to get some feedback on a subtopic that you think should not be missed. This talk is geared toward the basics of programming for those who already “know” how to program but skimmed over the fundamentals.
Another way to approach it is to think if you were giving the talk, or if you were in the audience. What is a topic that absolutely should be covered? Please leave comments.