posted 5 years ago
While preparing for an upcoming Coursera course (Introduction to Algorithms) I came across this statement in the text
Bold mine.
The part in bold stumped me. Can someone walk me through that statement?
For example, the main() static method in our programs has a void return type
because its purpose is to produce output. Technically, void methods do not
implement mathematical functions (and neither does Math.random(), which
takes no arguments but does produce a return value).
 p. 24 Algorithms (4e), Sedgewick & Wayne
Bold mine.
The part in bold stumped me. Can someone walk me through that statement?
posted 5 years ago
 1
The strict interpretation of a function is that basically, you give it some input (like 90 degrees), and you get some new value out  like 1. For any given input, there is exactly one possible output.
Since a method of type void does not give you back a return value, it does not fit the definition of a mathematical function.
Since a method of type void does not give you back a return value, it does not fit the definition of a mathematical function.
There are only two hard things in computer science: cache invalidation, naming things, and offbyone errors
posted 5 years ago
Ah, yes. Thank you, both.
I was missing the computer science specific definition of the word "implement."
I thought we were about to get into a deep discussion about design theory.
I was missing the computer science specific definition of the word "implement."
I thought we were about to get into a deep discussion about design theory.
A day job? In an office? My worst nightmare! Comfort me tiny ad!
The WEB SERVICES and JAXRS Course
https://coderanch.com/t/690789/WEBSERVICESJAXRS
