R
Robert Mark Bram
Howdy All!
I am trying to write a very brief comparison of the Date and Math objects in
terms of instance v static objects. What I have below is my best so far. Any
criticisms or suggestions are most welcome!
Date is an instance object.
You use Date by creating instances of it
- you call methods on those instances.
- you change data to do with each instance.
Instance objects store state
- meaning they hold data that may change over time.
Math is a static object.
You never create instances of it
- you call methods on Math directly.
- it never stores data for you: each method performs some mathematical
computation and returns a result. It is up to you to store required data.
Static objects can store state - but Math does not.
Rob
I am trying to write a very brief comparison of the Date and Math objects in
terms of instance v static objects. What I have below is my best so far. Any
criticisms or suggestions are most welcome!
Date is an instance object.
You use Date by creating instances of it
- you call methods on those instances.
- you change data to do with each instance.
Instance objects store state
- meaning they hold data that may change over time.
Math is a static object.
You never create instances of it
- you call methods on Math directly.
- it never stores data for you: each method performs some mathematical
computation and returns a result. It is up to you to store required data.
Static objects can store state - but Math does not.
Rob