Friday, October 12, 2007

EDSK ... not to use mapped drives

Every developer should know not to use mapped drives.

I'll start by admitting that this is something that really annoys me. I'll also admit that it may be appropriate to use mapped drives if, and only if, you are creating a mapped drive to connect to a directory that only you will ever need to connect to. An example being your personal area on a server.

If you're not sure what I mean by "mapped drives" or want to confirm that what I mean and what you understand are the same, take a look at these two Wikipedia articles:
Drive mapping
Drive letter assignment

I'd sum it up like this:
Rather than have to specify a long file path, such as:
\\aServer\folder\directory\another folder\another directory\my files\file.ext
It is possible to tell Windows that the letter X should be mapped to \\aServer\folder\directory\another folder\another directory. This means that it is now possible use the drive letter X, when specifying the path to the file (X:\my files\file.ext)

Now I've got the boring part you already know out of the way.

DON'T DO IT!

Why not?

Because using mapped drives causes problems down the line.

Need to set up another machine?
Lost your mapped drive settings?
Which drives do you need to map? and where?

Someone else wants to know where a file is? Telling them it's on Drive T doesn't help them unless they know where you have drive T mapped to. And why would you remember? You mapped the drive so you wouldn't have to.

Mapped drives provide no meaning.

//Server1/Departments/Support/Customers/Acc01234/history.crm - has meaning.
H:\history.crm - has little.

They are user specific.
Different users can map the same drive letter to different paths.
This can lead to all sorts of problems. Especially if there are files of the same name in the different mapped paths.

They add unnecessary and artificial constraints.

Using a mapped driver anywhere in the development or build process can cause problems.

Very rarely is the development of a piece of software done by a single person, on the same machine for the lifetime of that piece of software. If more than one person will be working on an application, ever. Requiring a mapped drive will just be one more thing to configure and this flies in the face of what every developer should aim for. Removing all unnecessary complications from the development process.

What do you do once you know this?

Ensure that the software you create software that can support file paths in either (any) format.

There should definitely be no excuse for ever creating software which can only connect to a file if using a mapped drive. You'd just be creating problems for other people.


What do you think?
Is this something every developer should know? Have you say in the comments.

1 comment:

  1. Anonymous12:52 am

    Actually, like every other dictum in computers, this is not something you should NEVER do. With some WAN accelerators, its very possible to have the same mapped drive, e.g., the S: drive always be the same place, even with the underlying path is different from one site to another.

    In such an installation, mapped drives not only work fine, they are necessary to take advantage of the WAN accelerator.

    ReplyDelete

I get a lot of comment spam :( - moderation may take a while.