Exploring Ruby on Rails: A Beginner's Journey into Coding
Written on
Chapter 1: Introduction to Ruby on Rails
As I embark on my journey to master a programming skill that could lead to opportunities in software engineering, I find myself drawn to Ruby, despite its lesser popularity compared to languages like C++, C#, or Python for game development. Although Ruby isn't the go-to choice for many game developers, it does offer a framework called "Gosu," which is a 2D game development library designed for both Ruby and C++. This library provides an intuitive interface that's perfect for beginners and hobbyists alike.
My aspiration is to create an indie game, and while Ruby may not dominate the industry, it can still be effective for smaller projects. I've explored various programming languages, but Ruby seems to resonate with me. Additionally, I’ve noticed a surge in remote job listings for Ruby on Rails developers, which excites me as I prefer remote work and the demand appears robust.
To get acquainted with Ruby on Rails, I first watched a brief video from Fireship. Here are some key takeaways, enhanced with my research:
Ruby is a dynamic and interpreted scripting language. This means that variable types and memory allocation occur at runtime, allowing for flexible and expressive coding. The interpreted nature allows developers to execute code line by line, which speeds up development since the entire program doesn't need to be compiled beforehand. It also features high-level constructs that enhance usability and readability.
Originally developed in 1993, Ruby aimed to incorporate scripting capabilities akin to Python while embracing the object-oriented principles of Smalltalk. The introduction of the Rails framework in 2005 propelled Ruby’s popularity. One of Ruby’s defining characteristics is its minimal syntax, which allows developers to write concise and functional code.
In Ruby, everything is treated as an object, which means every object can be modified. This organizational approach to programming is facilitated through the use of classes that serve as blueprints for creating objects. Additionally, RubyGems serves as a package management system, enabling developers to easily download, install, and manage libraries known as "gems." These gems consist of reusable code that can seamlessly integrate into Ruby applications.
Project files typically end with the .rb extension, and Ruby supports "Duck Typing." For example, we can define two classes, Duck and Person, both featuring a quack method. The method make_it_quack accepts any object and invokes its quack method without regard to the specific type of the object, illustrating duck typing in action.
Next, I delved into a more comprehensive 7-minute video from Simplilearn.
In this video, I learned that Ruby is the programming language, while Ruby on Rails is the framework built upon it. Key points include:
- Ruby is case-sensitive.
- Ruby on Rails follows the Model-View-Controller (MVC) architectural pattern, which separates application layers.
The advantages of using Ruby on Rails include its cost-effectiveness, rapid website construction and modification, pre-existing plugins and modules, ease of code modification, and a vast developer community with numerous repositories on GitHub.
Ruby on Rails developers are responsible for tasks such as:
- Developing web applications
- Managing data storage
- Implementing server-side functionality
- Creating backend components
- Maintaining JSON interfaces
- Establishing workflows
- Identifying bottlenecks and proposing solutions
On average, a Ruby on Rails developer in the United States earns around $117,000 annually.