If only I were

Building Great Software

Archive for the ‘Thoughts’ Category

Please stop using Visual Source Safe

with 2 comments

I’ve had this kind of error dozens of times in the last 8 years. Does this inspire confidence? If any other database that you work with corrupted itself this frequently and this drastically would you keep using that database?

If you answered ‘no’ in both cases (and I hope you did), then consider something better, stable and free like Subversion and TortoiseSVN. Or if you have the money and you need to stick with Microsoft technologies then consider Team Foundation Server. At a very minimum both of these options have atomic commits where Visual Source Safe does not.

This is a fraction of the error message by the way. I cut out 9/10 of the error message for brevity.

Visual SourceSafe Analyze Version 8.0
Copyright (C) Microsoft Corporation. All rights reserved.
Database analysis in progress @  7/16/08;11:18a.
Unable to open file ‘\\nhdev\nhvss\data\G\GGBAAAAA’.
File “\\nhdev\nhvss\data\G\GGBAAAAA” not found
The project User references a child whose physical file (GGBAAAAA) is missing or corrupted.
Unable to open file ‘\\nhdev\nhvss\data\H\HGBAAAAA’.
File “\\nhdev\nhvss\data\H\HGBAAAAA” not found
The project User references a child whose physical file (HGBAAAAA) is missing or corrupted.
The file ‘web.config’ (LEBAAAAA) lists ‘ZDBAAAAA’ as its parent, but that file does not reference it as a child or is missing/corrupted.
The item ‘Registration’ (ZDBAAAAA) is orphaned and needs to be removed.
The item ‘User’ (WEBAAAAA) is orphaned and needs to be removed.
Analysis complete @  7/16/08;11:19a
Potentially serious errors or inconsistencies were found: run ANALYZE -F to fix these problems.
To fix the database problems, you can restart the analyze using the following command:
“C:\Program Files\Microsoft Visual SourceSafe\analyze.exe” -F -V3 -D “\\nhdev\nhvss\data”

Update: If you are not the admin for VSS then you may not have seen these messages, but you see them fairly frequently if you are the admin.

Written by Chris Sutton

September 25, 2008 at 7:52 pm

Posted in Technology, Thoughts

Tagged with ,

Chat with Sarah – the future of automated help

with 12 comments

PayPal has a virtual agent that is supposed to help field questions. Maybe it is helpful in some cases, but for a significant question it is useless. Here is the actual text from our “conversation.”

Sarah – PayPal :
Hello, I’m Sarah, and I’m here to answer questions you have about PayPal. Just type into the box below and click Submit to get started.
I’m in training now, so if I don’t know the answer to your PayPal question, I’ll try to learn it for next time!

You :
I forgot my password and I can’t get it reset, can you help me?
Sarah – PayPal :
If you have forgotten your PayPal login password, or if your password has been locked, you can reset your password by confirming your identity.

1.  Visit the PayPal website at https://www.paypal.com/
2.  Click the Forgot your Password? link.
3.  Enter the email address you used to register.
4.  Enter the code shown in the security text box.
4.  Click Continue.
6.  Confirm your account ownership and click Continue.
7.  Confirm additional account information and click Continue.
8.  Create a new password and click Submit. Anything else I can do to help you?

You :
I’ve already tried that.
Sarah – PayPal :
Ok, what’s your question?

You :
I already asked my question, you need to give a better answer.
Sarah – PayPal :
I was trained to give personalised answers, which sometimes means that I may have to ask a private question or two! If you think of anything else I can help you with, I’ll be here.

You :
Can you help me?
Sarah – PayPal :
As a virtual advisor I’m here to help you with questions about PayPal.

You :
Can I talk to a real person?
Sarah – PayPal :
I may be able to help with your request. However, if I can’t answer your question, you can visit the Help Center, or Contact Us.

You :
Do you know anything about Alan Turing?
Sarah – PayPal :
I don’t understand. If you think of anything else I can help you with, I’ll be here.

You :
That’s what I thought.
Sarah – PayPal :
If there’s anything else you’d like to ask me, I’m here 24-7 to answer any questions you might have.

Written by Chris Sutton

September 16, 2008 at 3:10 pm

TDD Mentoring

with one comment

Yesterday morning I mentored two people for about 3 hours on how to think about and how to do TDD (Test Driven Development). I was a bit nervous beforehand as it was the first time I’ve formally explained and demonstrated TDD.

