tailieunhanh - CRC.Press A Guide to MATLAB Object Oriented Programming May.2007 Episode 1 Part 3

Tham khảo tài liệu ' a guide to matlab object oriented programming episode 1 part 3', kỹ thuật - công nghệ, cơ khí - chế tạo máy phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 14 A Guide to MATLAB Object-Oriented Programming and conventions. The use of common styles and conventions is highly correlated with improvements in quality. Imagine writing code in an environment where every variable is global. Now imagine trying to reuse a module. Reuse is difficult because every line of code depends on the same set of variable names. The first step toward improving reuse defines functions with formal parameters and local variables. The formal function definition creates a user interface that controls a client s use of the function. The function interface also hides local variables thus preventing unintentional side effects. Client code no longer depends on the syntax of the function module and vice versa. With function definitions we protect the integrity of our functions. With object-oriented programming and encapsulation we can take the next step create a user interface that controls the use of data. The encapsulation interface divides data into public and private elements. Client code can use and thus depend on public elements however clients cannot create a dependency on private elements. Object-oriented rules enforce the integrity of the encapsulation and thus reduce dependency. The improvement in reuse from data encapsulation is equal in importance to improvements gained from using function definitions and local variables. The proliferation of MATLAB toolboxes demonstrates that reuse is valuable. The fact that many toolboxes aren t object-oriented indicates that reuse like reliability does not depend on a particular development approach. Some development methods are more reuse friendly compared to others. Indeed designing for reuse with the traditional approach requires an exceptional level of expertise. By contrast object-oriented development includes certain design elements that allow code to adapt to reuse more easily. Encapsulation also known as information hiding is the main element. Using a commercial toolbox is one thing but .

TỪ KHÓA LIÊN QUAN