05-functions[1] - ENG 1D04 Fall 2010 05 Functions Dr....

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ENG 1D04 Fall 2010 05 Functions Dr. William M. Farmer and Dr. Spencer Smith Faculty of Engineering, McMaster University 26 October 2010 Outline 1. Administrative details. 2. Advice. 3. Review. 4. Functions. 5. Name spaces and scoping. 6. The principle of least privilege. 7. Demo. 8. Work plan for next week. W. M. Farmer and S. Smith ENG 1D04 Fall 2010: 05 Functions 2/18 Administrative Details 1. Discuss the programming exercises on Avenue. 2. Discuss the extra help topics on Avenue. W. M. Farmer and S. Smith ENG 1D04 Fall 2010: 05 Functions 3/18 Advice 1. Learn from your fellow students! I Get advice and studying tips from those who are doing well in the course. I Get other students to review your code. I Form study groups. I Use Avenue to Learn to discuss solutions to the textbook exercises. 2. Ask questions! I Dont be afraid to ask questions or worry about looking stupid. I The instructor, IIs, and TAs welcome questions. I The other students will usually benefit from your questions just as much as you. I Post questions on Avenue to Learn. W. M. Farmer and S. Smith ENG 1D04 Fall 2010: 05 Functions 4/18 Review 1. Objects. 2. Graphics. 3. Donald Knuth. W. M. Farmer and S. Smith ENG 1D04 Fall 2010: 05 Functions 5/18 Problem: Code Duplication Problem : Duplication of code in a program is usually bad because it can make the program: I Long and verbose. I Expensive to maintain. I Hard to understand. I Hard to reuse. Solution : Replace similar pieces of code by modular code units (Theme 3). Examples : I Modules. I Classes. I Functions. W. M. Farmer and S. Smith ENG 1D04 Fall 2010: 05 Functions 6/18 Mathematical Functions Functions are the one of the most fundamental values in mathematics and computing. Definition 1 : A function is a rule f : I O that associates members of I (inputs) with members of O (outputs)....
View Full Document

Page1 / 18

05-functions[1] - ENG 1D04 Fall 2010 05 Functions Dr....

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online