In recognition of our veterans' selfless sacrifices, it's our duty to equip them with the…
From the instructor’s perspective – Week 4
Review of week 4 in the rails bootcamp class:
Students were introduced to the Ruby language and its syntax — the second programming language they’ve learned so far in the course. On Tuesday and Thursday the students practiced building programs with objects and got see OOP in practice, grappling with important topics like the meaning and use of super, object inheritance, and instance variables. Along with a full day of testing best practices and spec matchers, it was an action-packed week for the new class.
Learning Ruby is a great way to get comfortable with an Object-Oriented language, which is why we make sure to focus on it for a whole week of the program. Making sure that everyone is comfortable working with classes, objects, and methods in the easy to understand and read Ruby syntax is one of the ways we ensure our students walk out of the bootcamp with solid programming fundamentals.
“` ruby
class Fruit
def is_edible
puts “I can eat this”
end
end
class Apple < Fruit
def initialize (type)
@type = type
end
def print_apple_type
puts “I am a #{type} type of apple”
end
end“`
In this example, Apple inherits the is edible method from Fruit “for free”, or, through inheritance. When we create an instance of apple, we will be required to pass the type of the new apple (think Gala, Braeburn, Fuji etc…) and we will be able to print that to the screen.
Not only does experience in ruby set the students up to understand the Rails framework easily, but the easy syntax of the ruby language allows them to quickly uncover some fairly advanced programming concepts.