Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m
Rubylinux
  • Overview
  • Transcript

1.2 Why Develop Ruby in Linux?

In this lesson, I’ll explain some of the differences between Linux and Windows as a development system. You’ll learn some of the technical reasons why Ruby development is easier on Linux or OS X. You’ll also learn how you can get started with a Linux development environment in a VirtualBox virtual machine instance without having to change your current operating system!

Related Links

1.Why Use Linux for Ruby Development?
2 lessons, 10:39

Free Lesson
1.1
Introduction
00:41

1.2
Why Develop Ruby in Linux?
09:58


1.2 Why Develop Ruby in Linux?

[MUSIC] So what about developing Ruby apps in Windows instead of using either OS X or Linux? What are the main differences, really? Well I'm gonna talk about this a little bit in order to persuade you maybe to start developing your Ruby applications on Linux rather than Windows. Before we jump to hasty conclusions, let me just start off by saying that there are installations of Ruby already working on Windows. There's always been that possibility. Ruby Installer comes with a set of tools that allow you to run Ruby itself and also there's the Rails Installer that has a bunch of tools to enable Rails development. So, Ruby itself, just contains the Ruby installation. Rails Installer contains a set of different tweaks to the Ruby Installer and enhances the Rails development experience. It is maintained by a large community including Engine Yard. So the project is successfully backed up. This is just a disclaimer, I'm not telling you that you shouldn't develop on Windows but rather there are some advantages on using Linux or OS X in order to develop Ruby apps. With that out of the way, let's jump to my personal reasons why I think that *NIX is better for developing Ruby apps. I think that the most important reason why you should do it is because the production environment in which you'll deploy your Ruby app is already running a *NIX based system. Linux is most likely the case, so going for a Linux distribution for yourself is probably the best bet. If you bridge the gap between production and development environments as close as possible, there's a solid chance that you will have less errors in production. I mean if you're trying to replicate as close as possible a production environment? Then it's less likely that odd situations will occur because you didn't know what you're going to expect. That's the main reason why I think that you should indeed use Linux. Next and also very importantly is the fact that most of the content that's being published out there in order to learn and develop Ruby apps is centered around *NIX systems. A large percentage of the community uses Mac OS X that's for sure. But there's also a lot of people that use Linux including myself and this is because of the reason that I named first. Because a production environment is already in Linux, the gap is usually a lot tighter than people who use Windows all the time to develop Rails applications. it's just a lot easier to publish content in an environment that's less prone to errors. You wouldn't like to read some piece of content, that would turn out to not work at all in your server, right? So there's a good reason for you there. Another reason I wanna share, and be warned that this is just something that I've read online. I'm not used to developing on Windows, but most people that do say that developing Rails apps on Windows is actually slower. Because the set of tools is usually built around *NIX systems, porting the application back into Windows results in a lack of performance. As developers we want to improve our performance day by day, not the other way around. So if you're really obsessed with improving yourself and improving performance and your productivity, then this is a solid reason. Remember, this is just statistics that I've read online and opinions from other people. I'm not used to building Rails apps on Windows. Another reason, and this is a more technical one. You know for a fact that Ruby uses C in order to build some gems. For example, Nokogiri is a gem that allows you to manipulate and construct markup, either HTML or XML. This gem Nokogiri has some extensions that are built with the C language, not really Ruby. And extensions like these that are built in another language might not work on Windows. The extensions are built already, they need to be compiled. And compilation errors might occur just because Windows has a different architecture and different settings for compiling that C code. In *NIX systems that doesn't happen or at least because the original intention was to publish those gems in order to work with *NIX systems. The fact that you're using Windows to compile those extensions might result in errors. And this is very problematic. You're trying to build a feature in your application, let's suppose. And then, you realize that you have an error on a gem because you failed to build the extensions. This must be really frustrating for you, because you wanted to accomplish that, and you're unable to do that just because of that limitation. You don't even control the fact that the gem requires those extensions. Either you work around them or build a solution of your own which might turn out to be either slower or poorly developed, I don't know. Just the fact that two architectures are conflicting is enough of a reason, at least for me, to switch to a *NIX system. This is especially true on Ruby because of these extensions. I recall from a couple of years back, when I used to do PHP development. Back then, it was really easy to setup a LAMP stack on Windows. You just downloaded for example, either, WAMPserver or something like that. It was a bundled Apache server with a standard MySQL database. It was really easy to setup. Just install that program and you'll be up and running. Just create some PHP files, and everything will run smoothly. The Apache was the enclosure behind our work. And because that was taken care of already, it will be really easy to get along and publish that code to the server. It wouldn't be as much of an issue. Nowadays, with progress in technology and the way that we develop apps, and especially being in Ruby, I think that it is a lot simpler to just stick to a Linux distribution or OS X to accomplish our work. With this being said, I wanna give you a suggestion on how to introduce Linux into your development setup. There are a lot of ways to bring Linux into your environment. Three come to mind really quick. Either Docker, Vagrant or VirtualBox. Windows, in specific, resorts to VirtualBox in all three environments. You can choose to download Docker in Windows, but basically what we'll have is a VirtualBox installed or at least it is a requirement. And after that, you'll be able to boost your own Linux environment inside Docker, but still you will need to resort to VirtualBox to do that. Vagrant is also another possibility but it also includes VirtualBox again. The best option that I would give you is to go straight to VirtualBox. I mean if you're going to take leap into a Linux way of doing things, then by all means choose VirtualBox. Now, you might be asking yourself, what should I do in order to learn about Linux and how to develop Ruby applications on Linux? Well, lucky for you, there's already some content in our Tuts+ network. Let me just go ahead to the Tuts+ website. Let me search for Ruby and Linux. There's a course in here. Let's just go to the Courses section. You have the Ruby and Linux course right here. Let me just open that. It has information on how to transition from a Windows experience to a Linux one with Ruby in context. We have everything from installing Linux to learning a little bit about the Linux way of doing things, installing applications, and also how to setup a development environment. We are also gonna take the chance to build an application under Ruby. So that's pretty good. There is also a different course and that's called the Linux developer setup. Let's go to those courses. You have the Linux Web Developer Setup here. This is also a course that you should take. If you're really into either Ruby or JavaScript or PHP, this will take you straight deep into Linux. There's a bunch of different aspects of using a Linux system that are covered in this course as well. Such as desktop environments, the way that the Linux kernel works, editors and terminals, and also some setups on how to use Ruby, or JavaScript, or PHP. Be sure to give these a look, as I know that you will find these useful if you're really serious in taking the leap from Windows to Linux. Regardless of whatever environment you're trying to develop in, I'm pretty sure that you'll feel much more comfortable once you take these steps. Remember that if you have any questions regarding this course or regarding the transition from Windows to Linux be sure to go to our forum. If you go to forums.envato.com, you will get access to a large community of many different students from Tuts+. Post your questions in here and we'll be able to help you out. My name is Yousuf Matta and I hope to see you very soon.

Back to the top