On Github fontcuberta / my_first_reveal_test
Computer programs are designed by making them out of objects that interact with one another.
To build something we need to create some kind of blueprints to, then, pass it around to our little oompa loompas to build it.
Create a class that represents a Car. That car should have a method to make noise that prints “Broom” to the console. Then create one car and call that method
- A special method called *initialize*
- It is executed for each instance we create
Modify our Car class so we can have different sounds for different cars. Each car should have its own sound. Create two cars. One of the should make “Broom” and the other should make “BROOOOOOM”.
- Its name starts with the @@ sign
- All instances of a class share the same value for this variable
- By default all methods are instance methods
- We can also have methods for a class if we prepend its name with *self*. during declaration
What is design in software?
- The important part of an object is the messages (methods) it exposes and the outcome they produce
- The objects are black boxes. We should not care on how the code is done but what it does.
- This is the most basic form of abstracting complexity