Start of week 2 here at DBC! Looking ahead for the week it looks like its going to be a very interesting one, cant wait!!
Before lunch what we worked on how to restructure some code, how to store information into a hash and set its default, and what that would look like. Very interesting stuff! I really enjoyed this challenge it showed me different and more efficient ways of storing information.
The second challenge that we had before lunch, was that we learned about ".self" and what it does and how to kind of call self on methods. Testing out what the different outputs would be and how to create new objects and call. self on them.
The third challenge that we had was working with enumerable methods and the difference between (".map",".inject",".select"). This challenge was by far the most helpful to me. Gave me great practice in what the difference of each enumerable method was doing. From there we also had to write a class method that would do the same thing as .map, but instead of just saying .map to use another enumerable method. This is where "called self. Each" and pushed each element into a new array.
After lunch we worked on some more OOP foundations, our first challenge was that we were given a Ruby file. In that file we had to make all the driver code to pass, so this exercise was helpful in understanding and also helping solidify my understanding of driver test code.
Towards the end of the day I worked on a challenge that had to do with classical inheritance, and how to know when to use inheritance vs composition. Brick, my instructor gave a great example that made things very easy to understand. If you are doing inheritance, ask yourself "Is A?" that will help to see such as... the class method bat IS A inheritance of the class Mammal. For composition it was, "Has A" such as...the class Child has-a other that it uses to get its work done.