4. Today Schedule
10:00 - 10:15 - Check in and get coffee
10:15 - 11:30 - Workshop
11:30 - 11:50 - Break
11:50 - 12:50 - Workshop
12:50 - 1pm - Final remarks, Survey
5. Mission
To not only show Object Oriented Programming, but to provide
the reasoning and feel the solution actually solve a real world
problem for software as a paradigm.
22. Let's Code
Ruby
class Cup
def initialize
puts "I'm alive! *SPARKLE*"
@drink_amount = 0
end
def fill
puts "I'm filled up!"
@drink_amount = 100
end
def empty
puts "ALL GONE!"
@drink_amount = 0
end
def quantity
puts @drink_amount
@drink_amount
end
end
Constructor
Class
Methods
23. Let's Code
Java
Constructor
Class
Methods
public class Cup {
public int drinkAmount = 0;
public Cup() {
System.out.println("I'm alive! *SPARKLE*");
drinkAmount = 0;
}
public void fill () {
System.out.println("Fill'er up!");
drinkAmount = 100;
}
public void empty () {
System.out.println("Dump it!");
drinkAmount = 0;
}
public int quantity () {
System.out.println(drinkAmount.toString() + " is left");
return drinkAmount;
}
}
34. Inheritance
Taking on the functionality of an existing class
import disney.pocahontas.plot;
public class Avatar extends pocahontas {
public plot() {
setTimeEra("Future");
setPlanet("NotEarth");
}
}
36. Inheritence
Cup Example
With JavaScript ES6
class MojoCup extends Cup {
constructor() {
super()
console.log('Welcome to Mojo')
}
}
https://jsbin.com/buwucuk/2/edit?js,console
45. Circle
A cirlce is a geometric shape
with known properties.
Wheel
An abstraction based on
circle with some known
physical properties
Based on wheel and perhaps could have an
instance.
Goodyear Tire
49. Abstract means you
can't create an instance
That's some opinion!
Keep it focussed on the project.
you can always extend it to add functionality!
or can you?....