{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

05-functions - ENG 1D04 Fall 2010 05 Functions Dr William M...

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

View Full Document Right Arrow Icon
ENG 1D04 Fall 2010 05 Functions Dr. William M. Farmer and Dr. Spencer Smith Faculty of Engineering, McMaster University 16 October 2010
Image of page 1

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

View Full Document Right Arrow Icon
Outline 1. Administrative details. 2. Review. 3. Functions. 4. Name spaces and scoping. 5. The principle of least privilege. 6. Demo. 7. Advice. 8. Work plan for next week. W. M. Farmer and S. Smith ENG 1D04 Fall 2010: 05 Functions 2/18
Image of page 2
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
Image of page 3

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

View Full Document Right Arrow Icon
Advice 1. Learn from your fellow students! Get advice and studying tips from those who are doing well in the course. Get other students to review your code. Form study groups. Use Avenue to Learn to discuss solutions to the textbook exercises. 2. Ask questions! Don’t be afraid to ask questions or worry about looking stupid. The instructor, IIs, and TAs welcome questions. The other students will usually benefit from your questions just as much as you. Post questions on Avenue to Learn. W. M. Farmer and S. Smith ENG 1D04 Fall 2010: 05 Functions 4/18
Image of page 4
Review 1. Objects. 2. Graphics. 3. Donald Knuth. W. M. Farmer and S. Smith ENG 1D04 Fall 2010: 05 Functions 5/18
Image of page 5

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

View Full Document Right Arrow Icon
Problem: Code Duplication Problem : Duplication of code in a program is usually bad because it can make the program: Long and verbose. Expensive to maintain. Hard to understand. Hard to reuse. Solution : Replace similar pieces of code by modular code units (Theme 3). Examples : Modules. Classes. Functions. W. M. Farmer and S. Smith ENG 1D04 Fall 2010: 05 Functions 6/18
Image of page 6
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).
Image of page 7

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

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern