U5L01 - Static Keyword
This lesson drills what Trevor teaches in U3L01
Pre-requirements:
- You have performed each of previous drills to reach a top speed, and then repeated top speed 10x
- Follow this for all drills explainer
- Or this if you haven't even installed the drills yet installation
Summary of what is drilled
A Disciplined Approach? holds that these items should never again allow any confusion in your mind about this list of what Trevor covered in this lesson:
COVERED IN THE LESSON
- this needs to be covered by first by footguns and second by convention/examples
- example of constant - don't want to instantiate a class just to get the value
- example of instance based - should always instantiate a class to know that value
- naming convention for constant
- implied and left out - rarely if ever mix static and instance based anything - class is either static or instance based BY CONVENTION ONLY
- implied and left out - static methods are a bad code smell, even if technically possible
- implied and left out - what happens if static is treated as instance based are treated and setter changes the static variable in one instance and then another instance accesses it
- works but non-conventional because of power needed from better tech which is dependency injection