There are only four numbers in computer programs:
0, 1, many, "a zillion"
If you have 2 or more of anything, you are, in general, better off using loops to process many of them.
But what is "a zillion?"
Zillion is a made-up number. Your system cannot hold a zillion items in memory. It cannot show a zillion items on the screen.
Doesn't work for "a zillion":
Select employee name:
Doesn't work for "a zillion":
def handleFiles( filenames: Array[String] ) {
val results = openFiles(filenames).readAll().processAll()
results
}
* The program first opens all the files, and then processes them. The OS will run out of file handles.
Doesn't work for "a zillion":
Changing software from handling "many" to "a zillion" is hard if the program is already written.
Decide when you need to handle a zillion.
Comments