3. Functions - CS2030S Programming Methodology II
Another important abstraction provided by a programming language is the function (or procedure). This abstraction allows programmers to group a set of instructions and give it a name. The named set of instructions may take one or more variables as input parameters, and return one or more values. Like all other abstractions, defining functions allow us to think at a higher conceptual level. By composing functions at increasingly higher level of abstractions, we can build programs with increasing level of complexity. Functions help us deal with complexity in a few ways: Functions allow programmers to compartmentalize computation and its effects. We can isolate the complexity to within its body: the intermediate variables exists only as local variables that has no effect outside of the function. A function only interacts with the rest of the code through its parameters and return value, and so, reduces the dependencies between variables to these well-defined interactions. Such compartment
Unit 3: Functions After reading this unit, students should understand the importance of function as a programming constructor and how it helps to reduce complexity and mitigate bugs. be aware of two different roles a programmer can play: the implementer and the client understand the concept of abstraction barrier as a wall between the client and the implementer, including in the context of a function. Function as an Abstraction over Computation Another important abstraction provided by a programming language is the function (or procedure). This abstraction allows programmers to group a…
saved by
related reading
- 4. Encapsulation - CS2030S Programming Methodology IInus-cs2030s.github.io
- 2. Variable and Type - CS2030S Programming Methodology IInus-cs2030s.github.io
- 17. Abstract Class - CS2030S Programming Methodology IInus-cs2030s.github.io
- 22. Exception - CS2030S Programming Methodology IInus-cs2030s.github.io
- Critically Conscious Computing: Methods for Secondary Educationcriticallyconsciouscomputing.org
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu
- CSC 151 - Anonymous procedureseikmeier.sites.grinnell.edu
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu
- CSC 151 - Documenting Your Codeeikmeier.sites.grinnell.edu
- How to write the perfect functionyoutube.com