August 2008 - Posts

How Do You Configure the Visual Studio IDE?
29 August 08 10:00 AM | Scott Mitchell

I don't know about you, but when it comes to programming I am very particular about whitespace. When updating old code originally written by someone else, the first thing I do is “clean up” the code, injecting whitespace, tabs, and whatnot in the positions that make my anally retentive side happy. I also like my windows in Visual Studio arranged in a certain fashion, although I am not as particular about the VS IDE layout as I am about code whitespace.

Here's the VS window layout I prefer:

  • I like Solution Explorer, Properties window, and Server Explorer pinned on the right occupying the same real estate, so that there's three tabs at the bottom right corner of the screen.
  • Toolbox pinned on the left (although sometimes I unpin this when working on code).
  • Task List, Output, Find Results, and Pending Checkins all unpinned and along the bottom of the IDE.

I really don't like it when two or more windows share real estate on the left, right, or bottom. For example, Visual Studio's default layout is, which has the Solution Explorer on the upper right and Properties window on the bottom right, is annoying to me and is the first thing I fix when using a new install. I also prefer my Toolbox to be arranged alphabetically, not by category.

Are you as particular about your VS layout? How do you arrange your IDE?

Interestingly, I am not a very particular person in other areas of life. In fact, last summer my wife and I went on a 71-day rambling road trip across the country without any set schedule or destinations. Granted, I do like somewhat of a fixed work schedule and get frustrated if there is a break in my planned routine for the day, but I can still function. In short, when it comes to work I like my ducks all lined up in a row, from the way my code is formatted to my daily schedule.

Filed under: ,
Why is Programming Fun?
27 August 08 08:18 AM | Scott Mitchell

I recently started reading Fred Brooks, Jr.'s The Mythical Man Month, an influential collection of essays on software project management.

In the introductory essay he has a paragraph that starts with the following words: "Why is programming fun? What delights may its practitioner expect as his reward?" He then goes on to list five reasons, in prose that is poetic:

First is the sheer joy of making things. As the child delights in his mud pie, so the adult enjoys building things... I think this delight must be an image of God's delight in making things, a delight shown in the distinctness and newness of each leaf and each snowflake.

Second is the pleasure of making things that are useful to other people. Deep within, we want others to use our work and to find it helpful. In this respect the programming system is not essentially different from the child's first clay pencil holder "for Daddy's office."

Third is the fascination of fashioning complex puzzle-like objects of interlocking moving parts and watching them work in subtle cycles, playing out the consequences of principles built in from the beginning. The programmed computer has all the fascination of the pinball machine or the jukebox mechanism, carried to the ultimate.

Fourth is the joy of always learning, which springs from the nonrepeating nature of the task. ...

Finally, there is the delight of working in such a tractable medium. The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination.

Of course, we all know that in addition to these joys that make programming fun, there are realities that subtract from the overall enjoyment. Brook addresses these later in the essay by enumerating the woes of programming. The first one dates Brooks's essays, which were written in 1975:

First, one must perform perfectly. ... If one character, one pause of the incantation is not strictly in proper form, the magic doesn't work.

While the programming language syntax rules are strict and literal, today's tools make this a non-issue. If I make a typo writing my code, Visual Studio underlines it with a squiggly. And the cacophony of information on the Internet provides a bounty of code snippets, tutorials, FAQs, and guides that virtually anyone these days can become a magician.

The next two woes Brooks lists are still applicable to today's programmers and are spot on.

Next, other people set one's objectives, provide one's resources, and furnish one's information. One rarely controls the circumstances of his work, or even its goal. ...

The next woe is that designing grand concepts is fun; finding nitty little bugs is just work. With any creative activity come dreary hours of tedious, painstaking labor, and programming is no exception.

The final woe Brooks lists is still applicable today, even more so than it was in 1975:

The last woe, and sometimes the last straw, is that the product over which one has labored so long appears to be obsolete upon (or before) completion.

For me, this is not a woe, as it does not subtract any fun from programming for me. Perhaps it's because I grew up with computers and the rapid and unceasing technology churn. It's second nature for me and most people whose birth date coincided with or came after the birth of the personal computer in the late 70s. But I can see an adult in 1975 would feel overwhelmed by the incessant improvements in technology, each new one rendering the older generation obsolete.

Brooks ends the essay on an upbeat note:

This then is programming, both a tar pit in which many efforts have floundered and a creative activity with joys and woes all its own. For many, the joys far outweigh the woes, and for them the remainder of this book will attempt to lay some boardwalks across the tar.

