Bons Mots

My driver code is my friend

TIL:

1. Driver code is your friend. Writing it before you code can be a huge help with determining how you want your program to work. Driver code first; program second.

2. Smurf naming condition: redundant naming scheme.

3. Megamoth: maga-monolithic methods; aka ridiculously huge methods. 

4. Law of demeter (don’t call a method on a method)

5. Never print to the screen from the class.

6. When defining methods, it’s better to tell an object to do something to itself, rather than try to go around and do something for the object.

     Not good code:

          def check_for_overheating(system_monitor)

               if system_monitor.temperature > 100

                    system_monitor.sound_alarms

               end

          end

     Better code:

          class SystemMonitor

               def check_for_overheating

                    if temperature > 100

                         sound_alarms

                    end

               end

          end 

7. I need to get a notebook, because taking notes on my computer is a pain.

  1. devbootcamp reblogged this from bonsmots
  2. bonsmots posted this