You are here
Coding Development Environment
Maintaining a consistent development environment can save you a lot of headaches. This mean following the same workflow, using the same programs, and ensuring those programs are configured the exact same way. This should be the case whether you are working in an office, at home on your dining room table, or at your favorite coffee shop. So this brings us to the question, do you keep your development environment on your local computer, or on a server in the cloud? In order to answer this, you have to ask yourself more questions.
- How many computers are you working from?
- Where will you be working?
- Are there any onerous tasks to complete in order to switch computers and work on your project?
I’ve asked myself the same in the past, so here we go!
- How many computers? 3. A laptop and 2 desktops.
- What locations? Home, Coffee houses, and my previous Office.
- Are there onerous tasks required to work locally? YES! I would have to clone a copy of my Drupal project each time I moved to a different computer.
Any reasonable person would probably say: “Well Steve, you could always install a portable copy of wamp on a flash drive and keep the project files and database on that!” Unfortunately, that isn’t workable in my particular case. My desktop at home runs Windows 7, my previous office desktop ran Windows 8.1, and my laptop is a MacBook Pro running OS X Yosemite. The software gymnastics needed to make that situation work, isn’t worth the trouble. So, server in the cloud it was! I did some research on budget server hosts, paid a monthly fee, and setup my Ubuntu server with a configuration I could live with. After that was setup, all I needed was a terminal program that didn’t suck, and ssh. Mac OS X was easy, I could use the built in terminal app, or use a program like Term 2 that has a lot more features, and customizability. Windows was not so convenient. The terminal clients available are mostly garbage. The problems that I encountered included terrible terminal color and font support, and the copying/pasting functionality was an apparent afterthought. For Windows, my first immediate choice was Cygwin. It has it’s own quirks, and the Dev’s do their best to try and reduce the painful experience. But it still uses the same Win32 Console as the windows command prompt! I spent 8 months searching fruitlessly to fix the problem before I gave up in frustration. I digress. Once logged into my server via ssh, I use a combination of Vim and Git to do my work. Learning how to use Vim was a jarring experience after using a GUI environment my entire life. It has no visual queues to remind you of keyboard combinations, and the only feedback you get is whether the file saved, or if you are trying to quit without saving. So I kept a cheat sheet on hand for a few weeks until I memorized the commands by wrote-memory. Vim’s functionality can be expanded with plugins, so don’t be too afraid of it. There are plugins for:
- A status bar
- Fixing indents
- Showing an undo history (like in photoshop)
- Git diff
- Commenting out entire lines
- Code autocompletion with suggestions
If you can think of it, it may well exist. Git has been pretty valuable for me as well. As long as you commit your changes regularly, you can use other tools to see a visual difference between versions of the same file. This is useful if you’re trying to figure out where some new bug was introduced. Git can also be used to keep your code in sync with multiple computers, and even merge code additions made by another person since it tracks changes to files by line number, and not by file time-stamp. Another useful tool that has allowed me to leave a file open in Vim and switch computers, is Byobu. It’s a script that uses Tmux. It maintains your user session even after disconnecting from ssh, and can also allow multiple computers to view/control the same session. Keeping my development environment as consistent and “portable” as possible, has saved me a lot of time and frustration. I hope my experiences can help you keep the headaches away. Happy coding!