I have recently been getting more and more worried about people using FTP on projects that go anywhere near me.
It isn't that I have anything particularly against the protocol, over the years it has served me well and it still continues to do so when I have the need to use it, but FTP (especially the type tied into most IDEs) can lead you down some pretty scary alleyways on the way to FFFFFUUUUUUU-ville. Here are a couple of things that can happen, I am sure you can think of more;
- You can overwrite a file you didn't mean to overwrite.
- You can upload information you don't really need to upload (an entire directory, for instance)
- You can delete a file locally that will never be deleted on the server.
Overwriting a file you didn't mean to can cause a lot of headaches - I am sure I am not the only one who has uploaded an incorrect config file in their time and then crapped themselves when the database suddenly won't connect. With something like version control the headache is mitigated by always being able to roll back, FTP however, not so much.
Uploading something you don't want to upload could be if you have a directory of thumbnails but you also have the originals images in them (bad practice, but I am sure it happens!). You upload the entire directory and you inadvertently upload extra information. To a lesser extent this can happen with things like the .svn folders that SVN leaves at its arse.
My final point is that deleting a file locally (in your IDE) does not then attempt to delete the linked file, or at least it doesn't in most of the IDEs I have used, this means that over the course of a project your webserver could become bloated with unnecessary files that could cause potential security risks and if nothing else will increase the size of any backup you take - potentially confusing people who need to access the files live on the server for whatever reason.
It is this last point that really has me worried, files being left on a server that people are maybe assuming are gone.
The old way of developing websites normally involved working on your files in some text editor, maybe testing them locally and then opening up your FTP client to transfer the files onto a dev or test server, then once you were happy you would transfer them from your local machine again onto a live environment.
This way of doing things just sucks, far too much human interaction, far too much scope for error and it is just boring.
The next step was for development environments to include FTP modules to allow you to automatically push code from your local machine to your development or live environment, this takes some of the human interaction out of the equation, but I think this is broken and dangerous.
IDEs have made us feel like there is less scope for error and have taken the monotony out of pushing data using FTP but I think with this relaxed process of uploading comes a relaxed process to how you handle your files and as I have already mentioned FTP is not brilliant at letting you recover from making sloppy mistakes.
Without firing up an FTP client and seeing on the one hand your local files and on the other your server's files you are less likely to notice when you are upload a load of images that maybe shouldn't be uploaded, or that certain server directories are full of files long since deleted on your local machine.
As I said at the start of this article, I do think FTP has served us well, and I think that FTP inside IDEs is a good idea for a couple of use cases, but it has made things too easy without giving us the safety net of something like a good version control system.
Of course the current best practice tends to be to use some form of version control coupled with some type of deployment solution and this is what I think people and companies should be doing (but that is an entirely different blog post for another night!)
If you are using FTP for the vast majority of your web project needs, I would urge you to research and consider other methods, I think it will lead to safer development and a happier you!