MATLAB Object-Oriented Programming
معرفی کتاب «MATLAB Object-Oriented Programming» نوشتهٔ MathWorks، منتشرشده توسط نشر MathWorks در سال 2023. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «MATLAB Object-Oriented Programming» در دستهٔ بدون دستهبندی قرار دارد.
Using Object-Oriented Design in MATLAB Why Use Object-Oriented Design Approaches to Writing MATLAB Programs When Should You Create Object-Oriented Programs Handle Object Behavior What Is a Handle? Copies of Handles Handle Objects Modified in Functions Determine If an Object Is a Handle Deleted Handle Objects Basic Example Creating a Simple Class Design Class Create Object Access Properties Call Methods Add Constructor Vectorize Methods Overload Functions BasicClass Code Listing MATLAB Classes Overview Role of Classes in MATLAB Classes Some Basic Relationships Developing Classes That Work Together Formulating a Class Specifying Class Components BankAccount Class Implementation Formulating the AccountManager Class Implementing the AccountManager Class AccountManager Class Synopsis Using BankAccount Objects Representing Structured Data with Classes Objects as Data Structures Structure of the Data The TensileData Class Create an Instance and Assign Data Restrict Properties to Specific Values Simplifying the Interface with a Constructor Calculate Data on Demand Displaying TensileData Objects Method to Plot Stress vs. Strain TensileData Class Synopsis Implementing Linked Lists with Classes Class Definition Code dlnode Class Design Create Doubly Linked List Why a Handle Class for Linked Lists? dlnode Class Synopsis Specialize the dlnode Class Working with Objects in MATLAB Static Data Static Data What Is Static Data Static Variable Static Data Object Constant Data Class Definition—Syntax Reference Components of a Class Class Building Blocks Class Definition Block Properties Block Methods Block Events Block Attribute Specification Enumeration Classes Related Information Method Syntax Methods Definition Block Method Argument Validation Special Considerations for Validation in Methods Call Superclass Methods on Subclass Objects Superclass Relation to Subclass How to Call Superclass Methods How to Call Superclass Constructor Using a Class to Display Graphics Class Calculates Area Description of Class Definition MATLAB Code Analyzer Warnings Syntax Warnings and Property Names Variable/Property Name Conflict Warnings Exception to Variable/Property Name Rule Objects in Conditional Statements Enable Use of Objects in Conditional Statements How MATLAB Evaluates Switch Statements How to Define the eq Method Enumerations in Switch Statements Use of Editor and Debugger with Classes Write Class Code in the Editor How to Refer to Class Files How to Debug Class Files Automatic Updates for Modified Classes When MATLAB Loads Class Definitions Consequences of Automatic Update What Happens When Class Definitions Change Ensure Defining Folder Remains in Scope Actions That Do Not Trigger Updates Multiple Updates to Class Definitions Object Validity with Deleted Class File When Updates Are Not Possible Potential Consequences of Class Updates Interactions with the Debugger Updates to Class Attributes Updates to Property Definitions Updates to Method Definitions Updates to Event Definitions Comparison of MATLAB and Other OO Languages Some Differences from C++ and Java Code Object Modification Static Properties Common Object-Oriented Techniques Defining and Organizing Classes User-Defined Classes What Is a Class Definition Attributes for Class Members Kinds of Classes Constructing Objects Class Hierarchies classdef Syntax Class Code Class Attributes Specifying Class Attributes Specifying Attributes Class-Specific Attributes Functions Inside Class Definition Files Evaluation of Expressions in Class Definitions Why Use Expressions Where to Use Expressions in Class Definitions How MATLAB Evaluates Expressions When MATLAB Evaluates Expressions Expression Evaluation in Handle and Value Classes Folders Containing Class Definitions Class Definitions on the Path Class and Path Folders Using Path Folders Using Class Folders Functions in Private Folders Within Class Folders Class Precedence and MATLAB Path Changing Path to Update Class Definition Class Precedence Use of Class Precedence Why Mark Classes as Inferior InferiorClasses Attribute Packages Create Namespaces Package Folders Internal Packages Referencing Package Members Within Packages Referencing Package Members from Outside the Package Packages and the MATLAB Path Import Classes Syntax for Importing Classes Import Static Methods Import Package Functions Package Function and Class Method Name Conflict Clearing Import List Creating and Managing Class Aliases Creating an Alias Definition File Viewing Alias Definitions Backward and Forward Compatibility of Aliases Value or Handle Class — Which to Use Comparison of Handle and Value Classes Basic Difference Behavior of MATLAB Built-In Classes User-Defined Value Classes User-Defined Handle Classes Determining Equality of Objects Functionality Supported by Handle Classes Which Kind of Class to Use Examples of Value and Handle Classes When to Use Value Classes When to Use Handle Classes The Handle Superclass Building on the Handle Class Handle Class Methods Event and Listener Methods Relational Methods Test Handle Validity When MATLAB Destroys Objects Handle Class Destructor Basic Knowledge Syntax of Handle Class Destructor Method Handle Object During delete Method Execution Support Destruction of Partially Constructed Objects When to Define a Destructor Method Destructors in Class Hierarchies Object Lifecycle Restrict Access to Object Delete Method Nondestructor Delete Methods External References to MATLAB Objects Find Handle Objects and Properties Find Handle Objects Find Handle Object Properties Implement Set/Get Interface for Properties The Standard Set/Get Interface Subclass Syntax Get Method Syntax Set Method Syntax Class Derived from matlab.mixin.SetGet Set Priority for Matching Partial Property Names Implement Copy for Handle Classes Copy Method for Handle Classes Customize Copy Operation Copy Properties That Contain Handles Exclude Properties from Copy Properties — Storing Class Data Ways to Use Properties What Are Properties Types of Properties Property Syntax Property Definition Block Property Validation Syntax Property Access Syntax Property Attributes Purpose of Property Attributes Specify Property Attributes Table of Property Attributes Property Access Lists Initialize Property Values Define Properties with Default Values Set Property Values in the Constructor Mutable and Immutable Properties Set Access to Property Values Define Immutable Property Validate Property Values Property Validation in Class Definitions Sample Class Using Property Validation Order of Validation Abstract Property Validation Objects Not Updated When Changing Validation Validation During Load Operation Property Class and Size Validation Property Class and Size Property Size Validation Property Class Validation Default Values Per Size and Class Property Validation Functions MATLAB Validation Functions Validate Property Using Functions Define Validation Functions Metadata Interface to Property Validation Property Get and Set Methods Property Get Methods Property Set Methods Get and Set Methods for Dependent Properties Define a Get Method for a Dependent Property When to Use Set Methods with Dependent Properties Properties Containing Objects Assigning Objects as Default Property Values Assigning to Read-Only Properties Containing Objects Assignment Behavior Dynamic Properties — Adding Properties to an Instance What Are Dynamic Properties Define Dynamic Properties List Object Dynamic Properties Set and Get Methods for Dynamic Properties Create Access Methods for Dynamic Properties Dynamic Property Events Dynamic Properties and Ordinary Property Events Dynamic-Property Events Listen for a Specific Property Name PropertyAdded Event Callback Execution PropertyRemoved Event Callback Execution How to Find meta.DynamicProperty Objects Dynamic Properties and ConstructOnLoad Methods — Defining Class Operations Methods in Class Design Class Methods Examples and Syntax Kinds of Methods Method Naming Method Attributes Purpose of Method Attributes Specifying Method Attributes Table of Method Attributes Ordinary Methods Ordinary Methods Operate on Objects Methods Inside classdef Block Method Files Methods in Separate Files Class Folders Define Method in Function File Specify Method Attributes in classdef File Methods You Must Define in the classdef File Method Invocation Dot and Function Syntaxes Determining Which Method Is Invoked Class Constructor Methods Purpose of Class Constructor Methods Basic Structure of Constructor Methods Guidelines for Constructors Default Constructor When to Define Constructors Related Information Initializing Objects in Constructor No Input Argument Constructor Requirement Subclass Constructors Implicit Call to Inherited Constructor Errors During Class Construction Output Object Suppressed Static Methods What Are Static Methods Why Define Static Methods Defining Static Methods Calling Static Methods Inheriting Static Methods Overload Functions in Class Definitions Why Overload Functions Implementing Overloaded MATLAB Functions Rules for Naming to Avoid Conflicts Class Support for Array-Creation Functions Extend Array-Creation Functions for Your Class Which Syntax to Use Implement Support for Array-Creation Functions Class Methods for Graphics Callbacks Referencing the Method Syntax for Method Callbacks Use a Class Method for a Slider Callback Object Arrays Construct Object Arrays Build Arrays in the Constructor Referencing Property Values in Object Arrays Initialize Object Arrays Calls to Constructor Initial Value of Object Properties Empty Arrays Creating Empty Arrays Assigning Values to an Empty Array Initialize Arrays of Handle Objects Related Information Accessing Dynamic Properties in Arrays Implicit Class Conversion Concatenation Subscripted Assignment Property Validation Function and Method Argument Validation Concatenating Objects of Different Classes Basic Knowledge MATLAB Concatenation Rules Concatenating Objects Calling the Dominant-Class Constructor Converter Methods Designing Heterogeneous Class Hierarchies Creating Classes That Support Heterogeneous Arrays MATLAB Arrays Heterogeneous Hierarchies Heterogeneous Arrays Heterogeneous Array Concepts Nature of Heterogeneous Arrays Unsupported Hierarchies Default Object Conversion During Assignment and Concatenation Empty Arrays of Heterogeneous Abstract Classes Heterogeneous Array Constructors Building Arrays in Superclass Constructors When Errors Can Occur Initialize Array in Superclass Constructor Sample Implementation Potential Error Events — Sending and Responding to Messages Overview Events and Listeners Why Use Events and Listeners Events and Listeners Basics Event Syntax Create Listener Define Custom Event Data Class Event Data Requirements Define and Trigger Event Define Event Data Create Listener for Overflow Event Observe Changes to Property Values Implement Property Set Listener PushButton Class Design Event and Listener Concepts The Event Model Limitations Default Event Data Events Only in Handle Classes Property-Set and Query Events Listeners Event Attributes Specify Event Attributes Events and Listeners Syntax Components to Implement Name Events Trigger Events Listen to Events Define Event-Specific Data Listener Lifecycle Control Listener Lifecycle Temporarily Deactivate Listeners Permanently Delete Listeners Listener Callback Syntax Specifying Listener Callbacks Input Arguments for Callback Function Additional Arguments for Callback Function Callback Execution When Callbacks Execute Listener Order of Execution Callbacks That Call notify Manage Callback Errors Invoke Functions from Function Handles Determine If Event Has Listeners Do Listeners Exist for This Event? Why Test for Listeners Coding Patterns Listeners in Heterogeneous Arrays Listen for Changes to Property Values Create Property Listeners Property Event and Listener Classes Assignment When Property Value Is Unchanged AbortSet When Value Does Not Change How MATLAB Compares Values When to Use AbortSet Implement AbortSet Using AbortSet with Property Validation Techniques for Using Events and Listeners Example Overview Techniques Demonstrated in This Example Summary of fcneval Class Summary of fcnview Class Methods Inherited from Handle Class Using the fcneval and fcnview Classes Implement UpdateGraph Event and Listener The PostSet Event Listener Enable and Disable Listeners @fcneval/fcneval.m Class Code @fcnview/fcnview.m Class Code How to Build on Other Classes Hierarchies of Classes — Concepts Classification Develop the Abstraction Design of Class Hierarchies Super and Subclass Behavior Implementation and Interface Inheritance Subclass Syntax Subclass Definition Syntax Subclass double Design Subclass Constructors Call Superclass Constructor Explicitly Call Superclass Constructor from Subclass Subclass Constructor Implementation Call Only Direct Superclass from Constructor Control Sequence of Constructor Calls Modify Inherited Methods When to Modify Superclass Methods Extend Superclass Methods Reimplement Superclass Process in Subclass Redefine Superclass Methods Implement Abstract Method in Subclass Modify Inherited Properties Superclass Property Modification Private Local Property Takes Precedence in Method Subclassing Multiple Classes Specify Multiple Superclasses Class Member Compatibility Multiple Inheritance Specify Allowed Subclasses Why Control Allowed Subclasses Specify Allowed Subclasses Define Sealed Hierarchy of Classes Class Members Access Basic Knowledge Applications for Access Control Lists Specify Access to Class Members Properties with Access Lists Methods with Access Lists Abstract Methods with Access Lists Method Access List Event Access List Handle Compatible Classes Basic Knowledge When to Use Handle-Compatible Classes Handle Compatibility Rules Identify Handle Objects How to Define Handle-Compatible Classes What Is Handle Compatibility? Subclassing Handle-Compatible Classes Methods for Handle-Compatible Classes Methods for Handle and Value Objects Modify Value Objects in Methods Handle-Compatible Classes and Heterogeneous Arrays Heterogeneous Arrays Methods Must Be Sealed Template Technique Subclasses of MATLAB Built-In Types MATLAB Built-In Types Built-In Types You Can Subclass Why Subclass Built-In Types Which Functions Work with Subclasses of Built-In Types Behavior of Built-In Functions with Subclass Objects Built-In Subclasses That Define Properties Behavior of Inherited Built-In Methods Subclass double Built-In Data Value Methods Built-In Data Organization Methods Built-In Indexing Methods Built-In Concatenation Methods Subclasses of Built-In Types Without Properties Specialized Numeric Types A Class to Manage uint8 Data Using the DocUint8 Class Subclasses of Built-In Types with Properties Specialized Numeric Types with Additional Data Storage Subclasses with Properties Property Added Methods Implemented Class Definition Code Using ExtendDouble Concatenation of ExtendDouble Objects Use of size and numel with Classes size and numel Built-In Class Behavior Subclasses Inherit Behavior Classes Not Derived from Built-In Classes Change the Behavior of size or numel Overload numArgumentsFromSubscript Instead of numel Determine Array Class Query the Class Name Test for Array Class Test for Specific Types Test for Most Derived Class Abstract Classes and Class Members Abstract Classes Declare Classes as Abstract Determine If a Class Is Abstract Find Inherited Abstract Properties and Methods Define an Interface Superclass Interfaces Interface Class Implementing Graphs Saving and Loading Objects Save and Load Process for Objects Save and Load Objects What Information Is Saved? How Is the Property Data Loaded? Errors During Load Reduce MAT-File Size for Saved Objects Default Values Dependent Properties Transient Properties Avoid Saving Unwanted Variables Save Object Data to Recreate Graphics Objects What to Save Regenerate When Loading Change to a Stairstep Chart Improve Version Compatibility with Default Values Version Compatibility Using a Default Property Value Avoid Property Initialization Order Dependency Control Property Loading Dependent Property with Private Storage Property Value Computed from Other Properties Modify the Save and Load Process When to Modify the Save and Load Process How to Modify the Save and Load Process Implementing saveobj and loadobj Methods Additional Considerations Basic saveobj and loadobj Pattern Using saveobj and loadobj Handle Load Problems Maintain Class Compatibility Rename Property Update Property When Loading Maintaining Compatible Versions of a Class Version 2 of the PhoneBookEntry Class Initialize Objects When Loading Calling Constructor When Loading Objects Initializing Objects in the loadobj Method Save and Load Objects from Class Hierarchies Saving and Loading Subclass Objects Reconstruct the Subclass Object from a Saved struct Restore Listeners Create Listener with loadobj Use Transient Property to Load Listener Using the BankAccount and AccountManager Classes Enumerations Named Values Kinds of Predefined Names Techniques for Defining Enumerations Define Enumeration Classes Enumeration Class Construct an Enumeration Member Convert to Superclass Value Define Methods in Enumeration Classes Define Properties in Enumeration Classes Enumeration Class Constructor Calling Sequence Refer to Enumerations Instances of Enumeration Classes Conversion of Characters to Enumerations Enumeration Arrays Enumerations for Property Values Syntax for Property/Enumeration Definition Example of Restricted Property Operations on Enumerations Operations Supported by Enumerations Example Enumeration Class Default Methods Convert Enumeration Members to Strings or char Vectors Convert Enumeration Arrays to String Arrays or Cell Arrays of char Vectors Relational Operations with Enumerations, Strings, and char Vectors Enumerations in switch Statements Enumeration Set Membership Enumeration Text Comparison Methods Get Information About Enumerations Testing for an Enumeration Hide Enumeration Members Hide Pure Enumerations Find Hidden Enumeration Members Enumeration Class Restrictions Enumerations Derived from Built-In Classes Subclassing Built-In Classes Derive Enumeration Class from Numeric Class How to Alias Enumeration Names Superclass Constructor Returns Underlying Value Default Converter Mutable Handle vs. Immutable Value Enumeration Members Select Handle- or Value-Based Enumerations Value-Based Enumeration Classes Handle-Based Enumeration Classes Represent State with Enumerations Enumerations That Encapsulate Data Enumeration Classes with Properties Store Data in Properties Save and Load Enumerations Basic Knowledge Built-In and Value-Based Enumeration Classes Simple and Handle-Based Enumeration Classes Causes: Load as struct Instead of Object Constant Properties Define Class Properties with Constant Values Defining Named Constants Constant Property Assigned a Handle Object Constant Property Assigned Any Object Constant Properties — No Support for Get Events Information from Class Metadata Class Metadata What Is Class Metadata? The meta Package Metaclass Objects Metaclass Object Lifecycle Class Introspection with Metadata Using Class Metadata Inspect the EmployeeData Class Metaclass EnumeratedValues Property Find Objects with Specific Values Find Handle Objects Find by Attribute Settings Get Information About Properties The meta.property Object How to Find Properties with Specific Attributes Find Default Values in Property Metadata Default Values meta.property Data Specialize Object Behavior Methods That Modify Default Behavior How to Customize Class Behavior Which Methods Control Which Behaviors Overload Functions and Override Methods Concatenation Methods Default Concatenation Methods to Overload Object Converters Why Implement Converters Converters for Package Classes Converters and Subscripted Assignment Converter for Heterogeneous Arrays Customize Object Indexing Default Object Indexing Customize Object Indexing With Modular Indexing Classes Code Patterns for subsref and subsasgn Methods Customize Indexed Reference and Assignment Syntax for subsref and subsasgn Methods Indexing Structure Describes Indexing Expressions Values of the Indexing Structure Typical Patterns for Indexing Methods Overload end for Classes Syntax and Default Behavior How RedefinesParen Overloads end Objects in Index Expressions Objects as Indexes Ways to Implement Objects as Indices subsindex Implementation Operator Overloading Why Overload Operators How to Define Operators Sample Implementation — Addable Objects MATLAB Operators and Associated Functions Customize Parentheses Indexing for Mapping Class Forward Indexing Operations Customizing Object Display Custom Display Interface Command Window Display Default Object Display CustomDisplay Class Methods for Customizing Object Display How CustomDisplay Works Steps to Display an Object Methods Called for a Given Object State Role of size Function in Custom Displays How size Is Used Precautions When Overloading size Customize Display for Heterogeneous Arrays Class with Default Object Display The EmployeeInfo Class Default Display — Scalar Default Display — Nonscalar Default Display — Empty Object Array Default Display — Handle to Deleted Object Default Display — Detailed Display Choose a Technique for Display Customization Ways to Implement a Custom Display Sample Approaches Using the Interface Customize Property Display Objective Change the Property Order Change the Values Displayed for Properties Customize Header, Property List, and Footer Objective Design of Custom Display getHeader Method Override getPropertyGroups Override getFooter Override Customize Display of Scalar Objects Objective Design of Custom Display displayScalarObject Method Override getPropertyGroups Override Customize Display of Object Arrays Objective Design of Custom Display The displayNonScalarObject Override The displayEmptyObject Override Overloading the disp Function Display Methods Overloaded disp Relationship Between disp and display Custom Compact Display Interface Customization Options Available for Compact Display Designing a Class with a Customized Compact Display Defining Custom Data Types Representing Polynomials with Classes Class Requirements DocPolynom Class Members DocPolynom Class Synopsis The DocPolynom Constructor Convert DocPolynom Objects to Other Classes Overload disp for DocPolynom Display Evaluated Expression Define Arithmetic Operators Redefine Parentheses Indexing Designing Related Classes A Class Hierarchy for Heterogeneous Arrays Interfaces Based on Heterogeneous Arrays Define Heterogeneous Hierarchy Assets Class Stocks Class Bonds Class Cash Class Default Object Operating on an Assets Array
دانلود کتاب MATLAB Object-Oriented Programming