We started by talking about how TDD gives you a set of test cases that can help you validate the function of your libraries at a low level (now and in the future). Even more, how it encourages you to think through the design of your classes and methods because it forces you the be the first consumer of your code.

We started with what many people would consider a dangerous beginning, but it turned out really well. We began by writing test cases for existing methods and retrofitting the tests.

One method we tested just generated a random string that was then used by a CAPTCHA component. The length of the string was determined by an Integer parameter on the method. Our first step was to write a test that expected an exception if you put in a negative number. We pretty quickly decided that any length <=0 was an error condition, so we did a bit of refactoring to support that change in the method.

Next we verified that if you passed in the numbers 5, 10, 15 etc; that the length of the string actually matched. No problems there.

We were running out of interesting tests pretty quickly when Shirley stated the obvious that Carl and I had overlooked. We needed to validate that the numbers were actually random. So we put in a test that passed in the number 7 four times and sure enough the Random implementation wasn’t being seeded properly.

So in a short time, we were able to significantly improve the design of a preexisting component using TDD. There were three of us coding and discussing it, so it was very interactive and tied to real code they were using. TDD really is primarily a design technique first and a testing technique second.

We found that even though the methods were already implemented, we were able build up a great set of test cases that will keep those methods from being messed up in the future even if their implementation is updated later on. Better yet, we were able to fix the design in some significant cases. Who wants a random string generator with non-random output?

Best of all, when we were done Shirley walked away with a smile and said “this is really cool.”

Written by Chris Sutton

August 12, 2008 at 3:19 pm

Function-centric to Data-centric to Model-centric

with 2 comments

I picked up book called The Waite Group’s Object-Oriented Programming in Turbo C++ recently to look at what Robert Lafore was saying about OOP 17 years ago. The book was published in 1991. I’ve just read chapter one at this point, but it was rather interesting.

Before we look at Lafore’s views, lets talk about where we are now.

A fairly common complaint we hear in 2008 is that people write their programs in a very data-centric way. They write objects for the sole purpose of CRUD but the life of the application in is the database. They might throw in bit of inheritance to make their objects feel more OO, but end of the day they are making glorified data containers that map directly to the database tables.

I was recently in an interview where one person admitted that it was easiest to start with the database and work out from there. So their “business objects” were just in-memory data containers for performing CRUD with a few useful utility methods hanging off the objects.

If you talk with people working with NHiberate, people doing DDD, an Alt.Netter or Rocky Lhotka (I realize there are very diverse view in these groups), you’ll get the view that your domain objects or your business objects should be the core of your application. I buy into this view by the way; the database is a good place to persist your data, but it shouldn’t be where you start in application design.

So what was Robert Lafore’s concern with procedural programming? Remember that in 1991 OO wasn’t mainstream. Here is a direct quote from a section called Data Undervalued in Chapter 1:

What [functions] do may be more complex or abstract, but the emphasis is still on the action.

What happens to data in this paradigm? Data is, after all, the reason for a programs existence. The important part of an inventory program isn’t a function that displays the data, or a function that checks for correct input; it’s the inventory data itself. Yet data is given a second-class status in the organization of procedural languages.

He goes on to explain that functions/methods/procedures don’t let you model the world very well. How do you model a windowing system with dropdown menus with just methods? And he is right, there needs to be more than verbs in our programming languages, we needed first-class nouns (beyond local variables) to be able to model the world better.

17 years ago coding was too action centric but Robert claims it should have been more data-centric. Now that OO is fairly mainstream coding is too data-centric, and the claim is that we need to be more model-centric.

None of these views stand on there own. If you took away functions we wouldn’t have programming; if we didn’t have data we wouldn’t have a reason to program. But I think that building out a good model that is object based and is independent of the database is just as important for application design.

What do you think about this progression? Where are we going from here?

kick it on DotNetKicks.com

Written by Chris Sutton

August 9, 2008 at 11:01 am

Posted in Learning, Technology, Thoughts

Tagged with , , ,

Vocabulary and Context

with 2 comments

I remember learning vocabulary words in middle school and getting tired of making so many practice sentences for the new words. Now I’m working on my vocabulary 15-20 years later and I’m really understanding how valuable those practice sentences were.

Raw memorization of words and definitions don’t stick well in my mind. I process so much information each day that I have to work quite hard to make vocabulary words memorable.

