Object-Oriented Programming with MATLAB
View schedule and enrollCourse Details
In this course, you will learn object-oriented programming techniques to develop complex yet flexible MATLAB® applications. Additionally, you will discover how to implement unit testing to guarantee software quality and ensure easy maintenance. Topics include:
- Creating custom data types that group data and functions together
- Creating maintainable and extensible applications via inheritance and aggregation
- Making applications reliable and flexible with unit tests
- Automatically triggering functions upon data changes
Day 1 of 2
Creating Custom Data Types
Objective: Learn basic techniques and experience the differences between procedural and object-oriented programming. Create a simple custom data type known as a class.
- Grouping data and functionality into a single class definition file
- Documenting classes
- Using classes to create workspace variables known as objects
Designing a Robust and User-Friendly Class
Objective: Design an intuitive, easy-to-use class. Prevent unsafe interactions with the class.
- Ensuring data is accessed in a safe manner by using property attributes
- Improving user friendliness by providing data access methods
- Customizing standard operators for the class
Hiding Implementation Details
Objective: Hide implementation details from the user to achieve easy maintenance and a simple user interface.
- Preventing data inconsistencies by restricting property and method access
- Improving class maintenance by separating the visible interface of the class from its implementation
Day 2 of 2
Building Class Hierarchies
Objective: Avoid code duplication by creating a common superclass to contain the shared functionality of several similar classes.
- Creating a common superclass for two similar classes
- Extending the superclass through a subclass and implementing specialized behavior
- Using abstract properties and methods when data and functions cannot be fully defined on the superclass level
Facilitating Multiple References
Objective: Ensure data consistency by using reference (handle) behavior to share a single data object throughout the application. Extend the functionality of a class by embedding it into another class through association.
- Creating a class that exhibits reference behavior
- Embedding a data class into a viewer class responsible for data visualization
- Choosing between pass-by-reference and the usual pass-by-value behavior
Writing Unit Tests
Objective: Improve code maintainability by creating unit tests that ensure correct code behavior. Use the MATLAB unit-testing framework to enhance the quality and flexibility of your software.
- Writing a unit test
- Creating a test environment using setup and teardown methods
- Parameterizing tests
- Aggregating and running suites of tests
- Creating test coverage reports
Synchronizing Objects
Objective: Automatically trigger function calls in response to specific data changes. Determine which data changes to monitor and which functions to execute by utilizing events, listeners, and callbacks.
- Use events to specify data changes that need to be monitored
- Define listeners which trigger reactions to events
- Implement callbacks specifying code to be executed as a reaction
Level: Intermediate
Prerequisites:
- MATLAB Programming Techniques or experience with structuring MATLAB code into functions.
Duration: 2 days
Languages: Deutsch, English, 中文, 日本語