Home » , » Download PDF A Guide to MATLAB® Object-Oriented Programming by Andy H. Register

Download PDF A Guide to MATLAB® Object-Oriented Programming by Andy H. Register



Sinopsis

The organization of this book breaks MATLAB object-oriented programming into three sections. The first section covers the required elements and focuses on developing a set of functions that give MATLAB objects first-class status within the environment. In the first section, we will develop a group of eight indispensable functions. These functions provide object initialization, a simple intuitive interface, interaction with the environment’s features, and array capability. Even more important, the group of eight is responsible for an object-oriented concept called encapsulation. Encapsulation is fundamental to using object-oriented programming as a better, safer alternative to structures. The default functions in MATLAB seem to be at odds with the information-hiding principle of encapsulation; but the group of eight brings MATLAB back under control. By the end of the first section, you will have an excellent working knowledge of MATLAB’s object-oriented capability and be able to use object-oriented programming techniques to improve software development. The second section builds on the first by developing strategies and implementations that allow the construction of hierarchies without compromises. Such hierarchies are important for achieving true object-oriented programming. The concept of building the next layer of functionality on a firm foundation of mature code is very compelling and often elusive. Encapsulation certainly helps, but another object-oriented concept called inheritance makes it much easier to build and traverse an organizational hierarchy. With inheritance, each successive layer simply builds up additional capability without changing code in the foundation. As the code matures, bug fixes simply make the foundation stronger. At first blush, the desire for both first-class status and an inheritance hierarchy appears incompatible. The section on building a hierarchy delivers a harmonious framework.

The third section discusses advanced strategies and introduces some useful utilities. Advanced strategies include, among others, type-based function selection, also known as polymorphism; passing arguments by reference instead of by value; replacing feval’s function handle with an object; and a utility for rapid object-oriented code development. Do not expect to use all the advanced strategies in every software development. Instead, reserve the advanced techniques for difficult situations. Discussing these concepts is important because it opens the door to what are essentially limitless implementation options. It is also nice to know about advanced strategies when the uncommon need arises.
 
This book makes two assumptions about you, the reader. The first assumption is that you consider yourself an intermediate or better MATLAB programmer. At every opportunity, example code uses vector syntax. The example code also uses a few important but relatively obscure MATLAB functions. Example code also uses language features that some might consider to be advanced topics, for example, function handles and try-catch error handling. Even though code examples are described line by line, entry-level MATLAB programmers might find the example code somewhat vexing.
 
The second assumes only a cursory knowledge of object-oriented programming. I dedicate a significant amount of the discussion to the introduction of fundamental object-oriented programming concepts. MATLAB programmers new to object-oriented programming will be able to follow these discussions and thus gain the ability to implement object-oriented designs. Even so, there is also plenty of substance to keep seasoned object-oriented programmers on their toes. Going back to the basics will often reveal important design considerations or expose hidden object-oriented capability. It is my sincere hope that everyone reading this book will mutter the phrase “I didn’t know you could do that” at least once.


Content

  1. Introduction
  2. Meeting MATLAB’s Requirements
  3. Member Variables and Member Functions
  4. Changing the Rules … in Appearance Only
  5. Displaying an Object’s State
  6. Fieldnames.m
  7. struct.m
  8. get.m, set.m
  9. Simplify Using get, set, fieldnames, and struc
  10. Drawing a Shape
  11. Constructor Redux
  12. Constructing Simple Hierarchies with Inheritance
  13. Object Arrays with Inheritance
  14. Child-Class Members
  15. Constructing Simple Hierarchies with Compo
  16. General Assignment and Mutator Helper Functions
  17. Class Wizard
  18. Class Wizard Versions of the Shape Hierarchy
  19. Composition and a Simple Container Class
  20. Static Member Data and Singleton Objects
  21. Pass-by-Reference Emulation
  22. Dot Functions and Functors
  23. Protected Member Variables and Functions
  24. Potpourri for $100


0 komentar:

Posting Komentar