But if I can craft a well-phrased sentence around the word it helps me remember much longer because it gives the word some context. Also, the sentence takes you through the process of using the word well, which helps it stick.

It’s sometimes hard to see how valuable context is because it is so intermingled in what we do, think and say. Context is like the air you breath, you rarely think about it but it is essential.

Here are some words for the you:

profligate – adj – excessively wasteful

execrate – v – to abhor or loathe

perspicacious – adj – acutely perceptive or keenly aware

inveigle – v – to obtain by deception or flattery

You can write sentences for for these words in comments below.

Written by Chris Sutton

August 7, 2008 at 8:10 am

Posted in Language, Learning, Thoughts

Who and What is ASP.NET MVC for?

with 3 comments

Michael Neel wrote today about what a good definition is for ASP.NET MVC.

I have to admit that many of my descriptions of ASP.NET MVC have been tied to deficiencies and frustrations in the current ASP.NET Webforms implementation. It is time to start talking less about what it isn’t and to start talking more about what it is.

Michael also points out that it is not likely people will use ASP.NET MVC just so they can use the MVC pattern, since you could come pretty close to MVC with some extra work in ASP.NET Webforms.

The main point of the post was to figure out a good definition of ASP.NET MVC that doesn’t rely on problems in Webforms. And here is where I don’t think he captured what ASP.NET MVC is about. Michael ends up with this definition

“ASP.NET MVC is the evolution of Classic ASP, adding an easier separation of concerns while not using an event based model like WebForms.”

First off, I used Classic ASP successfully for several years, but I don’t think there is enough in common to invoke Classic ASP in this definition. What we typed in .asp pages looked like what you make with .aspx pages in the default view engine, but beyond that I can’t find much similarity.

Second, he ends up counter balancing ASP.NET MVC against the event model. I’m thrilled that most of the event model has gone away with MVC, but isn’t this part of the definition implying that there is a problem with the event model in ASP.NET Webforms? So I think to define what value a company would get from ASP.NET MVC you need to counter balance it against the current Webforms implementation (to a degree). But it definitely needs stand more on it’s own as it grows up.

Anyway, Michael’s post has has really got me thinking. In an interview this week I was explaining to an architect why one would want to use ASP.NET MVC and I think I was able to articulate pretty well why you would want to use it and who would not benefit so much from it. I don’t have a better succinct definition yet.

So what benefits does ASP.NET MVC have for me?

It encourages me to separate out fundamental concerns. I want my tools to encourage me along a successful path. They can’t make me build good applications, but they can give me a good model. Having a View that is just about transforming data into a page (or some other format) is good. There isn’t much temptation to put business, data or flow logic in the view. The Controller accepts requests in a predictable format, finds out what Model it needs to call and says what view to render if necessary. The Model can easily be decoupled from the first two parts.

Routing is a first class concept now giving me a prescriptive way to specify a request format. It’s not an after thought like url rewriting.

ASP.NET MVC certainly flattens out the complex Webforms event model. Any time I can cut unneeded complexity from an application I will. I can’t imagine Webforms without preinit, init, render, etc.

As I do more and more TDD with web development, I know that ASP.NET MVC is easier to unit test.

Last of all, it takes me closer to the HTML, CSS and JavaScript. Some people want to pretend these languages don’t exist and want to do Winforms on the Web and others just don’t want to have to deal with the quirks of those languages. I make no claim that they are perfect, but they are good enough and by this point in web history there is agreement on their implementations.

Can we quite having to write ASP.NET MVC? It would be good to have a shorter name for writing. And yes, I ended my title in a preposition, get over it.

Written by Chris Sutton

July 26, 2008 at 3:42 pm

Vista 64 and UAC

with 3 comments

I’ve just rebuilt my main development machine with 64 bit Vista on a quad core. So far I haven’t had any glitches with drivers and I have all of my core development tools installed.

I went through this process a year ago and it was definitely more frustrating then. 

UAC isn’t quite as annoying as it was a year ago either. Before it seemed that every important action I would take would prompt another popup. So either I’m being slow boiled to accept UAC or I’m just more patient and receptive to the security feature now.

Anyway, 64 bit Vista has been a good experience this time around and I can use all 4G of RAM with out the 32 bit limitation.

Written by Chris Sutton

July 25, 2008 at 11:46 am

Posted in Technology, Thoughts

Follow

Get every new post delivered to your Inbox.