I'll leave you with some background on Fred Brooks:

  • He has the honor of having a "law" named after him - Brooks's Law states that "adding manpower to a late software project makes it later."
  • He founded the Department of Computer Science at the University of North Carolina in 1964, after leaving his job at IBM.
  • He received the highly prestigious Turing Award in 1999 for his contributions to computer architecture, operating systems, and software engineering.
Filed under:
Speculative Development and YAGNI
26 August 08 09:55 AM | Scott Mitchell

It's amazing how much time speculative development can swallow up during the course of a project. Speculative development happens when a developer implements features above and beyond the requirements based on the assumption that he'll need such functionality at a later point in time. I think it's a trap every developer has fallen into at one point or another. We are tasked with something simple - like exposing the latest news through an RSS feed - and turn it into something complex - like building an entire RSS generation framework that can syndicate any data source.

In The Productive Programmer Neal Ford explains why software projects - as opposed to other engineering projects - are so prone to speculative development:

Usually, in the physical world, things tend toward simplicity unless you add energy to disrupt it. Software is the opposite: because it is so easy to create, it tends toward complexity (in other words, it takes the same physical effort to create both complex and simple software). It can take great effort to pull software back toward simplicity.

In other words, it's expensive in time and cost to increase the complexity of a bridge or car or house, which is why you don't see needless complexity added to such systems. But for software, it may only take a few more hours to add some extra functionality that, while not required now, may be useful down the road. Another factor that leads to a high occurrence of speculative work in software projects is the typical mindset of a programmer. We like order and rigidity and building black boxes that can be plugged in elsewhere and used again. We enjoy challenges and solving problems. Spitting out the latest news in a simple RSS feed is easy, boring even. It's much more mentally stimulating to craft an RSS generation framework. (This predilection of self-directed framework building also helps explain why developers working on existing projects oftentimes advocate pitching the existing code base and rewriting the application from scratch rather than build on top of the work that's already been done.)

The main problem with speculative development is that it adds potentially unneeded code to the project, bloating its size, increasing the surface area of the project, and contributing to the code that must be tested. It's also potentially wasted time. Of course, speculative development isn't a problem if the speculative work is actually needed and used at some future point in time. But because there's no way to definitively say that the speculative work will eventually be needed (or that it will be needed but in some alternate form), it's best to build only what is needed in the here and now.

There's an acronym to keep in mind to help temper speculative development - YAGNI, which stands for "You Ain't Gonna Need It." Ron Jeffries, one of the founders of Extreme Programming methodology, summarizes the idea behind YAGNI succinctly:

Often you will be building some class and you’ll hear yourself saying "We’re going to need...". Resist that impulse, every time. Always implement things when you actually need them, never when you just foresee that you need them. ... You’re thinking about what the class might be, rather than what it must be. You were on a mission when you started building that class. Keep on that mission rather than let yourself be distracted for even a moment. Your time is precious. You might not need it after all. If that happens, the time you spend implementing the method will be wasted; the time everyone else spends reading it will be wasted; the space it takes up will be wasted. ... The best way to implement code quickly is to implement less of it. The best way to have fewer bugs is to implement less code.

Wise words from a wise man.

Filed under:
Download CopySourceAsHtml
25 August 08 09:50 AM | Scott Mitchell

CopySourceAsHtml (CSAH) is a free Visual Studio Add-In created by Colin Coller that turns Visual Studio code - with its indentation, color coding, and line numbers - into corresponding HTML with a few points and clicks of the mouse. This Add-In is great for pasting code samples into blogs and online articles. In fact, I've mentioned CopySourceAsHtml in a previous blog entry.

Unfortunately, the web page that hosts the CSAH Add-In - http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/ - has been offline for over a week now. I've emailed Colin about this outage, asking if it was a temporary or permanent matter, but have not heard back from him. If anyone has a direct line to Colin and can get the inside scoop, I'd be interested in knowing whether the CSAH files have moved elsewhere or if the existing site will be coming back online.

In the meantime, I am posting the Visual Studio 2005 and Visual Studio 2008 versions of CopySourceAsHtml here for others to download.

The Visual Studio 2008 version uses the Visual Studio 2005 version with some additional files created by Guy Burstein. For more on the Visual Studio 2008 version see: CopySourceAsHtml for Visual Studio 2008 RTM. The files available for download above were provided to me by Jason Gaylord. Thanks, Jason!

