The intersection of technology and leadership

Category: Development (Page 18 of 18)

Speeding up Visual Studio 2005

After working intimately with IntelliJ and Eclipse on previous projects, Visual Studio seems like such a beast for doing very simple things. Resharper makes it bearable though has a cost of its own. Our team has been playing around with trying to speed up the responsiveness. Here’s a few things we’ve tried that have worked at least most of the time:

  • Close the Toolbox tab – Even with just the tab closed, VS2005 still seems to use resources to keep it up to date. By removing it from your workspace, the project pane and other windows appear much more responsive.
  • Turn Off Animated Windows – When VS2005 gets sluggish, expanding and hiding tabs can appear horrendously slow as the screen repaints. Turning this option off helped a little bit. Uncheck the box found under Tools … Options … Environment … General … Animate Environment
  • Turn off the VS2005 File Navigator – With resharper installed, you don’t need VS2005 to update the list of methods and fields at the top of the file (CTRL-F12 does this nicely). I’ve hardly even noticed the small panel that sits at the top of the file you’re editing but apparently it takes quite a lot of effort for VS2005 to keep it up to date. Disable the Navigation Bar checkbox under Tools … Options … Text Editor … All Languages … Display.
  • Disable Startup Page – Wondered why VS2005 seemed sluggish on start up? It’s probably because it’s trying to download something from the Internet by default. Turn off the main startup page and the “live” content by unchecking the box found under Tools … Options … General … Startup … “Download content every”. I’d also change the “At Startup” option to “Show Empty Environment”.
  • Install Cool Commands – When you use Track Active Item in the Explorer pane, collapsing projects to run tests of various kinds can be hard. Cool Commands has some helpful things like Collapse All Projects so you don’t have to do it yourself when running tests.

I’d enjoy hearing anything else that anyone else may have tried to continue making VS2005 productive for you.

Domain Specific Language (DSL)s in Action

I get a certain amount of satisfaction when I find the right way of modelling something in code. I’ve been working with a Zebra printer lately, and is one of those really annoying devices you must send “special” instructions to. I ended up building up some generic commands for representing the language, and then built a small Domain Specific Language (DSL) for using it in our application.

Here’s an example of our code (modified for public consumption of course):

    public class StandardLabel
    {
        private string instructions;

        public string ToZebraInstruction()
        {
            return instructions;
        }
        
        public StandardLabel(string barcode, string name, string passion)
        {

            instructions = new LabelBuilder()
                .IconAt(485, 10)
                .BarCode(barcode).At(10, 10)
                .Label(“Name:”).At(10, 150).WithValue(name).At(150, 150)
                .Label(“Position:”).At(10, 250).WithValue(position).At(150, 250)
                .Label(“Passion:”).At(10, 350).WithValue(passion).At(150, 350)
                .ToZebraInstruction();
        }

    }    

The code above is useful for representing the layout for a label similar to the following (also modified for public consumption):

Example Label

I think the best bit about this block of code, is that it didn’t take any longer to abstract, and I’ve been able to get our Business Analyst to actually change the layout with only a minimal amount of hand holding. In fact they ended up modifying the label’s entire layout to suit the customer without needing to involve a developer. I like to think it’s a great outcome.

Listening to yourself for feedback

Having new people join the team always brings great insight, even if they are kind enough to come onto the project not firing criticisms immediately. When introducing them to a new codebase, I find it’s important to listen for yourself as you’re showing them for key phrases such as ideally we would have, I’m not particularly proud of, I have no idea why this is here, or this is a work-around.

Circumstances change and constraints in the past may no longer apply. All of this means you can continue to refactor the codebase to be clearer and easier to maintain. It may not mean you can fix things straight away but at least you know which parts you can improve on.

Agile At Work

The thing that I enjoy the most about working on projects run with agile principles and practices is that it is really effective. I’m constantly impressed by how quickly things change and adapt in such a short time frame, though I know that this can be a little disorienting to people not used to it. I just got back from a week of skiing in Andorra (the snow was very nice for us despite their worst season ever) and in that time, five developers have completely changed the way an entire application looks as well as adding a whole heap of functionality that wasn’t there when I left seven days ago. Great stuff!

Getting NUnit ASP to work with .Net 2.0

On my current project we’ve been having a pretty good experience leveraging the NUnitASP library for automated testing of our website. In our second week of development, we noticed like many other people, that it is yet fully compatible with .Net 2.0 because of the way that ASP.Net now generates its javascript postback functions.

In the previous .Net version, ASP.Net seemed to generate a very simple function of the form of __doPostBack([targetId], [targetArguments]) that would effectively set two hidden variables (__EVENTTARGET and __EVENTARGUMENT respectively). In the current version, ASP.Net generates a much more complex javascript function (called WebForm_DoPostBackWithOptions) that I think is caused with use of any of the ASP validator components.

One work around that one person (Lance Ahlberg) found was to turn the “CausesValidation” property off for controls but this may or may not suit the way that you are developing your website. Looking at what the javascript generated does, I think that there must have been a better solution so I spent some time delving into the depths of NUnit ASP to find one.

The result is a patch to ControlTester.cs that allows the __EVENTTARGET and __EVENTARGUMENT to still be set by extracting out the appropriate values from the new WebForm_DoPostBackWithOptions javascript function. You can download the patch here but you have to build your own NUnit ASP, or wait until this is integrated with the next release. The ticket for my submission can be found here.

.Net 2.0 and IIS

I know this is old, but I’m putting up here as a note to myself… the installation order of IIS and .Net 2.0 matters. If you try running .Net 2.0 code on IIS that thinks it’s running a prior version of .Net (see the bottom part of the IIS error page to see what it is running), run the aspnet_regiis.exe /i command that sits deep in the bowels of the %windir%\Microsoft.NET\Framework\v2.0.50727 folder to make it run fine again.

Starting from Principles

Starting new projects always carries great responsibility but also offers a great opportunity to improve it by applying learnings from previous projects. Fortunately I’m currently in this position as one of the early developers on a greenfields project that’s been running for the last two weeks.

What I’m attempting to do this time is that instead of defining and/or enforcing a set of coding standards and patterns used throughout the project, I’m hoping to capture the thinking that goes along side the decisions as we make them, distilling them into a set of core principles we’re striving for. By capturing these core principles I hope it makes it easier for new people to come on board, provide a better context for analysing the code artefacts we create and still leaves an open discussion for newcomers to suggest better ways of achieving these same principles.

Newer posts »

© 2024 patkua@work

Theme by Anders NorenUp ↑