flâneur — a map of the web's best reading

2.4 Mutable Data

composingprograms.com · 8,918 words · saved by 1 readers

We have seen how abstraction is vital in helping us to cope with the complexity of large systems. Effective programming also requires organizational principles that can guide us in formulating the overall design of a program. In particular, we need strategies to help us structure large systems to be modular, meaning that they divide naturally into coherent parts that can be separately developed and maintained. One powerful technique for creating modular programs is to incorporate data that may change state over time. In this way, a single data object can represent something that evolves independently of the rest of the program. The behavior of a changing object may be influenced by its history, just like an entity in the world. Adding state to data is a central ingredient of a paradigm called object-oriented programming. In the beginning of this text, we distinguished between functions and data: functions performed operations and data were operated upon. When we included function value

2.4 Mutable Data c ⚬ mp ⚬ sing pr ⚬ grams Text Projects Tutor About Chapter 2 Hide contents 2.1 Introduction 2.1.1 Native Data Types 2.2 Data Abstraction 2.2.1 Example: Rational Numbers 2.2.2 Pairs 2.2.3 Abstraction Barriers 2.2.4 The Properties of Data 2.3 Sequences 2.3.1 Lists 2.3.2 Sequence Iteration 2.3.3 Sequence Processing 2.3.4 Sequence Abstraction 2.3.5 Strings 2.3.6 Trees 2.3.7 Linked Lists 2.4 Mutable Data 2.4.1 The Object Metaphor 2.4.2 Sequence Objects 2.4.3 Dictionaries 2.4.4 Local State 2.4.5 The Benefits of Non-Local Assignment 2.4.6 The Cost of Non-Local Assignment 2.4.7 Implem

Explore this link on the map →

related reading