lunch bag

nslookup google.com

“foo”.object_id

“foo”.methods

guest = Object.new; def gues.t.name “guest” end

s=”foo”; s<<“d”; s.length => 4

protocol: TCP, HTTP

inheritance include inheritance of implementation and type. But the inheritance of type does not help because ruby is dynamic typing. When we talk about dynamic typing, we talk about a mechanism where the type of a variable can change and be resolved on the fly at the exact moment it gets parsed by the interpreter. When we talk about static typing, we talk about a mechanism where the type of a variable is resolved in advance by the interpreter/compiler. Javascript is dynamically typed too.

A dynamically typed language is a language where the type of a variable can be altered at any time. (It is a string, now it is a Fixnum, now it is a Time object, etc.)

A statically typed language is the opposite. (Decide what x is once for all and don’t change your mind!)

A strongly typed language is a language that is being strict about what you can do with your typed variables. (Don’t mix them… or I will throw you an error in the face!)

A weakly typed language is the opposite. (Do what you want with your different types. Mix them all! We’ll see what happens!)

http://www.rubyfleebie.com/ruby-is-dynamically-and-strongly-typed/

delegation means composition in ruby but means prototypes in Javascript.

validate_with

validate { |r| r.home_phone? || r.cell_phone? } # validate it should be either a home phone or a cell phone.

polymorphism: method lookup is fast, but testing class type is slow and messy.

Leave a comment