48024 Lecture Notes - Lecture 3: Code Reuse

39 views1 pages
5 Jun 2018
School
Department
Course
Professor
Study 3: Process
Procedural Programming
Breaking up the program into different procedures
Each sub goal does into their own method.
Start with the main method/procedure.
Code reuse is the main benefit of splitting code into small methods.
Process #1 Key/Framework Approach
Goal what a program should achieve
Plan Steps to achieve a goal (English, patterns to use)
Key key line of code that most directly achieves the goal.
The framework is whatever code supports the key. Can be replaced depending on
where the information source is coming back.
Process #2 Incremental Goals
Used to tackle really large processes.
Simplify goal then add to the goal incrementally until the whole goal is tackled.
Integer Division
No decimal places. Rounds down
The % operator, odulus, gives the reaider fro a divisio operatio. To
extract digits from a number:
o The last digit of a number is:
Number % 10
o To remove the last digit:
Number / 10
o To obtain the first digit of an N-digit number:
Number / 10 … n-1 times
o To obtain a digit somewhere in the middle, combine:
/10 and %10
Testing
Dot test every possible iput
Devise a finite set of cases that are representative of all scenarios.
o Middle cases
o Edge cases
o Off by Oe errors
o Invalid Inputs
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 1 pages and 3 million more documents.

Already have an account? Log in

Document Summary

Procedural programming: breaking up the program into different procedures, each sub goal does into their own method, start with the main method/procedure, code reuse is the main benefit of splitting code into small methods. Can be replaced depending on where the information source is coming back. Process #2 incremental goals: used to tackle really large processes, simplify goal then add to the goal incrementally until the whole goal is tackled. Rounds down: the (cid:858)%(cid:859) operator, (cid:862)(cid:373)odulus(cid:863), gives the re(cid:373)ai(cid:374)der fro(cid:373) a divisio(cid:374) operatio(cid:374). Testing: do(cid:374)(cid:859)t test every possible i(cid:374)put, devise a finite set of cases that are representative of all scenarios, middle cases, edge cases, (cid:862)off by o(cid:374)e(cid:863) errors.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents