Mutable and immutable objects in programming
Mutable means that the object can change. For example if a speed of a car is 55, than it is possible to change it to 65. Mutable objects are variables. Variables take space in a computer memory. Immutable objects are constants. For example it possible to define a constant that represents maximum speed. Constants don't take space in a computer memory, at compile time a constant is replaced with an associated value. There are three reasons why constants are used: 1. Improved readability. It makes more sense to use a constant which name is maximum_speed rather then 65. A person who writes code needs to come up with meaningful names for variables and constants and not just a, b, c. 2. Value of a constant can be easily changed at a later time. For example if the height of the highest building is 100, but a new one was built that is higher than the previous one, than it is possible to update the constant with a new value just once, rather then update multiple times, if a constant is not ...