Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Jeff Makes Software

The software musings of Jeff Putz

  • Testing at the end? You can't be serious

    I noticed a link to this Waterfall Conference that also a keynote called "Put Testing Where It Belongs-- At The End." I'm in awe that anyone would say something that, to me at least, is so fundamentally stupid. And yeah, I know this is a joke, but people out there actually think this way.

    Let me start that I don't get into religious arguments, whether it be about New vs. Old Testament, Linux vs. Windows or Agile vs. Everything Else. Those discussions just aren't interesting to me. However, the bigger an application gets, and the more people involved, the more I feel that test-driven development is absolutely essential to building something that works. I honestly could care less about most of the tenants of XP or agile, but TDD has saved my life.

    And I do get why people are skeptical. The gig I just started has a lot of people skeptical about unit testing in general, mostly because it's considered an afterthought. It really is a cultural shift. People think it's more work, but no one can ever ask the fundamental question, "How do you know the change you made didn't break something you haven't thought about?"

    When I first started a gig at Big Ass Auto Insurance® as a consultant, they were buying into everything agile. The paired programming thing annoyed me, and I hated it, but the test-driven stuff fascinated me. Here you could fire off the tests from the entire solution, testing tens of thousands of lines of code, and if something you did broke something, you knew about it. In fact, if you didn't run the tests, the continuous build process would tell you that something was broken. Without this testing facility in place, you had to rely on poor metrics like a lack of compile errors, peer reviews that assume someone in the room knows the rest of the system, etc.

    This doesn't even get into the trouble that is test bias. You can't write unbiased test code if you've already written the code. You're too close to it. While unit testing assumes you're doing thorough tests and driving the design of your classes from those tests, it still gives you confidence your stuff works.

    Now regarding the waterfall methodology, most of the instances where I've been around it, it fails, or delivers low quality software. Again, I'm not religious about any one methodology, but anyone who has written one line of code knows that stuff comes up, and specifications frequently have to change. I don't know why people try to fight that. Keep the stakeholders involved at all times and the change management is tolerable. That's one of the things I like about a more iterative process, is that you can refactor to a place that you get what you want and need, not what you thought three months ago you wanted and needed.

  • Directions on forums and writing

    After I finished my first book, I started to think about what I'd write if I did another one. I wouldn't write anything if it wasn't something I was interested in, so it had to be relevant to my interests. I discussed a book with a couple of publishers that was based around the end-to-end creation of a significant ASP.NET application, namely POP Forums. At the time, v8 wasn't much more than a idea (and still is hardly where it needs to be), so it seemed like a good idea at the time.

  • Regarding Community Server and the ASP.NET developer community

    I made a pretty strong comment in response to Paul Wilson's post about a problem in CS. Alex Lowe sent me e-mail regarding that comment, and this is partly what I shared with him.

    First off... don't think that I'm dissing the product outright. That isn't the case at all. My point, if I didn't make it well, is that the product as a whole is too big and too complex for a small shop or individual to really work it in to the specific needs they might have. But again, that in itself isn't a bad thing, because a lot of companies need exactly what CS provides, a robust community that just works out of the box. That's what I mean by CS being a "corporate" product. Capitalism is good.

    I think the ASP.NET space in general suffers from overlooking the small user space, both small in terms of number and in experience. That shouldn't be that surprising because it does so much more than any of the "popular" platforms like PHP or whatever, but it does make hiring people hard and getting buy-in from the less experienced people. I'm crossing my fingers that the express products will help to change that, but MS is doing a crappy job getting the word out about them.

    Forums and now blogs have become a fairly standard part of every community site on the planet. I'm not shy to say that I spend more time in these apps than anything else other than news sites (which aren't that different from blogs either). Most developers, and by most I mean the legions that run the bulk of the Internet, not the few that code for the biggest sites, can't build their own stuff because of time, money and desire. If you're a PHP monkey you're totally set because phpBB is free, and vBulletin is still worth every penny. You've got options.

    In the ASP.NET space, we don't have a lot of options. Keep in mind that CS isn't free for commercial use, and unless I missed something, putting ads in and around your forum is certainly commercial use. So you're left with a number of relatively inexpensive options, many of which aren't very mature, and a few freebies that lack the features a lot of people want (and I'll throw my own POP Forums in that last group, after nearly two years between releases).

    Assuming that you do like one of those options, customizing it probably isn't that easy. I blame that a little on the platform, because there's a lot of matrices to follow around to understand how something works in the OO world, a much different place than the script world. I also blame the design of the apps to a lesser degree. I know I design for my needs first, and I suspect a lot of other individuals and companies that give something away do the same.

    What's the solution for that? Not sure. I had a discussion about complexity just today at my current gig. Stuff gets complicated and you have no idea how it got that way. I think it's sweet that companies like 37signals are challenging this problem, and largely succeeding. We need more of that.

  • What's wrong with HttpContext in an HttpHandler?

    I experimented some more with the problem I posted recently regarding setting Session values from an HttpHandler. Instead of using Session, I tried using the Cache object instead. The same thing happened... worked fine in Visual Studio, but not in IIS on the server. Here's the class... the value of Session["spamimage"] doesn't update after the first try (called from an <img src="AntiSpamimage.ashx"> tag), even though the image clearly is regenerated. Again, this works fine in the context of the built-in VS server.

    using System;
    using System.Drawing;
    using System.Drawing.Imaging;
    using System.Text;
    using System.Web;
    using System.Web.SessionState;

    public class AntiSpamImage : IHttpHandler, IRequiresSessionState
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "image/gif";
            Bitmap b = new Bitmap(200, 60);
            Graphics g = Graphics.FromImage(b);
            g.FillRectangle(new SolidBrush(Color.White), 0, 0, 200, 60);
            Font font = new Font(FontFamily.GenericSerif, 48, FontStyle.Bold,
            GraphicsUnit.Pixel);
            Random r = new Random();
            string letters = "ABCDEFGHIJKLMNPQRSTUVWXYZ";
            string letter;
            StringBuilder s = new StringBuilder();
            for (int x = 0; x < 5; x++)
            {
                letter = letters.Substring(r.Next(0, letters.Length - 1), 1);
                s.Append(letter);
                g.DrawString(letter, font, new SolidBrush(Color.Black), x * 38, r.Next(0, 15));
            }
            context.Session["antispamimage"] = s.ToString();
            Pen linePen = new Pen(new SolidBrush(Color.Black), 2);
            for (int x = 0; x < 6; x++)
                g.DrawLine(linePen, new Point(r.Next(0, 199), r.Next(0, 59)), new Point(r.Next(0, 199), r.Next(0, 59)));
            b.Save(context.Response.OutputStream, ImageFormat.Gif);
        }
     
        public bool IsReusable
        {
            get { return true; }
        }

    }


  • Job hunting adventure

    I mentioned previously that I was looking to get back into the job market after a break lasting a few months. I had no idea that it was going to go so well, but particularly with the start of the new year, there's a lot out there. I have one formal offer, one informal and possibly another tomorrow. It's so crazy.

    There are a couple of reasons the jobs are coming to me. The first is that there is a serious shortage of qualified .NET developers in the Cleveland and Akron market. I don't know why that is, but part of the going theory is that Progressive (the auto insurer) is hoarding most of them. Seeing as how I used to be one of them, and with nothing to even do at the time, I think that's certainly possible. They pay a ton too, and kind of set what the market will accept in terms of compensation.

    The other thing is that when I got laid-off in 2001, I made the decision to seriously buy into Microsoft's vision of using the .NET Framework as the next big thing. It was only beta at that point, but it seemed interesting and I had lots of time on my hands. As it turns out, that was a good decision. By getting into it so early, I acquired something you can't fake... time. No one can say they have more experience in terms of time because it didn't exist any earlier than the time I got involved. It also gave me more time to make the leap to the OO platform, which for former script monkeys isn't easy, me included.

    The architect I talked to today was like, "Isn't it great to be in demand?" Yes, it is nice, but I honestly find myself feeling a little guilty about the whole thing. While a lot of my situation can be attributed to my own actions, some of it is luck too. A lot of people can't afford to take months off of work, and struggle to find a job. I'm very, very thankful that I've had this opportunity, and I don't take it for granted at all.

    I hope I make the right decision.

  • When Session objects don't update

    This is weird. I did that little HttpHandler that generates images in the simple NewsBlog app. It saves a sequence of characters to Session so the (hopefully not blind) user has to type in the stuff on the graphic and confirm they're a human.

    On my dev machine, works like a champ running it from VS. I deploy it to the server, and it saves the first set of letters to Session, but subsequent calls do not. Here's the code from the handler...

        public void ProcessRequest(HttpContext context)
        {
        ...
            context.Session.Remove("antispamimage");
            context.Session.Add("antispamimage", s.ToString());
            context.Response.End();
        }


    Why do you suppose it doesn't work right on the server?

  • Vista CTP was server?

    A friend gave me his key for the Vista CTP for December, and it worked. Here's the weird thing... when I came back and it was installed, it was Longhorn Server. Weird.

  • An update on my life

    I used to blog here so much when I was writing my book, and I've kind of slacked off ever since. I'm lame.

    The primary reason I haven't blogged as much here this year is because I had a really, really bad year in terms of my personal life. With that came a waning interest in coding and a lot of questioning about what the hell I'm doing with life in general.

    If you read this blog back in 2004, you'd know that one of the things I continually struggled with is what I wanted to do in terms of work. Working for The Man resulted in a lot of dissatisfaction. I spent a good portion of 2005 working a pretty good contract job, which I eventually left in the fall so I could concentrate on coaching volleyball. Fortunately my Web sites produce enough revenue to get by, but all this time later I'm still trying to figure it out. In the interest of just challenging my brain, I'm once again looking at some contract gigs. I don't mind working for someone else when it's interesting work, so I'm crossing my fingers that something I can really get into is at the other end of these recruiter calls.

    As for my own projects, I'm surprised at how many people downloaded my simple ghetto blog app. I've only really used it seriously, with some mods, for the CoasterBuzz Podcast site, but I'm pleased with the way it works. Not complicated at all, and shows how easy you can whip something up with ASP.NET and Visual Studio.

    Probably my biggest neglect has been toward POP Forums v8. I'm ashamed at how little I've worked on it in the last year. The shame is more inwardly directed because it's something I can use. I know others would love to use it, but it has always been secondary to my own use (you get what you pay for ;)). There are two issues that I struggle with in finishing it. The first is that there are so many features I want to add to it, and it just gets daunting. The second issue is that I'm not happy with the way the user data is tied into it. I just can't break it out enough without sacrificing performance.

    My ad serving software, while not having great UI, is surprisingly still kicking ass for me. If I could get the reporting to perform better, I think I'd release a beta of that. I've tried some tricks aggregating data, but the hold up is that SQL doing math is slow. I've never really taken the time to find a better way.

    So the truth is that I still have a lot I'd like to be doing, I just haven't had the motivation to stick to it. I'm hoping 2006 will be different.