The examples you have seen so far in this chapter show iteration over small data: strings and lists that are hard-coded into the program. In the next chapter, you are going to learn how to read from files. Reading from files gives a programmer access to much larger data sets that can be iterated over. In addition to reading from static files, there are also ways to read from live data streams, such as wind sensor data from a weather station or all the Twitter posts with a given hashtag. With the ability to iterate, programmers have the ability to make computers do massive amounts of computation and this enables things that were not really possible before because it takes people much longer to do things than computers.
One of the early ways iteration was used became powerful was for βmail mergeβ. This allowed a computer to take a list of names and addresses, and print out letters addressed to everyone on the list. This meant that a company could send letters to huge lists of people (such as to every address in a cityβs phonebook), something that would have been nearly impossible for an administrative clerk to do prior to computers being standard office equipment. The introduction of iteration by computer changed things. Iteration and mail merge made it possible for people to reach a wider audience by mailing out letters. You can think of this as the original email spam! Like any tool, iteration can be used for good (sending out information about a blood donation clinic) or evil (spreading disinformation about a political candidate).
The ability to iterate over large sets of data introduces ethical issues. Just because a for loop allows you to do something doesnβt mean you should. Consider the following sets of large data:
For each list above, can you think of a good reason to iterate through the list? What might you do with that information that would be good for humanity? What might someone do with that list that would cause harm? One thing to keep in mind is that almost all of these data are incomplete and have inaccuracies - it is inevitable that in a large set of data, there are errors. What would be the consequences to someone if the data about them in a list was erroneous? Itβs also often unclear who owns the information stored in such lists, and there is increasingly a price tag and market associated with this data.
What would you do if the company you worked for asked you to write code that would iterate over a list and do something with the data that you thought was unethical? Who owns the data in the list? Is it data that you should even have access to? Is the data about someone? If so, do they know your company has that data and do you have permission to use it? As a programmer, you have an ethical responsibility to think about the impacts your code will have on people and to refuse to engage in developing software that will cause harm.
Imagine you are working on designing a webpage as a developer at a banking company. You have access to everyoneβs accounts and how much money they have saved. With the push of a button you can search through thousands of accounts and find out how much money your best friend has saved up, your teacher, even your boss, no one would even know you looked. You take a peek and canβt wait to tell your friend how much money your old teacher has. Is it legal or ethical for you to share what youβve seen in their data?
Computer Scientists arenβt bound by HIPAA or anything like that but it certainly is not ethical to go snooping in data that you donβt need to be in.
Itβs legal but itβs unethical. I should know better than to snoop in peopleβs private data.
With more data, comes more resposibility. There are actually no laws that stop you from snooping or telling a friend (unless your work contract says otherwise) but nothing about doing so is ethically sound.
Itβs illegal but my friend is sworn to secrecy so itβs okay to share the gossip
Itβs actually not illegal. Computer Scientists wield a lot of power around data and we donβt have a universal standard like HIPAA to protect sensitive information.
Itβs illegal and unethical. I donβt want to go to jail or get fired.
Itβs actually not illegal. Computer Scientists wield a lot of power around data and we donβt have a universal standard like HIPAA to protect sensitive information.