So you've decided to switch careers and jump into tech. Congrats! Now, you're probably wondering which programming language you should learn first! Join Course Report and Bloc as we tackle all of your questions about two of the most popular languages taught at coding bootcamps: Ruby vs Python.
With Bloc mentor Ben Neely, we learn which language is best for beginners, which will help you land your first developer job, and what makes Ruby and Python unique. In this video, we cover:
- Ruby vs Python
- What is Ruby?
- What is Python?
- Which language should you learn?
- Get $100 off your next Bloc apprenticeship by applying through Course Report
I'm a mentor at Bloc, an online bootcamp which matches each student with a mentor and offers courses in full stack development, UX/UI Design, and other digital skills. I’ve been a developer, primarily a web developer, doing Python, Ruby, Rails, and Django. Those have been the four areas that I have a lot of experience in from my pre-Bloc career. I joined Bloc about two and a half years ago as a mentor. I’ve mentored a lot of students at Bloc, around 30 or 35. In November 2014, I came on board full time as a curriculum developer. We make all our curriculum in-house, and that’s my full-time job now. It’s fantastic.
Follow along with the presentation deck below (transcript coming soon!)
Remember: Course Report has an exclusive $100 scholarship with Bloc, live right now!
Ruby vs Python: Which Programming Language Should you Learn First? - 8:40
Two of the most popular programming languages, especially first languages, are Ruby and Python. Ruby is used widely for websites such as Airbnb, Hulu, Kickstarter, and Github. Python is used for websites such as Google, YouTube, Spotify, and Quora.
Both languages came around in the mid-90s. Python actually predates Ruby by about four years. They both came around to address needs in the programming community, but the philosophies are different. They’re both object-oriented languages. They’re both dynamic. They both have a lot of different functionality. They’re very flexible languages.
You will often see in Ruby that there are multiple methods to solve the same problem and then in Python there’s only one approach. It’s a very philosophical difference. The thing that unites them is the goal to write clean, readable, concise code.
Here is a brief side-by-side comparison of Ruby vs Python:
- There's more than one way to do the same thing
- Ruby is a dynamic, reflective, object-oriented, general-purpose programming language.
- Companies that use Ruby: Hulu, Twitter, ZenDesk, Basecamp, Shopify, Urban Dictionary, GitHub
- There's a most understandable way to do something and that is how it should be done.
- Python is a high-level general purpose language that can be used to write a short script, build an API, or even build a complex object oriented web spider.
- Companies that use Python are Google, Yahoo Maps, Dropbox, Venmo, YouTube.
Some languages have specific uses. They’re specifically tailored for a certain use case. A good example is a language called R, which is mainly used for statistical analysis and heavily in the academic world and anywhere you’ll be doing heavy math and statistics. Another example is SQL, which is a database language. It primarily exists to interact with the database. You wouldn’t write a web application with it. Both Ruby and Python are general purpose, which means they’re really flexible and you can do just about anything with them. You can talk to a database or build a web application or build a script for your computer to run, or you can run almost all of Google’s internal tools.
Language: ex. Python and Ruby. A programming language is a set of rules for giving a computer instructions. Different languages are designed around different philosophies. There are hundreds if not thousands of programming languages.
Interpreter: a program that reads and executes code. Takes your code and allows the computer to run it. Both Ruby and Python are “interpreted” languages, so they don’t have to be translated to run.
Framework: Broader set of tools and techniques built with a language. Think of a dialect of a language. Different rules for communication, but grounded in the same language
Object-Oriented: a programming paradigm based on the concepts of objects. Dominant philosophy in language design. Everything in the language is made up of objects that communicate with each other. Both Python and Ruby are Object-Oriented.
Functional Programming: a programming paradigm that avoids state changing and mutable data.
Imperative Programming: a programming paradigm that uses statements to change a program’s state. Python and Ruby blend the two kinds of programming.
When you’re first approaching coding, there’s so much jargon and so many buzzwords. Language vs. Framework is one of the early ones that gets really confusing.
What is Ruby? - 11:30
- Created in 1995 by Yukihiro "Matz" Matsumoto
- 100% object-oriented (everything is an object)
A lot of languages are object-oriented, but they still have the primitive data type. They’ll have mostly everything as an object, but still with exceptions for integers or maybe characters or something. In Ruby, absolutely everything is an object, meaning everything operates in the same paradigm of sending and receiving messages.
Core Philosophy of Ruby:
- Focus on humans, on how humans care about doing programming
- Follows the principle of least astonishment
- Matz talks about how languages should be designed for people to use because people are the masters, and computers are the slaves, not the other way around. It’s a significant point because he specifically went to design a language that was very friendly for humans to use as opposed to being friendly for a machine to understand.
- The principle of least astonishment is a fancy way of saying when you learn how to do something new in Ruby, you should be the least surprised as possible. The way you do it should be very unsurprising. Stuff sounds like English or plain language instead of a technical or coding feel to it. It makes it a very enjoyable language for beginners and experts.
I’m a beginner, why should I start with Ruby?
High level, enjoyable, general purpose language (spans many industries). High level means it’s extracted away from the hardware of the computer. You can speak in terms that are more human and less computer. It has a lot of applications.
- Very popular with startups (jobs)
Ben, Did you learn Ruby first?
I did. In my undergrad as a CS major, I was primarily learning Java. My first job out I was responsible for doing Rails development so I learned Ruby and I learned Rails. The next place I worked we were a Rails and Django shop, so I picked up Python there.
The most famous program to write in any language is “Hello World!” It’s just getting your program to print out or on the console a string that says “Hello World!” This is Ruby’s “Hello World!” program. It’s one line and it just says “puts ‘Hello World!’” That’s pretty fantastic. The Java version is 5 or 6 lines. The C version is longer than that. This is an example of how Ruby is very very human friendly.
It’s almost impossible to talk about Ruby without talking about Rails. In some ways Rails has become Ruby. If you meet a Ruby developer, they’re probably also working with Rails. Part of this is just because of the sheer popularity of the Rails framework. It’s a very popular framework that’s gotten a lot of use and Ruby has come to exist primarily as a service to the Rails framework.
- Rails is a Ruby framework
- Strongly opinionated, favoring convention over configuration
- Convention over configuration means unlike Ruby which believes there are many ways to do things, Rails thinks very strongly as far as web development is concerned that there is a best Rails way to do things. If you build your application using that convention that Rails favors, it will do a lot of the heavy lifting for you. If you try to buck that convention and go your own route, it’s going to be a lot more difficult. The Rails conventions allow you to really build web applications very quickly and quickly prototype things out and get things up and running. As you can imagine, in the startup world where startups are constantly pivoting to new ideas and having to implement features very quickly, this was instantly popular. It allows startups to quickly iterate and change their products.
- Fast prototyping and popular with startups wanting to iterate quickly
So this is one of my favorite things about Rails and Ruby that really got me in when I first started. The community is fantastic. There is some incredibly high-quality official documentation and some secondary learning materials that have been created and are supported continuously that make Rails an incredibly friendly and open community. Ruby is open-source, which means lots of people are collaborating and helping with projects. Philosophically, they all really believe that’s important.
- Ruby and Rails are both well-known for being friendly for beginners
- Rails Guides
- Ruby Docs
The last two are conferences. They’re fantastic. If you get the chance to go, you should definitely go. It’s a community that from the beginning has been very welcoming to developers of all skillsets.
The Rails community is relatively young, about eight years old in total, so a year or two of experience puts you up with many developers.
What’s the job market like for Ruby developers?
This is comparing it to Python, PHP, and Java. Rails has the crazy top percentage growth. Part of that is that it’s growing from such a small base. This sort of data is borne out pretty well if you go to Indeed or you look up language statistics on GitHub or StackOverflow. There’s a strong and growing demand for Ruby and Rails developers. It’s popular with startups. For a long time Rails was a niche startup language, but now it’s gained a lot of popularity even within larger corporations. I know Apple does a lot of internal support sites with Rails and Amazon is the same way.
Would anyone list a job for a Ruby developer or are they all for Ruby on Rails developers or Rails developers?
You’ll see it listed as all three. You’ll see a lot more under the Rails developer category. You will see some as Ruby and Ruby on Rails developers too.
- The bible for getting started with Rails is Mike Hartl’s Rails Tutorial. It’s on its 3rd edition. You can buy a copy or you can read it for free online. It’s fantastic. It will basically get you started on your first Rails app and get you going on that initial application.
- Learn Ruby the Hard Way by Zed Shaw
- Codecademy’s Ruby program is good, like all their material.
- Finally, Bloc, I helped write the Bloc Rails course, so I strongly believe that we belong up there with these resources. It’s a fantastic curriculum. More importantly, through Bloc you have a mentor who works with you.
Do you expect that someone with little or no experience could start with the Bloc Rails course?
There are no prerequisites in the Bloc Rails course. We have a set of pre-work. Some of it is on this list. There’s no prerequisite. The beautiful thing about a mentor-led course is that it can be really set for any experience level. If you come in brand new, the mentor can calibrate the course for that. If you’re coming in with two or three years of experience writing in another language and you’re trying to transfer that, then your mentor will recalibrate for that background.
So, if you go to bloc.io/alumni, you can see a whole bunch of projects that Bloc students have built, a lot of which are built with a Rails framework. These are just a couple of examples here. There’s Jottly, which is a note taking application. There’s Coder Match, which is a really cool application that a student did that matches up coders that want to work together. If you’re a freelancer you can use it to find a buddy. There’s a couple of other ones, Travel Poker and Fueler.io. These are just examples of what students have built at Bloc. It shows you both what students were able to do and what you can do with Rails in a quick amount of time.
What was the coolest project you saw when you were teaching?
The coolest one I saw was a chat application that was for live chat, which is actually incredibly hard to do. A student built out this live chat application where you could go on and chat with other people and they could join.
Regardless of the language that a student chooses to learn, as a mentor at Bloc, who have you seen be the most successful mentees that you’ve had. Did they all share something that helped them crush the course?
The biggest thing is to come in with the right motivation. Come in with a passion to learn, to pick up a skill, to make a career change. Coding is hard, especially when you’re first starting, it’s a frustrating experience. You need an overarching goal or passion to keep you going. I know for some students that I had, they were dead set on a career change and that was what was driving them. Some had their own project they were going to do or a startup idea they wanted to launch. One student was driven by the fact that they wanted to be able to teach their kid coding and be involved in their education and their coding. Whatever it is you just need to have something to drive you forward and give you that passion.
What are gems? How do they apply to Ruby and Rails? Does Python have an equivalent?
Gems are just the Ruby word for a library. A library is just a self-contained chunk of code. For example, there’s a popular Ruby gem called divise. This gem allows you to do user authentication like logging into or out of an app, creating new accounts. It takes all that code that you need and adds it to your application. Ruby chose gems because it fit with the Ruby gem theme. Python has an equivalent and they’re called eggs. Both Python and Ruby have very nice third party libraries.
We have a question from Liam. We hear a lot about the ‘magic’ of Rails and Ruby. What can we do to make sure we’re really understanding the language as we’re learning it. Do you have a stance on that?
This is the thing that Rails gets the biggest bad rap about, is it’s too magical. Really, what’s being expressed there is that Rails’ opinionated nature and emphasis on convention allows you to really get a lot for free. You’re able to write a few lines of code and you get a lot under the hood. You get a lot that’s just given to you that you don’t have to manually set and do. This is good because it’s less work for the developer and you’re able to build more impressive things quicker. It can be bad if you don’t understand what’s happening and you just do it. I think the most important thing there is to work with a set of material that challenges you. It doesn’t say “enter XYZ and then go.” This is one of the areas where working with a mentor is really beneficial because a mentor can stop you and say, “Whoa, okay. We just did that. Tell me what that means.” You’ll be able to go to your mentor and say what you entered in the terminal and they can take a step back and tell you what’s happening and what Rails is doing. It’s an interesting complaint because it’s almost like saying it’s too powerful or it’s too good.
What is Python? -30:56
Python is open source. It’s been handed over to the community and everyone has an equal say on the direction the language should go and how it should be developed. In appreciation for everything that he’s done, Guido was elected dictator for life of Python.
- Created in 1991 by Guido van Rossum
- Less object-oriented, but still can be object oriented.
- In Ruby everything is an object, in Python there’s still primitive data types and everything isn’t necessarily an object
- Python tends to be object-oriented in practice
- Explicit is better than implicit
- Simple is better than complex
- Complex is better than complicated
This is the hierarchy of questions for designing the language. You can see this in certain aspects of Python. The most famous is that Python uses whitespace to do control flow in the program. Whitespace is actually meaningful, which isn’t really true for most other languages. If you indent things different ways, it has a different meaning in the program. This is an example of their explicit philosophy, so when you look at a Python program, the shape of the way it looks on a page actually tells you what is happening and tells you the logic of the program. This is it’s controversy. If Rails is that it’s magical, Python’s is whitespace as part of its structure. When I first got started with Python I thought it was weird, but then I really liked it.
I’m a beginner, why should I start with Python?
- high level, powerful, general purpose language (spans many industries)
- ubiquity of use by web startups (jobs)
- it’s similar to Ruby so making that “leap” is easier
- It has a 4-year headstart on Ruby. It’s less heavily used in the startup world, but it’s got a big toe hold in enterprise stuff. It’s very popular with C developers. There’s a very vibrant crossover community between the two of them.
How about in Big Data and data science? Why is Python suited for that?
The main reason is that there’s a set of really powerful statistical libraries that actually come from R that were ported to Python very early on. They made it to be a much friendlier and more enjoyable language to use than R. R is a little bit older and more crusty, but equally powerful.
Are those statistics libraries the reason people say it’s faster?
When you’re looking at speed, that’s a different category more like language optimization, which is run at different speeds. Python is faster than Ruby, but they’re both in a category of interpreted languages. Your fastest language is always going to be one that’s compiled down to byte code or object code right on the computer. Both Ruby and Python exist a level above that, they’re abstracted. It makes the development cycle a lot faster, but they are slower languages. You won’t find them in use in stuff that has to be screaming fast. You don’t see Python or Ruby written on routers and modems. Python and Ruby are basically equivalent speed-wise.
If you have experience in Ruby and you want to pick up Python, you will find it to be a very welcoming and enjoyable experience. Superficialities aside, there are many similarities there. Same thing going the other direction.
You started as a Rails developer, but then got a job where you were using Python and Django. Did you teach yourself, or how did you make that switch?
I taught myself on the job. Python was super quick to pick up. Django took more time because there are more differences between the two frameworks than there are between the two languages.
It looks really similar. This is the Python program. It just prints “Hello World!” Again, you can see why both of these languages have a well-deserved reputation for readability and clean syntax and for just being pleasant for developers to use.
Django is the framework that’s kind of the equivalent of Rails for Python. There’s actually a number of other Python frameworks for web development, but Django is by far the most popular.
- Django is a framework like Rails
- Similar to Rails, expedites modeling process and acts as an ORM
- It’s goal is to help facilitate the programmer to build something!
- “Django's primary goal is to ease the creation of complex, database-driven websites.”
The big way that Django differs from Rails is that Django does less directly for you. You have to get under the hood more with Django and tinker with everything and manually create different routes. It’s more advanced, so it’s a bit more difficult. It’s a harder framework for beginners to approach because there’s a larger amount of material that you have to cover before you feel comfortable. The other thing that’s tricky about it is that the beginner resources are not as well-developed. Python has a larger user base than Ruby does, so you have people with Python who aren’t using Django, whereas Ruby’s user base is smaller, but everyone who uses Ruby is going to be experienced with Rails.
What are other frameworks you could use with Python?
There’s Flask. There are several other ones. It’s not that the community is massively fragmented or new frameworks are arising. It’s more that you might just be using Python on its own or in another context.
Famous Python Websites Projects - 40:04
- Civilization IV
- Eve Online
- Google (Uses extensively into various apps)
We don’t teach Python at Bloc, so we don’t have student projects, but these are some pretty prominent Python projects that people might know about. You can see there are several games on there. There are websites that are pretty well-known like Youtube, Quora, Dropbox, Instagram, Spotify, and Reddit. Of course, the largest user of Python is Google by far. They’ve taken a lot of steps to support the community and the development of Python. Some of the best materials for learning Python are produced and supplied by Google that their engineers use when they start.
Python and Django both have a large community of support including proper documentation, forums, and conferences.
This is an example of the popular programming languages in 2014 and Python is present in a bunch of different industries like social media, distributive programming, web application, finance, sciences. Academia is a big part. If you’re a grad student who’s doing statistics or economics modeling, you’ll probably have exposure to Python. It’s definitely a language like Ruby that’s caught on. What’s nice for both of these languages is that they were intentionally designed to do something elegant and beautiful and nice for the programmer. They’ve been rewarded with people that are very excited about them.
- Google’s Python Class
- Beginner’s Guide to Python
- Effective Django
- Django Girls Tutorial
Google’s Python Class is definitely number one. It’s a series of Youtube lectures with supporting material. I think it’s about seven or eight hours of lectures and eight or ten complete lessons. These are all great resources if you want to dive into the Python or Django world.
Do you suggest that people go to meetups or things like RailsGirls or Girl Develop IT where you can launch a full Ruby app?
Definitely. That stuff is always worth getting involved with. For both communities, there are meetups all over the world. I live in Boise, Idaho and there’s a Python meetup that meets once a month and a Ruby meetup that meets once a month. If they’re meeting here in Boise, they’re probably meeting wherever people are located. It’s great. It can be a really intimidating thing when you’re first getting started because it feels scary and like you don’t know enough. I think most of these places you’d be surprised. You’d go there and the people would be welcoming. They’re excited for people to be getting into it. They’ll have resources and advice. It’s similar to what a mentor does for you. You’re joining a special club that’s always welcoming new members.
Which language is more fun to learn or to teach?
I think that Ruby is a more enjoyable language, at least from a mentor perspective. Mostly that’s just because for people going from beginner to picking up a language it’s by far one of the friendliest. It’s just so easy to see how it goes from English to code. Oftentimes making that translation from the way people think, to the way computers think, is a hard, difficult process. You have to train yourself to think in a different way. With Ruby, it’s just a very natural approach. Python is very natural as well, but Ruby is just one step even closer.
Are there things that Python can do that Ruby can’t do?
There’s not really things that one or the other can’t do. They’re both so general purpose that they can pretty much tackle any problem. There are things that both communities have chosen to focus more on. The Django community has put a lot of focus on asynchronous development, where you have multiple requests happening at the same time. That’s not something the Rails community has focused that much on. Overall, they’re both so general that you can pretty much do anything with either of them.
Next steps for a total beginner, what should somebody do?
Codecademy has both a Ruby and a Python course, which would be a good thing to check out. There’s Try Ruby that’s out there that just lets you play around with Ruby and the equivalent Try Python as well. You can also definitely check out Bloc’s courses to see what’s available there. We have info sessions for that. You’re welcome to register for one and hear me talk again, but more specifically about Rails.
4 Obstacles New Coders Will Overcome
Flatiron School co-founder Avi Flombaum shares 4 obstacles you will overcome while learning to code
Node.js: An Intro for Beginners
What is Node.js? Should you learn Node.js? Read this in-depth overview for beginners.
4 Benefits to Learning React
Should you learn ReactJS? See tips from a Sabio Grad!