Exercises, examples and other material relating to training module R102. This module is presented on
Private Courses and
Specially Run Courses only
Background
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
requirements grow.
Articles and tips on this subject | updated |
4673 | Separating detailed data code from the main application - Ruby example In almost every appication, you'll be writing a number of pieces of code that use the same data type. It's tempting initially to write all the detail of the individual fields and attributes of the data into a main program - especially if the application's not very long and you're in a hurry:
fh ... | 2016-05-17 |
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")
stations.sort!
for k in (0...20) do
puts ... | 2015-11-21 |
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 ... | 2015-11-21 (short) |
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 ... | 2014-12-30 |
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 ... | 2013-02-17 |
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 ... | 2010-01-29 (longer) |
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 ... | 2009-07-15 |
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 |
f1 | Moving detail into objects - before |
f2 | Moving detail into objects - after |
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 |
Background information
Some modules are
available for download as a sample of our material or under an
Open Training Notes License for free download from
[here].
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.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our
Listing and schedule page.
Well House Consultants specialise in training courses in
Ruby,
Lua,
Python,
Perl,
PHP, and
MySQL. We run
Private Courses throughout the UK (and beyond for longer courses), and
Public Courses 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.