Are you an EPFL student looking for a semester project?
Work with us on data science and visualisation projects, and deploy your project as an app on top of Graph Search.
This lecture introduces the concepts of encapsulation and abstraction in object-oriented programming using Java, with a focus on a Tic-Tac-Toe game implementation. The instructor demonstrates the evolution of a poorly encapsulated game class to a well-encapsulated one, highlighting the importance of data hiding and clear method naming. Through examples, the lecture shows the drawbacks of exposing internal data structures and the benefits of encapsulation, such as data validation and separation of concerns. By encapsulating the game logic, the instructor ensures that users interact with the game through well-defined methods, preventing invalid moves and enhancing code readability and maintainability.