Chapter 14. Models: working with data
This chapter covers
- Building models from data
- Using the same data in multiple projects
- Switching between data files
- Specifying map data in The Crypt
In chapter 13, you saw how you can use modules to break a program into separate files. You can then work on the modules independently, easily switch between modules, and reuse them across multiple projects. You can even publish your modules and import published modules written by others.
This chapter maintains that spirit of modularization and reuse. You look at moving data out of constructors and functions. You represent the data simply so that multiple apps can use the data, even if the apps are written in different programming languages. You then consider how to feed that data into constructors and functions to build models that add extra functionality. Finally, you define map data for The Crypt, adding challenges to make the game more engaging.
Your development work has really gotten you noticed (The Fruitinator! was a global smash), and you’re now part of a team developing a fitness application. Health-conscious users track their exercise, logging the date and duration of each session.