A Guide to MATLAB Object-Oriented Programming

Chapter 16: General Assignment and Mutator Helper Functions

In our constant quest for software quality, consistent interfaces and modular code are very important. In light of this, we need to turn our attention on get and set. If you examine the current implementations of get or set, the logic in almost every case statement is different. These differences are currently necessary because the interface for each public variable is unique. It is preferable to keep the group-of-eight functions as uniform as possible and that means trying to move interface differences out of get and set. There isn t a lot we can do about individual cases, but we can simplify the code contained in each. To do this we will develop a helper-function technique that pushes most of the differences out of get and set and into the helper. This technique will improve code modularity and improvements in modularity directly relate to improvements in code quality.

As always, the driving force is code quality. As the public interface grows in complexity, it would be bad if the complexity of get and set grew faster than the interface. If we include all the code directly in these functions, that is exactly what will happen. We will get a riot of cases, and every case is essentially unique. If we don t develop a good strategy for the case code, an interface definition can easily overwhelm our ability to grow and maintain the code. A good strategy will allow us to...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Standards and Technical Documents
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.