Posts Tagged ‘Notepad++’
Getting Started With Ruby
I recently got assigned a project that involved using Ruby, a programming language that I always wanted to learn. This was a great opportunity for me to get right into it and gain some experience. Overall, it was a bit of an obstacle to figure out how to program Ruby in a Windows environment.
I had been reading this book, Ruby: Visual QuickStart Guide. And while the QuickStart books have always been a great and useful read for me, trying to set up the development environment was a bit tricky for me. I’m more used to developing in a Unix environment for C and C++ or writing and uploading pages on my server for PHP and Javascript. At first I was under the impression that Ruby was strictly a web server-side language like PHP, so it was difficult for me to comprehend how to set up Ruby pages on my website. Rails would be the solution to this I would later discover.
A Rails project shouldn’t be the first thing you do to learn Ruby. While it is a great thing in and of itself, it doesn’t really work well for learners new to Ruby. However, through my personal experience and trial and error, I was able to finally set myself up with Ruby in a Windows environment.
First thing is first: Download and install Ruby. You can grab a Windows installer on the Ruby website, but here’s a link to their download page: http://www.ruby-lang.org/en/downloads/. There’s a One-Click Installer executable, which I used. The installer is pretty straightforward.
Next, for me at least, is to have an editor to actually code in. I personally love Notepad++. It is very simple and robust. I use it also for my web programming. I don’t know how I got anything done without it. I had tried to fiddle around with NetBeans, but it was a bit to complicated and overwhelming for a beginner. I might give it a go again after more experience.
So I have the language installed on my Windows computer and have a source code editor. Now what? I wrote a basic .rb file, but how do I compile it? How do I make it work? How do I say, “HELLO, WORLD!”? Well, in Windows, all the action is run through the console, aka the cmd command. To check if your Ruby installation is working, start up your console window by clicking your Start Button, then Run, type in cmd, then clicking OK. That black little console window will pop up and prompt you to enter in your commands. Type in ruby -v to see if the ‘ruby’ command works. If everything’s good, then it will show you what version is installed.
The Windows console is a bit rough to work with, personally having been used to the more robust console in Linux or even the awesome SSH client PuTTY. And it was even more difficult since the Windows console doesn’t recognize Unix commands. I am so used to ‘ls,’ ‘pwd,’ and ‘rm’ to navigate and modify files. I recently found a great looking one called git. It comes with git bash, which basically looks better than the Windows console in addition to recognizing Unix commands, a big plus for me! Using this console, I can run my Ruby programs with ease.
I am not a Ruby expert by any means. I am still completely new to it and learning it from scratch. This post is mainly to document my own experience with learning how to program in Ruby and hopefully help point other newbies in the right direction when getting started. If you have any personal tips or suggestions, please comment and let me know!

