In Kotlin, a module is an executable set of Kotlin files. A module is effectively a self-contained unit of code that can stand on its own or be incorporated alongside other modules in a larger project. A module can contain many packages and Kotlin files. The internal modifier indicates that a piece of code is publicly available within the enclosing module, but not to other project modules. A module may be represented in a variety of ways depending on how the code will be run. A couple of examples include the following:
- IntelliJ IDEA modules
- Gradle source sets
In this section, we were introduced to the basics of OOP with Kotlin. We explored how to declare simple classes, add and access properties, and control the construction of our classes. Finally, we discussed how to use various visibility modifiers and organizational constructs to control who has access to our classes.
In the next section, we're going to build on these concepts and explore inheritance and composition.