Pages

20 August 2015

Coding Bootcamp: Day 4




Page Title


My Fourth Day

We learned about Object Oriented Programming (OOP) today. In theory, it's easy to understand and relates a lot to Plato. In Ruby, everything is an object. Objects are things that can exist in the real world, like chairs and cars. And in the Ruby world, objects have three "extension", things like state, behaviour and method. Anyway, every object belongs to a higher category called a "Superclass", which is where Plato comes in.

Platonic ideals are things like the doggiest dog or the chairiest chair, and superclasses are like that, too. They don't have any physical traits (i.e. states or behaviours or methods) because it can't; any trait it has has to apply to everything and that's impossible. It'd be like ascribing things like "four legs" or "tail" to dogs. What happens if you extend that downward into separate classes and end up with a dog that only has three legs or a cropped tail?


When you go one level down, you reach something called a "Subclass", and that'd be like extrapolating beanbag chairs and stools from the class of chairs, or Pomeranians from the class of dogs. Everything in a subclass has to be derived from a class, and everything in a class has to be derivable from a superclass (i.e. you can't have a subclass of cats from the class of dogs, but you can have a subclass of cats and a subclass of dogs from the superclass mammals.

That, in a nutshell, is OOP and it sounds simple enough, right? The theory part of it is easy enough to understand, but then there's the code aspect of it and knowing which commands to what and how to look for them and arrange them on a screen. That's the part I don't get.

Yet.



No comments:

Post a Comment