Git

Dropbox + Git = Develop Anywhere

For a new nodeJS project I’m working on in collaboration with a few other developers, we’re using Git in combination with Github, and I’m finally learning how to use Git the right way, with branches, several remote repositories, and all the other good stuff that makes everyone love Git.

But this weekend I ran into a serious problem: my computer died, and I found that I left my charger at work. We have a major milestone we need to hit on Monday, and I was up a creek.

Thankfully, a friend of mine said I could use her Mac to work on it. I had saved my development work in a Dropbox folder, so I went to Dropbox and shared it with her. Then I downloaded Git, nodeJS, and Sublime Text 2 to get my dev environment ready.

I generated a couple of new SSH keys for Github, and checked

git config --list

Lo and behold, everything was there. My remote repo’s, my commit history, everything. Part of the genius of Git is that everything is stored in files in your working directory.

I can’t stress this enough: put your development directory in your Dropbox. You never know when you’ll need it, and with Git, you’ll be set to go in a matter of minutes even in the worst case scenario. I’m considering adding the installers I use to develop to the directory just to make the process even more painless.

Let me know if you have any other tips about using Git, I’m still learning all the good stuff it can do.

Learning MVC, Ruby, Rails, Heroku, Git, and PostgreSQL at the same time

So I finally took the plunge. I started developing with Ruby on Rails.

Little did I know that learning Ruby on Rails consists of learning a host of other things that I should probably have learned by now, but for various reasons, haven’t.

MVC is complicated. Not complicated like difficult to grasp, complicated like “wait, where do I put this function?”. I read somewhere it should go in your controller. Then I read the skinny controllers, fat models post by JamisBuck. Oops. Time to “refactor” I guess. (is it refactoring if you’re only playing with the default scaffold?)

Ruby is amazing. Thank goodness DHH chose this when developing Basecamp. A language designed to behave as you expect it to? How could it get any better?

ActiveRecord is amazing. If I never see another SQL query in my life, I’ll be happy.

Rails is incredible. DHH is the man. I’ve never used a framework before, so maybe I’m giving him too much credit, but the amount of productivity you can get when you have Rails in place is just mind-blowing.

I’ve never installed a server locally before, and I’ve never done my development on a local machine. I know that sounds REALLY crazy, but I have always done my hacking in PHP on a shared box somewhere that I FTP'ed to. And with the Notepad++ FTP extension, it was super easy. But developing on your local machine is…easier. Except for the setup part – which was made worlds easier by EngineYard’s Rails Installer for Windows. (Yes, I’m developing in Windows. Yes Rails is much slower on Windows.)

I’m using Git wrong. I know that I am. And I’m so used to developing without version control that I don’t really git it yet. (That’s not a funny pun, but I couldn’t help myself). But it is nice to put little messages next to your saves I guess, even if they are just a string of obscenities.

Heroku is cool. But not as cool to me as to long-time Rails developers because it basically does what you’ve been able to do with PHP forever: upload it and have it work the right way. I know that for Rails with all the dependencies, etc, this is a big deal, but from a pure user experience perspective, it’s pretty much the same to me.

Migrating to PostgreSQL is a big pain. I did all my developing in SQLite3 (against the wishes of Heroku) and when I deployed to Heroku I had to fix one query in 3 different places. And of course I had to re “git push” every time. And I haven’t figured out how to make Heroku not re-install all my gems every time I do that.

All in all, even with the huge learning curve of what feels like 10 new systems and a totally different model of development and deployment, I’ve accomplished in a few days what would have taken me probably a week in PHP (which I’m very comfortable in). So yes, it was a good decision. It hurts right now, but I can already feel the productivity gains.

Also, Sublime Text 2 is really nice.