Skip to content

Instantly share code, notes, and snippets.

Object Oriented Programming explained to 10 year olds

By Morgan Prior & Ashish Dixit

Objects are things that you can see around you. The chair is an object. The toys you have are objects. Robots are objects. Objects can be defined based on how they look and what they can do. For example, you can define a car as a red car or a fast car. When you say red, you are talking about physical features and when you say fast, you are talking about their abilities.

Objects form different groups based on their similarities & differences. Car is one kind of object while Robots are another. Within Robots there are household robots like the roomba that vaccums your carpet then there are cooler robots like the transformers. However, both transformers and the roomba in your house share certain similarities. So you can say that both roomba & Transformers inherit certain characteristics that are common to all robots and have additional features that separate them apart.

N

@JEG2
JEG2 / board_spec.rb
Created September 23, 2010 04:02
I wish all of these satisfy calls weren't needed to pass warnings
require "go/gtp/board"
describe Go::GTP::Board do
before :all do
@string = <<-END_BOARD.gsub(/^ {4}/, "")
A B C D E F G H J
9 . . . . . . . . . 9
8 . . . . . . . . . 8
7 . . X . . . + . . 7
6 . . . . . . . . . 6
Benchmark
CSV (Ruby 1.9, not 1.8!)
DRb
Delegator ## aguids
FileUtils ## tehviking
Fiber ## afcapel
JSON (The Ruby 1.9 stdlib, NOT the gems) ## sweetmango
Matrix ## morgy
MiniTest
OptionParser ## jazzu
require 'pp'
a=[1,[2,[3]],4,5,[6,7,[8,9]]]
pp a.inject([]){|b,x| if Array===x then x.each {|y| b << y } else b << x end;b;}
# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb
# and made a lot more robust by me
# this implementation uses erb by default. if you want to use any other template mechanism
# then replace `erb` on line 13 and line 17 with `haml` or whatever
module Sinatra::Partials
def partial(template, *args)
template_array = template.to_s.split('/')
template = template_array[0..-2].join('/') + "/_#{template_array[-1]}"
options = args.last.is_a?(Hash) ? args.pop : {}
options.merge!(:layout => false)