5 ms·
Hitting the ground running: A Python programmer builds a Rails 3.1 app in a day
- sirn 15y ago> At my last job at a Python shop, we spent a lot of time discussing the merits of Python, its syntax, and how to correctly use it. This part is what I don't understand. Why would you want to spent a lot of time discussing Python syntax? In my experience Python documentations are the best ones I could found for a programming language (apart from those with broken APIs) and most of time how to correctly use something is written right in the documentation.
- derwiki 15y agoYou're right, I don't think I chose my words carefully. Maybe I meant programming idioms? At any rate, what I meant was things like map(len, mylist) vs [len(x) for x in mylist] or the readability of a relatively complex list comprehension vs a loop.
- oinksoft 15y agoSound like awfully low-level things to discuss, except in the occasional code review where something is glaring. Also, map() and filter() aren't quite deprecated but most would agree that the list comprehension is more Pythonic.
- rhizome 15y agoA lack of house style is a huge sandbag once you have more than a few developers.
- Pewpewarrows 15y agoGood read, but I found it a bit odd that you compared Rails to a micro-framework like Bottle. Have you ever tried something like Django?
- derwiki 15y agoDjango was the first Python programming I ever did over 3 years ago, and that probably would be a more fair comparison. If I had played with Django more recently, what would I have said that I didn't?
- Pewpewarrows 15y agoSpecifically this line: > I still prefer Python as a general purpose language, but Ruby on Rails is a better solution for web development. I can understand saying that coming from a PHP background, or if all you've ever played with in Python was a micro-framework like Bottle. But I don't see anything that you mentioned that isn't part of a Python web stack using something like Django. Hence my question.
- zzzmarcus 15y agoDid you just coin the word programotional? Awesome.
- asolove 15y agoWelcome to the kool-aid club! Seriously, it's fun to see people still creating their first Rails app and enjoying it so much. I don't do Rails all day, but when I want to get something up in a quick and easy fashion, there's no doubt that it's the way to go. What did you find that was confusing/unclear/not working? Rails 3.1 is now a pretty big beast, and when you add the rvm/github/heroku surrounding environment, there's a lot to learn. The Rails community is very interested in keeping its first-time-experience excellent, so give feedback on IRC, blog posts, or github issues for anything that wasn't immediately fun and clear.
- derwiki 15y agobundler was the biggest mystery. Many times after I thought everything was set up correctly, I'd try to launch a console only to be told I was missing Gems. This isn't a big deal until I'm on an airplane and can't re-download the Gems -- but why everything disappeared to begin with is still a mystery to me.
- damncabbage 15y agoBundler basically lets you set up and hop between different "sets" of gems. Say I want to set up a bunch of gems for my new ruby app. I have a Gemfile, and so I use Bundler to install those gems for this app only. For example: ~$ cd myapp ~/myapp$ bundle install # Installs a ton of gems. Now we can use those gems: ~/myapp$ bundle exec rails console # Or... ~/myapp$ bundle exec rails server # Or... ~/myapp$ bundle exec rake db:migrate This can get cumbersome, so I usually put this in my .bashrc: alias be="bundle exec" # Example usage: be rails console # Example usage: be rails server I hope this clears things up a little. (I see RVM being used to manage sets of gems, but Bundler does this out of the box.)
- derwiki 15y agoThanks for the writeup. I've been using bundler for about 6 months (and even have the same 'be' alias!) and understand it, I'm just confused when it seems to magically forget about my installed bundle.
- Maascamp 15y agoI don't get this post at all. It's poorly written and is comparing Python (the language) to Rails (the web framework), concluding that it's easier to create a website it Rails?
- alttab 15y agoGood post Adam. Welcome to the darkside. I've done a lot of crazy things with Rails since leaving IBM - including hot patching modules into a rails server running on Windows using encrypted and signed YAML for module distribution. Ruby lets you do some crazy things... good or bad.
- derwiki 15y agoIt gives you a sharp enough knife to whittle the Statue of Liberty or cut your hand off. I've found this flexibility much more useful for debugging purposes (redefining methods on the fly) than writing easy-to-follow production code.
- alttab 15y agoRead this: http://www.amazon.com/Rails-AntiPatterns-Refactoring-Addison-Wesley-Professional/dp/0321604814 http://www.amazon.com/Rails-AntiPatterns-Refactoring-Addison... Easiest mistake in large rails apps is to let your controllers get too thick...