Day 17

Tonight was good. I like having a dedicated 3-hour block at night instead of 1 hour in the morning and 2 hours at night. I feel like I can get into a better flow and get more done. I did a study group tonight on a banking lab that I had worked on recently. Took away from it to utilize self on pretty much all instance variable references after they have been initialized (created). This is because when we reference the instance variables directly we’re cutting out using the macros that attr_accessor attr_reader attr_writer provide. It is true though that writing code that uses @variable instead of self.variable will still pass the tests I’m working with. I know this because I’ve been doing it haha.

I got through some module lessons and labs once the study group was over. Something to always remember is:

If you have a module whose methods you would like to be used in another class as instance methods, then you must include the module.
If you want a module’s methods to be used in another class as class methods, you must extend the module.

Modules are sweet and I’m happy I’m going to start using them. Things are getting simpler while they’re getting more complex at the same time. There are so many things that have already been figured out in the world of development and slowly they’re being introduced.

I also learned tonight that there is a term for the workflow that most people follow when they write code. The workflow being, you have tests that are failing, you write whatever code is needed to pass your tests, you break that ugly code and write cleaner code to pass your tests again.

This is called the red, green, refactor pattern. First tests fail, then you write bad code to get them to pass, then you refactor that bad code into good code.

I guess it makes sense that these things have been defined. I’m not inventing web development. Just learning it.

Time spent today: 2:37
Time spent total: 76:04
Lessons completed today: 4
Lessons completed total: 268