Exercises, examples and other material relating to training module R102. This module is presented on Private Courses
and Specially Run Courses
Ruby is a true OO language - perhaps the first
true OO scripting language where EVERYTHING is an
object. We'll introduce you to Ruby, the OO concept,
and how the two melt together to give you a fast and
efficient way of developing flexible code in applications
from system admin through web database frameworks, and
also to easily upgrade and maintain them as your
|Articles and tips on this subject||updated|
|4581||Thin application, thick objects - keep you main code simple. Example in Ruby|
A suggestion. Write thick objects and thin applications. That's what I did in Ruby towards the end of this week's Ruby Course.
Here's the complete application ...
stations = Station.factory("rstats2014.xyz")
for k in (0...20) do
|4580||Easy example - data record to object and object to data record mapping in Ruby|
From the Ruby course just finished - an example of an application that reads through a data file, passes comments through unaltered, converts valid data lines into objects which it updates and writes back in place. The whole busisness of mapping data records to objects and objects back to data records ...
|4369||Ruby - the second rung of learning the language|
When you're learning a programming language - or to program - your text / tutor will almost inevitably start with "Hello World" - a program to display a string of text. That's chosen as the first example as it shows you how to enter and store you program, it shows you any steps necessary to convert ...
|4009||Clear, concise examples - Ruby classes and objects.|
Finding clear, concise examples of how to perform a simple programming task can be surprisingly difficult. "I just want a [Rails] model that doesn't actually use a database table" was an example yesterday. Such shouldn't be difficult, but authors tend to write a simple example and then decide "While ...
|2603||Ruby objects - a primer|
If you're new to Ruby, but familiar with Object Oriented Programming, you might like to take a quick look at the example that I wrote during yesterday's course which shows how all the major OO elements are implemented in Ruby. The sample source is [here].
Here are some of the key facts:
• Classes ...
|2287||Learning to program in Ruby - examples of the programming basics|
We so often overlook the basics of programming, and yet they are so fundamental to good code - understanding things like how widely variables can be seen (also known as variable scope), what happens when you divide two numbers (do you get a decimal result or is the remainder thrown away), and how do ...
Examples from our training material
|beast.rb|| Sample class in its own file|
|d2.10|| Define class, create and use instances of it|
|d2.11|| Use of 'self' in Ruby|
|d2.12|| Calling program to access class in another file|
|hit.rb|| A class showing each variable scope in use|
|nother|| Operators as methods - polymorphism in *|
|obrub1.rb|| Define and use a class|
|obrub4.rb|| Application to call in group of classes from a library file|
|shapes.rb|| Object Orientation in Ruby - Training Example|
|stations.rb|| thick class, thin application example|
|trainclass4.rb|| Definition of a train - to be shared between all railway applications|
|yesyes|| data record to object and object to data record mapping|
Some modules are available for download
as a sample of our material or under an Open Training Notes License
for free download from http://www.training-notes.co.uk
Topics covered in this module
A first piece of working Ruby.
What is object orientation and why is it important?
Introduction to the terminology of objects.
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule
Well House Consultants specialise in training courses in
. We run
throughout the UK (and beyond for longer courses), and
at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if you live in a different
country or continent to us
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.