Download presentation
Presentation is loading. Please wait.
1
Five Guidelines for Robust Reusable Code
Code Optimization Five Guidelines for Robust Reusable Code 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 1
2
Code Optimization: Yvonne V. Richardson, BSCS, M. Ed
Five Major Concepts Modularity Maintainability Re-usability Robustness 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 2
3
Code Optimization: Yvonne V. Richardson, BSCS, M. Ed
Five Major Concepts Use the MVC Model Respect the Task-Method Correspondence Pass Few Parameters Declare Variables Locally Minimize Scope of Method Calls 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 3
4
Code Optimization Guideline 1
Use the MVC model to organize program code Model - default View - user interaction Controller - main 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 4
5
Code Optimization Guideline 2
One method, one task One task, one method 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 5
6
Code Optimization Guideline 3
Do not pass values to a method if it does not use them Affects both the calling and the called module 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 6
7
Code Optimization Guideline 4
Declare variables (and objects) as locally as possible Precondition – local construct – postcondition Top of the class or method is reasonable and traditional 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 7
8
Code Optimization Guideline 5
Call methods (and objects) as low as possible Stay within the MVC model Scope affects object life 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 8
9
Code Optimization: Yvonne V. Richardson, BSCS, M. Ed
Summary Use the MVC Model Respect the Task-Method Correspondence Pass Few Parameters Declare Variables Locally Minimize Scope of Method Calls 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 9
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.