Hack hack hack...

An open journal-- some of it written for you, but most of it is for me.

FIS Day9

POTD

Alan Kay

  • think of programming and computers as metaphors
  • Created the GUI
  • GUI and object orientation are totally in line

The hyperlink makes the internet unique. Embedding context and meta-data is what make the internet special.

Object Orientation

Chinese proverb:

The beginning of wisdom is to call things by their right names.

Defining new kinds of things and bringing these to code. We should be able to create our own things. Teach those things how to work. And use those things.

  • class Names are arbitrary and simply point to a block of behaviors. They are just variables
  • the difference between variable types is the scope. The context in which they were created.
  • a class and a module represent the same behavior and scope gate
  • a constant defined in a class are only accessible in that class
  • classes can’t inherit from modules
Namespacing with ::
1
2
Dog::Colors
#go into the name class and get me colors
  • An instance variable is totally dependent on which object you are referring to. Every time you assign an instance variable you are teaching properties to the object.
    • It is not the responsibility of each dog (snoopy, pluto, etc.) to know anything about any other dog.
    • It is the classes responsibility to know about the class, but not about each individual dog.

classes are object, logic and data

method overriding- changing what a method does

Referential integrity

Foreign key relationships are described as parent/child relationships (customer being the parent, and customer_sales the child), and the record is said to be orphaned when its parent is no longer in existence.

Referential integrity can be compromised in three situations: when creating a new record, deleting a record or updating a record.

You can delete a record from customer and at the same time delete the record from the customer_sales table, using only one delete statement. This is called a cascading delete, where all associated records are deleted, ‘cascading’ through the tables according to the foreign key relationships.

The standard options when deleting a foreign key are listed below:

  • ON DELETE CASCADE
  • ON DELETE SET NULL
  • ON DELETE RESTRICT
  • ON DELETE NO ACTION
  • ON DELETE SET DEFAULT

Fun

Code golf is a type of recreational computer programming competition in which participants strive to achieve the shortest possible code that implements a certain algorithm.

Comments