Goodbye 2006, Hello 2007
First, to my readers (all three of you), I hope that 2006 treated you well and that 2007 is even better.
2006 treated me pretty well as years go. I actually kept the “get in better shape” resolution I made last year by joining these guys. There’s 25 pounds less of me right now than there was at this time last year. I took up a new hobby (skiing). I bought a new car. I also got to do some traveling (Killington, VT for skiing and San Francisco, CA for vacation). I learned enough of a new programming language (Ruby) to try a startup idea with Sandro. A few months ago, I got a new job (and a nice raise as a result).
I haven’t made any resolutions for 2007 (outside of “get in better shape”). I’ve been seeing more of these “101 things in 1001 days” lists (like this one and this one) lately. While I don’t think I’m nearly as ambitious as my friends, there are some things I’ve been thinking about doing that would be good to attempt this year:
- Learn a new programming language. One of the consultants that works for me has had a lot of good things to say about Eiffel. So far, I've installed the development environment, read a bit of documentation, and written a bit of sample code. There's a small product idea I'd like to try, and I plan to use Eiffel to do it.
- Incorporate. My friend Richard has been encouraging me to do this for years now, instead of being a regular employee for some company. He's been working for himself as long as I've known him (at least 12 years now) and has done very well. So far, I've bought a couple of domain names and done enough budgeting to determine what my hourly rate should be if I were to go into IT consulting.
- Re-learn the piano. I was good enough at it when I was younger that my last piano teacher wanted me to go to school at the Peabody Institute. Spending the past couple of years as a sound engineer for one of the services at my church just made me miss being able to play even more. Since I can still read music, I need to do something more with it.
- Study the Bible more regularly. Some years ago, I took a Disciple Bible Study class at my church. We covered 75-80% of the Bible over the course of a year. It was a very spirtually-rewarding experience. I want to get (and keep) my life in enough balance that I can make some Bible study a part of each day.
- Take a two-week vacation. 2005 was the first year I'd taken more than a week off in a row since my undergraduate days (back in the mid 90s). I took a bus tour through western Europe for nearly two weeks with my dad (and about 50 other people) and had an excellent time. It really helped me disconnect from work concerns, and I'm positive I'll need to do that again this year.
More on databases and business logic
This particular entry in the “forever war” of whether to use object-relational mapping or stored procedures does a better job than most in these ways:
- It changes the argument from "either-or" to a situational one.
- It broadens the scope of database objects in the discussion beyond stored procedures to include functions, triggers, views, constraints, and referential integrity.
- It rates the suitability of each database object to a particular task.
Source Code Control
I came across this post from Joel Spolsky last week (though I’m just now getting around to blogging about it). We’re using Team Foundation Server for source code control at work, and we’ve managed to have the problems of check-ins breaking the build and too few check-ins to have a good delta of changes at the same time. While the applications we build at APS Healthcare aren’t the size of an operating system as far as lines of code, the branching-and-merging idea Spolsky describes would probably be useful to us.
Common causes of the System.NullReference exception
I came across this blog post today while researching a problem with one of our applications. The most interesting thing I found about this article was the comparison between VB.NET and C#. It’s one of a few I’ve seen that goes beyond the syntactic differences to deeper issues. The examples in this article show cases where C# wouldn’t even compile code that runs in VB.NET (and throws exceptions at runtime). C# makes you work harder to write code that compiles and throws exceptions at runtime. It’s yet another argument in favor of C# I hadn’t considered before reading this post.
Working with IT agencies
I have to deal with IT agencies a lot more now as a software development manager than I ever did in previous roles. So coming across a blog post titled “IT Agencies and the Devil” was pretty funny. If starting an IT agency is as simple as the author suggests, it certain explains why there seem to be so many of them.
So far, I can single out one such agency for providing people that are consistently high-quality–Software Consortium. The guys they’ve sent to work on the projects I’m responsible for have all turned out excellent code and been very good about knowledge-sharing.
Training IT managers
I came across this post in a rare break between meetings. Since I’m an IT manager now, I found it good reading (and a good ego check as well).
The right penalty for breaking a software build
Maybe I should institute this at my office on Monday.
String.Format is your friend
One of the consultants that works for me was trying to figure out the best way to format strings for writing messages to the event log for a Windows service he’s writing. He was using the horrifying “blah blah blah” +
A quick Google search revealed an excellent String.Format 101 blog post by Kathy Kam. Karl Seguin’s post on the same topic brings performance advantages into the discussion. Another bit of information I didn’t know before reading his post was that the StringBuilder class has an equivalent AppendFormat method.
SQL Injection
It’s one thing to know that SQL injection is bad, and quite another to have some stats to back it up. I came across a Michael Sutton blog post on the topic via Joel Spolsky’s latest blog post.
Out of 708 sites checked, 80 had potential vulnerabilities to SQL injection attacks. Beyond the importance of the topic as a security hole, the most interesting thing about Sutton’s article was the tool he built to come up with these stats. He used a C# app with the Google API to get his results. I only wish I had time to build a tool that clever and useful.
NDbUnit
I’ve been a big fan of test-driven development (and unit testing) since I first learned about it a few years ago. It wasn’t until this month that I learned about NDbUnit. This little library is a great value-add for unit tests that involve databases. The creation of test data is tedious if done manually (NDbUnit uses XML for data files), but that’s the only real drawback I’ve found so far in my limited experience with it. It plays very nicely with NUnit, MbUnit, and TestDriven.NET. You can get binaries and source code for NDbUnit from Quality Labs. I also put together a (very) small sample project with Visual Studio 2005 that you can try out.
Home computer backups
Some friends of mine in California have been discussing backup strategies over the past few days. They came across a post by Jeremy Zawodny on using Amazon S3 in addition to his existing backup strategies.
I’m still only using an external hard drive for my backups. I don’t backup my machines regularly enough either. Before Seagate bought them (and before I joined the cult of the Mac), I had a lot of interest in a Mirra Personal Server. At the time it was Windows-only, but now it supports Mac OS X as well. Recently, I started using Deja Vu for backing up the Mac mini. So far, it’s been completely painless.
Continuous Integration
The practice is well-defined in a couple of articles on Wikipedia and on Martin Fowler’s website. But as long as I’ve been reading about this best practice, I’ve never seen it implemented at any of my past jobs (or my current one for that matter). Fortunately, one of the consultants I’m currently working with not only has it implemented, but has the necessary software and test projects on a USB key that he carries with him from job-to-job.
Before I demonstrate it to the broader software team as a practice, I’m trying to get it working on my own machine. Because he uses MbUnit instead of NUnit as part of his implementation, it took me a little longer to get the second of his six test projects working. A little googling for Nant and MbUnit yielded an article that listed 5 files to be copied to the bin directory of Nant. Once I did that, the second test project worked fine.
Strangely, I only saw 4 of the 5 files in this list:
- MbUnit.Core.dll
- MbUnit.Framework.dll
- MbUnit.Tasks.dll
- Quickgraph.dll
- QuickGraph.Algorithms.dll
Stop users from double-clicking Submit buttons
I came across this tip via 4GuysFromRolla.com. It’s some JavaScript to disable a form’s Submit button once it’s pressed.
This extended post talks about changing the text value of the Submit button to “Submitted” (or something equivalent) to further communicate that the button has been pressed (and prevent it from being clicked again).
While not a terribly sophisticated tip, it does a great job of preventing certain user errors.
Leaving Lockheed Martin
I’ve left to join APS Healthcare as a manager of software development. My last day at Lockheed Martin was September 20.
In nearly two years at Lockheed Martin (and Aspen Systems prior to its buyout) as a combination project manager, systems analyst, and lead developer, I learned many different lessons about myself–some painful, some not.
The necessity of diplomacy
When I first arrived at Aspen Systems, I was blunt in discussing areas I felt needed improvement (code quality, process, etc). Because I wasn’t always diplomatic in the way I talked about what I saw, some people responsible for the work took offense. It was irrelevant that I was describing standard industry best practices. Co-workers who were offended became far more difficult to work with. Being more diplomatic would have made life easier.
The importance of corporate culture
My experience at Aspen Systems led me to conclude that corporate culture is as important as profitability. It affects the quality of work, the caliber of employees, how co-workers treat each other, how management treats staff, and employee retention. I had a lot of disagreements with how things worked in all of these areas (which is probably why I only lasted two years in a company that had an average tenure of seven years). Two other people who joined Aspen after I did ended up leaving before I did. Corporate culture played a role in their departures too.
Project management is really personality management
I didn’t manage difficult personalities very well on my projects. To succeed at project management, it’s vital to have that ability. Being able to put together realistic work breakdown structures, project plans, and budgets is important–and I did all those things well–but being more able to persuade others to do certain tasks would have made my job much easier. When the people assigned to your project(s) don’t actually report to you, persuasion is the only tool you have. Being more diplomatic would have helped me. Beyond that however, the role of project manager needed far more support from the organization than it received.
While the skills are useful, project management is not something I’ll take on as a full-time role in the future. I’m better at other things.
Aston-Martin & Jaguar Changing Hands
There’s been quite bit of buzz in the press about the possibility of Aston-Martin (and possible Jaguar and Land Rover) being sold lately. It interests me not because an Aston-Martin has usually been what James Bond drives in the movies, but because of a negotiation assignment in business school. My final assignment was to lead a team of my classmates (we represented Ford) in negotiating the purchase Jaguar (another team of classmates). As it turned out, our negotiations failed (Ford and Jaguar stayed separate).
The negotiations failed because we I didn’t account for the interests of a few of the Jaguar execs who would be “redundant” in the new organizational structure (they wanted their golden parachutes). But a few of us, myself included, thought the numbers in the case study alone were a sufficient argument against Ford buying Jaguar. It’s been a couple of years since that class, but the recent sales talk feels a bit like vindication.
Why Unit Test
I came across a great post on unit testing today that provided not just why to unit test, but what to unit test. Differentiating software into “infrastructure” and “end user application” really highlights what sort of code will benefit the most from the approach. Another really useful bit of this article talks about turning bug reports into unit tests. It’s a very smart idea that I’ll try to use on my own code whenever it’s appropriate.
MyGeneration and Gentle.NET
After last week’s post about the stored procs vs. ad-hoc SQL debate, I decided I’d take a look at MyGeneration and Gentle.NET if I could think of the right project. I decided to start with a simple contact form.
Anytime a form has dropdowns, I try to use database tables to populate them. So I started by copying data for the dropdowns from an existing database to a new one for the project. Once I created a business logic assembly for the new classes to belong to, I fired up MyGeneration and ran the Gentle.NET business entity template. Creating the classes was very easy. the real challenge turned out to be referring to the right Gentle assemblies in my projects. Because I’d included references to Gentle.Common, Gentle.Framework, Gentle.Provider.SQLServer and log4net in the business logic assembly, I thought that was all I needed to do. But the web project wouldn’t compile. In order to get the page working, I had to add Gentle.Common and Gentle.Framework references to web project.
Once I sorted out my reference issues (and added a Gentle.config file), finishing the contact form went very quickly. I developed this bit of code for loading any dropdown list:
private void LoadDropDown(ref DropDownList ddl, IList dropDownItems, string textField, string valueField) { ddl.DataSource = dropDownItems; ddl.DataTextField = textField; ddl.DataValueField = valueField; ddl.DataBind(); }
Here’s how it’s called:
if (!Page.IsPostBack) { this.LoadDropDown(ref ContactTypeList,BLL.ContactType.ListAll(),“Name”,“ContactTypeId”); this.LoadDropDown(ref SubjectList,BLL.InformationType.ListAll(),“Name”,“InformationTypeId”); this.LoadDropDown(ref OrgTypeList,BLL.Audience.ListAll(),“Name”,“AudienceId”); }
Inspired by Ruby on Rails
Instead of vegging out on TV after work today, I decided to veg out on the web. Between reading and IM I managed to kill about 2 1/2 hours before I even noticed. The payoff for this exercise was discovering a little project called the .NET Action Pack. Rob Conery has taken the concepts of Ruby on Rails and reimplemented them using C# and .NET 2.0. The screencast he used to demonstrate the action pack was quite impressive. With a build provider, a configuration file, and a single assembly, you get a whole host of classes that let you query and manipulate a database however you wish that are available at design time. I’m definitely going to try this out at work tomorrow.
Visual Studio 2003 Service Pack 1
Somehow I completely missed this announcement about the Visual Studio 2003 service pack being released. Our group at Lockheed Martin won’t be upgrading to Visual Studio 2005 until 2007 at the earliest, so it looks like I’ll be installing this service pack very soon. Apparently, Microsoft found quite a few bugs that needed fixing.
Stored Procedures vs. Ad-hoc SQL Redux
I’ve written on the never-ending stored procs vs. ad-hoc SQL debate before, but there are quite a few more perspectives on both sides of it than I referred to in my previous post. Here are a few of them:
- Frans Bouma (ad-hoc SQL camp) compiles a summary post with links to various arguments here.
- Jeremy D. Miller (ad-hoc SQL camp) rejects stored procedures because they make test-driven development (TDD) slower. This is an argument I hadn't thought of. The apps I build tend to be database-driven websites. Testing logic that makes database calls at any point does slow things down quite a bit. Miller especially dislikes the idea of putting business logic into a stored procedure (defined as anything other than a CRUD operation).
- Jeff Atwood (ad-hoc SQL camp) argues against stored procedures because he prefers parameterized SQL and a single development environment.
- Microsoft's official guidance is to use stored procedures instead of direct SQL.
- Rob Howard writes in favor of stored procedures. Community Server 2.1 makes significant use of them.