Filed under:
The Cast is Off! I've Got Two Functional Hands Again!
18 August 08 05:25 PM | Scott Mitchell

On July 15th I broke my right hand playing basketball, which resulted in a cast that severely limited the mobility and dexterity of my right hand and fingers. Today the cast came off! I am back to having all ten fingers available for typing, writing, eating, dressing, and piano playing! Granted, things aren't back to 100% yet. My wrist and hand muscles are extremely weak right now, but that will strengthen over time. For now I can painlessly use the mouse and type. I get some muscle twinges when playing the piano or gripping small objects (like a pen or pencil). And the doctor said no basketball for at least another month.

After asking for suggestions on how to function at work on a day-to-day basis with one hand, many people chimed in with advice - thank you! Being reduced to typing and programming with one hand is no fun. At first it is extremely limiting and very frustrating. However, over time and with enough practice I was able to significantly increase my words/minute typing speed using my left hand and a lone finger on my right hand. Immediately after my injury I was typing around 30 wpm, but by the time the cast came off I was north of 50 wpm.

The best suggestion I received was to use voice recognition software. I ended up buying a copy of Dragon Naturally Speaking and used it for writing the majority of my emails and articles. It was not very useful when programming, although I did use it every now and then in SQL Server Management Studio to write ad-hoc SQL statements. As my typing speed improved I found myself using Dragon Naturally Speaking less and less. Now that I have full faculty of my right hand I doubt I will use DNS again (unless, heaven forbid, I have another hand injury at some point in the future). While voice dictation is nice, it cannot compete with my typing speed. Also, the error rate on voice dictation is still too high, in my opinion. In my experiences I'd get an error in dictation once or twice per paragraph. While that's not a lot, it does require going back and making the correction from the keyboard most times, and that is time consuming. What's more, I find that when speaking I have to collect my thoughts and decide what, exactly, I'm going to say before speaking it. With typing, however, I just start moving my fingers and the words come to me as I'm clicking and clacking away.

Thanks again to everyone who offered suggestions or shared their stories.

Filed under:
Problems Installing SQL Server 2008 After Installing Visual Studio 2008 SP1? Make Sure You've Updated or Uninstalled Visual Web Developer!
15 August 08 04:09 PM | Scott Mitchell

Certain features of Microsoft SQL Server 2008 require Visual Studio 2008 SP1. If VS 2008 SP1 is not installed the SQL Server installation will abort with the following error message: "A previous release of Microsoft Visual Studio 2008 is installed on this computer. Upgrade Microsoft Visual Studio 2008 to the SP1 before installing SQL Server 2008."

PROBLEM: You've downloaded and installed Visual Studio 2008 SP1, yet SQL Server 2008 still fails to install with the same error message.

SOLUTION: If you installed a beta version of Visual Studio 2008 SP1 you must first uninstall it and then install the RTM version. You can use the Visual Studio 2008 Service Pack Preparation Tool to effectively remove prerelease versions of the service pack.

If you did not install prerelease versions of the service pack, yet still get this error message, chances are there is a Visual Studio SKU that did not have the service pack applied. For example, if you have both Visual Web Developer 2008 and Visual Studio 2008 Professional on your machine, you need to install both SP1 for the Professional version and SP1 for the Express SKU. In other words, installing the Visual Studio 2008 Professional Server Pack 1 does not apply the Service Pack to Visual Web Developer. Consequently, you cannot install SQL Server 2008 with those features that require VS 2008 SP1 until apply the service pack to the Express SKU. (You can alternatively uninstall Visual Web Developer and then re-download and re-install it, as the current download has SP1 baked into it.)

For more information on installing SQL Server 2008 and the service pack requirements, check out SQL Server 2008, Visual Studio 2008 SP1, and .NET Framework 3.5 SP1 Explained.

For more information on the new features in SP1 pertinent to ASP.NET, see the .NET Framework 3.5 Service Pack 1 Overview.

Filed under:
More Posts

Archives

My Books

  • Teach Yourself ASP.NET 4 in 24 Hours
  • Teach Yourself ASP.NET 3.5 in 24 Hours
  • Teach Yourself ASP.NET 2.0 in 24 Hours
  • ASP.NET Data Web Controls Kick Start
  • ASP.NET: Tips, Tutorials, and Code
  • Designing Active Server Pages
  • Teach Yourself Active Server Pages 3.0 in 21 Days

I am a Microsoft MVP for ASP.NET.

I am an ASPInsider.