How I Built Software to Kill People

A presentation at RubyConf Kenya in June 2018 in Nairobi, Kenya by Caleb Hearth

Slide 1

Slide 1

These slides intentionally left blank. Yes, I know these slides are blank. No, they’re not broken. 
 


Slide 2

Slide 2

These slides intentionally left blank. Yes, I know these slides are blank. No, they’re not broken. 
 


Slide 3

Slide 3

How I Built Software to Kill People A cautionary tale by @calebthompson I’ve been a developer for about ten years, have a degree in SWE, and have worked with all sorts of businesses and customers in web and native development, including now where I work at Heroku. I’m going to tell you about how I took a job building software to kill people.

Slide 4

Slide 4

But don't get distracted by that; I didn't know at the time.

Slide 5

Slide 5

Even before I'd walked across the stage for graduation, I accepted an offer for an internship. I'd be joining a contracting company for the Department of Defense, or DOD. That’s the part of the government made up by the military in the United States. The DOD outsources all sorts of things, from P-8A Multi-mission Maritime aircraft to blue, shade 451, Poly/wool cloth. They also outsource a lot of software projects.

Slide 6

Slide 6

At the time, I thought nothing of the fact that I'd be supporting the military. Even if I had, they're the good folks right? My dad was in the military. So was my grandfather. I have great respect for those in the military. It was good money, a great opportunity, and a close friend of mine had gotten me the gig. Life was good.

Slide 7

Slide 7

I joined the team after they'd already gotten started on the project. The gist of what we were building was an app that look at how WiFi signal strength changed as your phone moved around. If the signal strength got stronger, you were getting closer. If it got weaker, you were moving away. To find them, we'd collect two pieces of information for each wifi access point in range. The phone's location information and the WiFi signal strength.

Slide 8

Slide 8

It seemed pretty cool compared to what I'd built to up that point. The most complicated thing I’d created was an inventory management system. The app didn't concern itself overmuch with persistence or databases. Who needs to stop and restart a program anyhow? The data was right there in memory and if you forgot how many Aerosmith CDs you had, who cares?

Slide 9

Slide 9

Honestly, the idea of finding WiFi routers based on the signal strength seemed pretty intimidating at the time. The idea impressed me.

Slide 10

Slide 10

But don't get distracted by all this; the software was intended to kill people.

Slide 11

Slide 11

To predict the actual location of the WiFi signal, we used a convolution of two algorithms. This is going to get math-y and technical but don’t worry too much about understanding things.

Both of them relied on the Free Space Path Loss equation. For our purposes, FSPL calculates how far away a phone is from a WiFi signal based on loss in signal strength. It assumes that there is only empty air, or "free space", between the access point and the phone.

Slide 12

Slide 12

R 2 ⌘ 1 � P i ( y i � f i ) 2 P i ( y i � ¯ y ) 2 <latexit sha1_base64="uV6A8sEfYhhvheNCvWMQJDteJSA=">AAACO3icdVDLSgMxFL3js9ZX1aWbYBF0YZkpPuqu6salirVCp5ZMmrHBzMMkIwxh/suN4De4ENy4caGIW/dmWgUVvZDL4Zxzk9zjxZxJZdsP1tDwyOjYeGGiODk1PTNbmps/kVEiCG2QiEfi1MOSchbShmKK09NYUBx4nDa9i71cb15RIVkUHqs0pu0An4fMZwQrQ3VKR0dnupq59DJhV8hZ09qVSYA6mmUrad7X/Lyv5qYMuZG5Cv12aNfDAuk0+7R1SmW7sm1v1tbXUQ62bKeGBoyzgZyK3a9yfef++BYADjqlO7cbkSSgoSIcS9ly7Fi1NRaKEU6zoptIGmNygc9py8AQB1S2dX/3DC0bpov8SJgTKtRnv09oHEiZBp5xBlj15G8tJ//SWonya23NwjhRNCSDh/yEIxWhPEjUZYISxVMDMBHM/BWRHhaYKBN30YTwtSn6H5xUK45dcQ5NGrswqAIswhKsgANbUId9OIAGELiGR3iGF+vGerJerbeBdcj6nFmAH2W9fwAZNbGh</latexit> <latexit sha1_base64="F9nzIegExF7ioCCnhMI4xCYEaFE=">AAACO3icdVDLSgMxFM34rPVVdekmWARdWGak2rqrunFZxdZCp5ZMmrHBzMMkUxjC/Ja60J9wIbhx40IRF27cm2kVtOiFXA7nnJvkHidkVEjTfDBGRsfGJyYzU9npmdm5+dzCYl0EEcekhgMW8IaDBGHUJzVJJSONkBPkOYycOOf7qX7SI1zQwD+WcUhaHjrzqUsxkppq546OTtVmYpOLiPagtaGULSIPthVN1uK0b7hpX09NCbQDfRUcdijbQRyqOPmytXN5s7BjbpeLRZiCkmmV4YCxtqBVMPuVr+zeH9+8X15V27k7uxPgyCO+xAwJ0bTMULYU4pJiRpKsHQkSInyOzkhTQx95RLRUf/cErmqmA92A6+NL2Gd/TijkCRF7jnZ6SHbFsJaSf2nNSLrllqJ+GEni48FDbsSgDGAaJOxQTrBksQYIc6r/CnEXcYSljjurQ/jeFP4P6psFyyxYhzqNPTCoDFgGK2ANWKAEKuAAVEENYHANHsEzeDFujSfj1XgbWEeMr5kl8KuMj088ebP6</latexit> <latexit sha1_base64="F9nzIegExF7ioCCnhMI4xCYEaFE=">AAACO3icdVDLSgMxFM34rPVVdekmWARdWGak2rqrunFZxdZCp5ZMmrHBzMMkUxjC/Ja60J9wIbhx40IRF27cm2kVtOiFXA7nnJvkHidkVEjTfDBGRsfGJyYzU9npmdm5+dzCYl0EEcekhgMW8IaDBGHUJzVJJSONkBPkOYycOOf7qX7SI1zQwD+WcUhaHjrzqUsxkppq546OTtVmYpOLiPagtaGULSIPthVN1uK0b7hpX09NCbQDfRUcdijbQRyqOPmytXN5s7BjbpeLRZiCkmmV4YCxtqBVMPuVr+zeH9+8X15V27k7uxPgyCO+xAwJ0bTMULYU4pJiRpKsHQkSInyOzkhTQx95RLRUf/cErmqmA92A6+NL2Gd/TijkCRF7jnZ6SHbFsJaSf2nNSLrllqJ+GEni48FDbsSgDGAaJOxQTrBksQYIc6r/CnEXcYSljjurQ/jeFP4P6psFyyxYhzqNPTCoDFgGK2ANWKAEKuAAVEENYHANHsEzeDFujSfj1XgbWEeMr5kl8KuMj088ebP6</latexit> <latexit sha1_base64="TlDf1W5SPBOARhLlfPKdsAl9Zbg=">AAACO3icdVDLSgMxFM34rPU16tJNsAh10ZIRH3VXdONSxT6gU0smzWho5mGSEYYw/+XGn3Dnxo0LRdy6N9NW0KIXcjmcc26Se7yYM6kQerKmpmdm5+YLC8XFpeWVVXttvSmjRBDaIBGPRNvDknIW0oZiitN2LCgOPE5b3uAk11t3VEgWhZcqjWk3wNch8xnBylA9++LiSu9mLr1N2B10Klq7MglgT7OsnOa94ud9Jzdl0I3MVXDSoV0PC6jTbGzr2SVUPUIHtb09mIND5NTgiHH2oVNFwyqBcZ317Ee3H5EkoKEiHEvZcVCsuhoLxQinWdFNJI0xGeBr2jEwxAGVXT3cPYPbhulDPxLmhAoO2Z8TGgdSpoFnnAFWN3JSy8m/tE6i/FpXszBOFA3J6CE/4VBFMA8S9pmgRPHUAEwEM3+F5AYLTJSJu2hC+N4U/g+au1UHVZ1zVKofj+MogE2wBcrAAYegDk7BGWgAAu7BM3gFb9aD9WK9Wx8j65Q1ntkAv8r6/ALVbq82</latexit> The first algorithm was R^2. It measured the difference between the signal strength we'd observed and the expected signal strength at each distance in a search grid. Locations with the lowest R^2 error rate were the most likely to be the source of the WiFi signal.

Slide 13

Slide 13

h

✓ 4ˆ � 5 3 n ◆ 1 5 ⇡ 1 . 06 ˆ � n � 1 / 5 , <latexit sha1_base64="RtGGtO8ILOPIq2pyroW4mEk+qu0=">AAACRnicdVBNixMxGH6nfq31q+rRS3ARVtCa0Xa3HoRVLx5XsLsLnWnJpJlO2ExmSN4RS8iv8id48ezNm1cvHhTxaqajsIo+EHh4PkjyZLWSFin9GPXOnD13/sLWxf6ly1euXhtcv3Foq8ZwMeWVqsxxxqxQUospSlTiuDaClZkSR9nJ89Y/ei2MlZV+hetapCVbaZlLzjBIi0FakCckUSLHnSQ3jLtRUjB0iZWrkvn52LtH2idGrgq8O3ddJPZu7D1JWF2b6g2Jh3SXnG4RPXf34wdjf28x2KbDx3R3MhqRluzReEI6JR63xQ2295/St58A4GAx+JAsK96UQiNXzNpZTGtMHTMouRK+nzRW1IyfsJWYBapZKWzqNjN4cicoS5JXJhyNZKOebjhWWrsus5AsGRb2b68V/+XNGswnqZO6blBo3l2UN4pgRdpNyVIawVGtA2HcyPBWwgsWpsKwfD+M8Pun5P/k8OEwpsP4ZVjjGXTYgltwG3Yghj3YhxdwAFPg8A4+w1f4Fr2PvkTfox9dtBf96tyEP9CDn6ofs3c=</latexit> <latexit sha1_base64="50AFhZ12WguaQSaO7crJI4F5CK8=">AAACRnicdVC9bxMxHPWFrxK+0nZksagqFQmCDUmbDkgFFsYikbZS7hL5HF/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/op9ttBP97myiP9BBvwBNVrSx</latexit> <latexit sha1_base64="7ddxkNEdCFac8KSYj1fgOIzuhVI=">AAACRnicdVDNaxQxHM2sVev6tdWjl9BFqKBrorvtehCKvXhswW0LO7NLJpvZCc1khuQ3xSXkr/PSc2/+CV48KNKrmd0tVNEHgcf7IMlLKyUtEPI1at3auH3n7ua99v0HDx897mw9ObZlbbgY8VKV5jRlViipxQgkKHFaGcGKVImT9Oyg8U/OhbGy1J9gUYmkYHMtM8kZBGnaSXL8HsdKZLATZ4Zx149zBi62cl4wPxl491b72Mh5Di8mbhWh3g28xzGrKlN+xrRHdvHNFtYT94q+HviX006X9N6R3WG/jxuyR+gQrxQ6aIpLdNEah9POZTwreV0IDVwxa8eUVJA4ZkByJXw7rq2oGD9jczEOVLNC2MQtZ/D4eVBmOCtNOBrwUr3ZcKywdlGkIVkwyO3fXiP+yxvXkA0TJ3VVg9B8dVFWKwwlbjbFM2kEB7UIhHEjw1sxz1mYCsLy7TDC9U/x/8nxmx4lPXpEuvsf1nNsomdoG+0givbQPvqIDtEIcfQFfUM/0M/oIvoe/YquVtFWtO48RX+ghX4Dm7yxMw==</latexit> We'd combine that calculation with a Gaussian estimate. It was a graph of the sum of two bell curves: probabilities that a signal was originating at given distances. The first was negative and said “you’re probably not trying to find a signal if you’re standing next to it” and the second was positive and said “this is the most likely distance for the signal to originate”

The algorithm adjusted the width and height of these two curves by consulting past measurements. It created a heat map of probabilities for the signal source.

Slide 14

Slide 14

R 2 ⌘ 1 � P i ( y i � f i ) 2 P i ( y i � ¯ y ) 2 <latexit sha1_base64="uV6A8sEfYhhvheNCvWMQJDteJSA=">AAACO3icdVDLSgMxFL3js9ZX1aWbYBF0YZkpPuqu6salirVCp5ZMmrHBzMMkIwxh/suN4De4ENy4caGIW/dmWgUVvZDL4Zxzk9zjxZxJZdsP1tDwyOjYeGGiODk1PTNbmps/kVEiCG2QiEfi1MOSchbShmKK09NYUBx4nDa9i71cb15RIVkUHqs0pu0An4fMZwQrQ3VKR0dnupq59DJhV8hZ09qVSYA6mmUrad7X/Lyv5qYMuZG5Cv12aNfDAuk0+7R1SmW7sm1v1tbXUQ62bKeGBoyzgZyK3a9yfef++BYADjqlO7cbkSSgoSIcS9ly7Fi1NRaKEU6zoptIGmNygc9py8AQB1S2dX/3DC0bpov8SJgTKtRnv09oHEiZBp5xBlj15G8tJ//SWonya23NwjhRNCSDh/yEIxWhPEjUZYISxVMDMBHM/BWRHhaYKBN30YTwtSn6H5xUK45dcQ5NGrswqAIswhKsgANbUId9OIAGELiGR3iGF+vGerJerbeBdcj6nFmAH2W9fwAZNbGh</latexit> <latexit sha1_base64="F9nzIegExF7ioCCnhMI4xCYEaFE=">AAACO3icdVDLSgMxFM34rPVVdekmWARdWGak2rqrunFZxdZCp5ZMmrHBzMMkUxjC/Ja60J9wIbhx40IRF27cm2kVtOiFXA7nnJvkHidkVEjTfDBGRsfGJyYzU9npmdm5+dzCYl0EEcekhgMW8IaDBGHUJzVJJSONkBPkOYycOOf7qX7SI1zQwD+WcUhaHjrzqUsxkppq546OTtVmYpOLiPagtaGULSIPthVN1uK0b7hpX09NCbQDfRUcdijbQRyqOPmytXN5s7BjbpeLRZiCkmmV4YCxtqBVMPuVr+zeH9+8X15V27k7uxPgyCO+xAwJ0bTMULYU4pJiRpKsHQkSInyOzkhTQx95RLRUf/cErmqmA92A6+NL2Gd/TijkCRF7jnZ6SHbFsJaSf2nNSLrllqJ+GEni48FDbsSgDGAaJOxQTrBksQYIc6r/CnEXcYSljjurQ/jeFP4P6psFyyxYhzqNPTCoDFgGK2ANWKAEKuAAVEENYHANHsEzeDFujSfj1XgbWEeMr5kl8KuMj088ebP6</latexit> <latexit sha1_base64="F9nzIegExF7ioCCnhMI4xCYEaFE=">AAACO3icdVDLSgMxFM34rPVVdekmWARdWGak2rqrunFZxdZCp5ZMmrHBzMMkUxjC/Ja60J9wIbhx40IRF27cm2kVtOiFXA7nnJvkHidkVEjTfDBGRsfGJyYzU9npmdm5+dzCYl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D4eVBmOCtNOBrwUr3ZcKywdlGkIVkwyO3fXiP+yxvXkA0TJ3VVg9B8dVFWKwwlbjbFM2kEB7UIhHEjw1sxz1mYCsLy7TDC9U/x/8nxmx4lPXpEuvsf1nNsomdoG+0givbQPvqIDtEIcfQFfUM/0M/oIvoe/YquVtFWtO48RX+ghX4Dm7yxMw==</latexit> We'd normalize the two algorithm’s probabilities for each location in the search grid. The combination of probabilities was more correct than either algorithm itself.

Slide 15

Slide 15

R 2 ⌘ 1 � P i ( y i � f i ) 2 P i ( y i � ¯ y ) 2 <latexit sha1_base64="uV6A8sEfYhhvheNCvWMQJDteJSA=">AAACO3icdVDLSgMxFL3js9ZX1aWbYBF0YZkpPuqu6salirVCp5ZMmrHBzMMkIwxh/suN4De4ENy4caGIW/dmWgUVvZDL4Zxzk9zjxZxJZdsP1tDwyOjYeGGiODk1PTNbmps/kVEiCG2QiEfi1MOSchbShmKK09NYUBx4nDa9i71cb15RIVkUHqs0pu0An4fMZwQrQ3VKR0dnupq59DJhV8hZ09qVSYA6mmUrad7X/Lyv5qYMuZG5Cv12aNfDAuk0+7R1SmW7sm1v1tbXUQ62bKeGBoyzgZyK3a9yfef++BYADjqlO7cbkSSgoSIcS9ly7Fi1NRaKEU6zoptIGmNygc9py8AQB1S2dX/3DC0bpov8SJgTKtRnv09oHEiZBp5xBlj15G8tJ//SWonya23NwjhRNCSDh/yEIxWhPEjUZYISxVMDMBHM/BWRHhaYKBN30YTwtSn6H5xUK45dcQ5NGrswqAIswhKsgANbUId9OIAGELiGR3iGF+vGerJerbeBdcj6nFmAH2W9fwAZNbGh</latexit> <latexit sha1_base64="F9nzIegExF7ioCCnhMI4xCYEaFE=">AAACO3icdVDLSgMxFM34rPVVdekmWARdWGak2rqrunFZxdZCp5ZMmrHBzMMkUxjC/Ja60J9wIbhx40IRF27cm2kVtOiFXA7nnJvkHidkVEjTfDBGRsfGJyYzU9npmdm5+dzCYl0EEcekhgMW8IaDBGHUJzVJJSONkBPkOYycOOf7qX7SI1zQwD+WcUhaHjrzqUsxkppq546OTtVmYpOLiPagtaGULSIPthVN1uK0b7hpX09NCbQDfRUcdijbQRyqOPmytXN5s7BjbpeLRZiCkmmV4YCxtqBVMPuVr+zeH9+8X15V27k7uxPgyCO+xAwJ0bTMULYU4pJiRpKsHQkSInyOzkhTQx95RLRUf/cErmqmA92A6+NL2Gd/TijkCRF7jnZ6SHbFsJaSf2nNSLrllqJ+GEni48FDbsSgDGAaJOxQTrBksQYIc6r/CnEXcYSljjurQ/jeFP4P6psFyyxYhzqNPTCoDFgGK2ANWKAEKuAAVEENYHANHsEzeDFujSfj1XgbWEeMr5kl8KuMj088ebP6</latexit> <latexit sha1_base64="F9nzIegExF7ioCCnhMI4xCYEaFE=">AAACO3icdVDLSgMxFM34rPVVdekmWARdWGak2rqrunFZxdZCp5ZMmrHBzMMkUxjC/Ja60J9wIbhx40IRF27cm2kVtOiFXA7nnJvkHidkVEjTfDBGRsfGJyYzU9npmdm5+dzCYl0EEcekhgMW8IaDBGHUJzVJJSONkBPkOYycOOf7qX7SI1zQwD+WcUhaHjrzqUsxkppq546OTtVmYpOLiPagtaGULSIPthVN1uK0b7hpX09NCbQDfRUcdijbQRyqOPmytXN5s7BjbpeLRZiCkmmV4YCxtqBVMPuVr+zeH9+8X15V27k7uxPgyCO+xAwJ0bTMULYU4pJiRpKsHQkSInyOzkhTQx95RLRUf/cErmqmA92A6+NL2Gd/TijkCRF7jnZ6SHbFsJaSf2nNSLrllqJ+GEni48FDbsSgDGAaJOxQTrBksQYIc6r/CnEXcYSljjurQ/jeFP4P6psFyyxYhzqNPTCoDFgGK2ANWKAEKuAAVEENYHANHsEzeDFujSfj1XgbWEeMr5kl8KuMj088ebP6</latexit> <latexit sha1_base64="TlDf1W5SPBOARhLlfPKdsAl9Zbg=">AAACO3icdVDLSgMxFM34rPU16tJNsAh10ZIRH3VXdONSxT6gU0smzWho5mGSEYYw/+XGn3Dnxo0LRdy6N9NW0KIXcjmcc26Se7yYM6k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i7JaYShxsymeSyM4qGUgjBsZ3op5zsJUEJbvhhHOf4r/T44e9ynp01dhjeeoxRq6i+6hHUTRHjpAL9EhGiOO3qMv6Bv6Hn2IvkY/op9ttBP97myiP9BBvwBNVrSx</latexit> <latexit sha1_base64="7ddxkNEdCFac8KSYj1fgOIzuhVI=">AAACRnicdVDNaxQxHM2sVev6tdWjl9BFqKBrorvtehCKvXhswW0LO7NLJpvZCc1khuQ3xSXkr/PSc2/+CV48KNKrmd0tVNEHgcf7IMlLKyUtEPI1at3auH3n7ua99v0HDx897mw9ObZlbbgY8VKV5jRlViipxQgkKHFaGcGKVImT9Oyg8U/OhbGy1J9gUYmkYHMtM8kZBGnaSXL8HsdKZLATZ4Zx149zBi62cl4wPxl491b72Mh5Di8mbhWh3g28xzGrKlN+xrRHdvHNFtYT94q+HviX006X9N6R3WG/jxuyR+gQrxQ6aIpLdNEah9POZTwreV0IDVwxa8eUVJA4ZkByJXw7rq2oGD9jczEOVLNC2MQtZ/D4eVBmOCtNOBrwUr3ZcKywdlGkIVkwyO3fXiP+yxvXkA0TJ3VVg9B8dVFWKwwlbjbFM2kEB7UIhHEjw1sxz1mYCsLy7TDC9U/x/8nxmx4lPXpEuvsf1nNsomdoG+0givbQPvqIDtEIcfQFfUM/0M/oIvoe/YquVtFWtO48RX+ghX4Dm7yxMw==</latexit> If we collected readings while moving in a straight line, we could tell you how far away the WiFi was. If you turned a corner, we could also add direction, so you could find it in 2D space. If you climbed some stairs, we'd show you altitude as well. The technology was the most interesting project I'd ever worked on. It might still be the most interesting.

Slide 16

Slide 16

But don't let that distract you; it was designed to kill people.

Slide 17

Slide 17

I spent a lot of my time pairing on performance improvements to the code. The app worked, but it took about seven minutes to do so. This was partially because we translated code from MatLab, which is optimized for working with matrices of numbers. The Java code we wrote originally used nested loops instead. We're talking quadruply nested here, with some expensive calculations inside.

Slide 18

Slide 18

� � = arctan q (cos � 2 · sin( � � )) 2

  • (cos � 1 · sin � 2 � sin � 1 · cos � 2 · cos( � � )) 2 sin � 1 · sin � 2
  • cos � 1 · cos � 2 · cos( � � ) . <latexit sha1_base64="a8rWboUmcNzLCDepDma0iVeLuIY=">AAAC53ichVLNjtMwEHbC31L+unDkYrFC6mpFlFTLbjkgVcCB4yLR3ZXqUk0cp7XWcYI9QaqivAAXDiDElTfhGbjxBtx4A4TblAoiVoxk6fM3831jexwXSloMw2+ef+HipctXtq52rl2/cfNWd/v2sc1Lw8WI5yo3pzFYoaQWI5SoxGlhBGSxEifx2dNl/uSNMFbm+iUuCjHJYKZlKjmgo6bdn+yZUAjMylkGjxkYjqApSw3witnXBiumRIo9xnPLirmc9hlPcnT1ureWKtctgV1m5GyOu6/6ey1FtFE0Bg82cJ1pWbvtedZ1XbXFG9u9dsP/2tY0mHZ3wuBReDDY36dLcBhGA9ow0UMaBeEqdobDH9+/EEKOpt2vLMl5mQmNXIG14ygscFKBQcmVqDustKIAfgYzMXZQQybspFrNqab3HZPQNDduaaQr9k9FBZm1iyx2lRng3LZzS/JfuXGJ6WBSSV2UKDRvGqWlopjT5dBpIo3gqBYOADfSnZXyObgZo/saHfcIv29KzwfH/SAKg+iFe40npIktcpfcIz0SkUMyJM/JERkR7iXeW++998GX/jv/o/+pKfW9teYO+Sv8z78AqBLw7Q==</latexit> <latexit sha1_base64="bBypDv+Hq6eOHSwTquHX3GRo8wU=">AAAC53ichVLNjtMwEHbC31J+tgsSFy4WC1JXK6Kk2mXLAakCDhwXie6uVJdq6jittY4T7AlSFeUFuHAAIQ5ceA+eghtvwI03QLhNqSBixUiWPn8z3ze2x5NcSYth+M3zz52/cPHSxuXWlavXrm+2t24c2awwXAx4pjJzMgErlNRigBKVOMmNgHSixPHk9Mkif/xaGCsz/QLnuRilMNUykRzQUeP2T/ZUKARm5TSFRwwMR9CUJQZ4yewrgyVTIsEO45ll+UyOu4zHGbp63VlJlesWww4zcjrDnZfd3YYiWitqg/truMo0rN32LOuqKpvite1us+F/bSsajNvbYfAwfNDb26MLcBBGPVoz0T6NgnAZ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6d7/8GxzUvDxYjnKjenMVihpBYjlKjEaWEEZLESJ/HZ62X+5JMwVub6PS4KMclgpmUqOaCjpt2f7I1QCMzKWQYvGRiOoClLDfCK2Y8GK6ZEin3Gc8uKuZwOGE9ydPW630iV65bALjNyNsfdD4O9liLaKNYGTzewybSs3fYq67qu2uKN7V674X9taxpMu70weBE+H+7v0yU4CKMhXTPRMxoF4Sp6pImjafc7S3JeZkIjV2DtOAoLnFRgUHIl6g4rrSiAn8FMjB3UkAk7qVZzqukTxyQ0zY1bGumK/VNRQWbtIotdZQY4t+3ckvxXblxiOpxUUhclCs3XjdJSUczpcug0kUZwVAsHgBvpzkr5HNyM0X2NjnuE3zelV4PjQRCFQfQu7B2+ap5jizwij0mfROSAHJK35IiMCPcS79z77H3xpX/hf/W/rUt9r9E8JH+Ff/kLfGjt1g==</latexit> One such example is calculating distance between two points. We were using great circle distance, which is the way you measure the shortest distance between two points on a sphere, such as Earth. The function performing this calculation was being hit hundreds of thousands of time for each collection point, often with the same two locations. It was a very slow process.

Slide 19

Slide 19

� � = arctan q (cos � 2 · sin( � � )) 2

  • (cos � 1 · sin � 2 � sin � 1 · cos � 2 · cos( � � )) 2 sin � 1 · sin � 2
  • cos � 1 · cos � 2 · cos( � � ) . <latexit sha1_base64="a8rWboUmcNzLCDepDma0iVeLuIY=">AAAC53ichVLNjtMwEHbC31L+unDkYrFC6mpFlFTLbjkgVcCB4yLR3ZXqUk0cp7XWcYI9QaqivAAXDiDElTfhGbjxBtx4A4TblAoiVoxk6fM3831jexwXSloMw2+ef+HipctXtq52rl2/cfNWd/v2sc1Lw8WI5yo3pzFYoaQWI5SoxGlhBGSxEifx2dNl/uSNMFbm+iUuCjHJYKZlKjmgo6bdn+yZUAjMylkGjxkYjqApSw3witnXBiumRIo9xnPLirmc9hlPcnT1ureWKtctgV1m5GyOu6/6ey1FtFE0Bg82cJ1pWbvtedZ1XbXFG9u9dsP/2tY0mHZ3wuBReDDY36dLcBhGA9ow0UMaBeEqdobDH9+/EEKOpt2vLMl5mQmNXIG14ygscFKBQcmVqDustKIAfgYzMXZQQybspFrNqab3HZPQNDduaaQr9k9FBZm1iyx2lRng3LZzS/JfuXGJ6WBSSV2UKDRvGqWlopjT5dBpIo3gqBYOADfSnZXyObgZo/saHfcIv29KzwfH/SAKg+iFe40npIktcpfcIz0SkUMyJM/JERkR7iXeW++998GX/jv/o/+pKfW9teYO+Sv8z78AqBLw7Q==</latexit> <latexit sha1_base64="bBypDv+Hq6eOHSwTquHX3GRo8wU=">AAAC53ichVLNjtMwEHbC31J+tgsSFy4WC1JXK6Kk2mXLAakCDhwXie6uVJdq6jittY4T7AlSFeUFuHAAIQ5ceA+eghtvwI03QLhNqSBixUiWPn8z3ze2x5NcSYth+M3zz52/cPHSxuXWlavXrm+2t24c2awwXAx4pjJzMgErlNRigBKVOMmNgHSixPHk9Mkif/xaGCsz/QLnuRilMNUykRzQUeP2T/ZUKARm5TSFRwwMR9CUJQZ4yewrgyVTIsEO45ll+UyOu4zHGbp63VlJlesWww4zcjrDnZfd3YYiWitqg/truMo0rN32LOuqKpvite1us+F/bSsajNvbYfAwfNDb26MLcBBGPVoz0T6NgnAZ2/3+j+9fbn26ezhuf2VxxotUaOQKrB1GYY6jEgxKrkTVYoUVOfBTmIqhgxpSYUflck4VveeYmCaZcUsjXbJ/KkpIrZ2nE1eZAs5sM7cg/5UbFpj0RqXUeYFC87pRUiiKGV0MncbSCI5q7gBwI91ZKZ+BmzG6r9Fyj/D7pvRscNQNojCInrvXeEzq2CC3yR3SIRE5IH3yjBySAeFe7L3x3nnvfem/9T/4H+tS31tpbpK/wv/8C8CX8b8=</latexit> <latexit sha1_base64="bBypDv+Hq6eOHSwTquHX3GRo8wU=">AAAC53ichVLNjtMwEHbC31J+tgsSFy4WC1JXK6Kk2mXLAakCDhwXie6uVJdq6jittY4T7AlSFeUFuHAAIQ5ceA+eghtvwI03QLhNqSBixUiWPn8z3ze2x5NcSYth+M3zz52/cPHSxuXWlavXrm+2t24c2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t1g==</latexit> We solved that by implementing a hash with keys of location pairs and values of distances between them. It was cheap memoization. This at least meant we didn't re-do those calculations. This and other optimizations we made sped up the performance from seven minutes to a few seconds.

Slide 20

Slide 20

But don't get distracted; that performance increase made it faster to kill people.

Slide 21

Slide 21

The accuracy of the locations wasn't fantastic. I don't remember exactly what it was before we focused on improving this, but an average error about 45 feet, or 14 meters, sticks in my head.

Slide 22

Slide 22

That’s about the length of a shipping container.

Slide 23

Slide 23

That's significant when the wifi range for 802.11n is only about 100 feet or 30 meters. That means we could be up to almost half the range of the router away from where the router actually was.

Slide 24

Slide 24

I talked about the Gaussian estimation, the two curves from the second algorithm. We hard-coded numbers that defined this curve. They were only starting points, but they were starting points every time we made the calculation.

Slide 25

Slide 25

During my software education, I’d learned about a tool I never expected to use in a job. It is called a Genetic Algorithm, and it's a type of machine learning program that produces a set of values that optimize for a desired result. It takes a set of genes - our constants from the gaussian estimation, and looks at how they perform in a fitness function - the location algorithm’s accuracy.

Slide 26

Slide 26

For the dataset of readings I was using in the GA, I knew the actual location of the access points. That meant I could run the geolocation algorithm with each gene’s values in place of the old constants. I could look at the distance between the actual location and the one calculated by the GA-derived values. The shorter the distance, the better the genes were performing.

Slide 27

Slide 27

Doing this a lot of times with a population of genomes, each time making small changes to the top performers and replacing poor performers with new random genes, we can find the top performers across all populations. When the GA ended I could take a look at the values and select the best performer.

Slide 28

Slide 28

I let this genetic algorithm run over the weekend. It was able to increase the accuracy from 40-odd feet to about 10.3 feet, 25% of the error from the original. That is less than the GPS accuracy on the smartphones collecting data. This is too accurate, so it may have been over-optimized against the test data and might not be as accurate against other data sets. This is called overfitting and the way around it is to have separate sets of training and test data.

Slide 29

Slide 29

R 2 ⌘ 1 � P i ( y i � f i ) 2 P i ( y i � ¯ y ) 2 <latexit sha1_base64="uV6A8sEfYhhvheNCvWMQJDteJSA=">AAACO3icdVDLSgMxFL3js9ZX1aWbYBF0YZkpPuqu6salirVCp5ZMmrHBzMMkIwxh/suN4De4ENy4caGIW/dmWgUVvZDL4Zxzk9zjxZxJZdsP1tDwyOjYeGGiODk1PTNbmps/kVEiCG2QiEfi1MOSchbShmKK09NYUBx4nDa9i71cb15RIVkUHqs0pu0An4fMZwQrQ3VKR0dnupq59DJhV8hZ09qVSYA6mmUrad7X/Lyv5qYMuZG5Cv12aNfDAuk0+7R1SmW7sm1v1tbXUQ62bKeGBoyzgZyK3a9yfef++BYADjqlO7cbkSSgoSIcS9ly7Fi1NRaKEU6zoptIGmNygc9py8AQB1S2dX/3DC0bpov8SJgTKtRnv09oHEiZBp5xBlj15G8tJ//SWonya23NwjhRNCSDh/yEIxWhPEjUZYISxVMDMBHM/BWRHhaYKBN30YTwtSn6H5xUK45dcQ5NGrswqAIswhKsgANbUId9OIAGELiGR3iGF+vGerJerbeBdcj6nFmAH2W9fwAZNbGh</latexit> <latexit sha1_base64="F9nzIegExF7ioCCnhMI4xCYEaFE=">AAACO3icdVDLSgMxFM34rPVVdekmWARdWGak2rqrunFZxdZCp5ZMmrHBzMMkUxjC/Ja60J9wIbhx40IRF27cm2kVtOiFXA7nnJvkHidkVEjTfDBGRsfGJyYzU9npmdm5+dzCYl0EEcekhgMW8IaDBGHUJzVJJSONkBPkOYycOOf7qX7SI1zQwD+WcUhaHjrzqUsxkppq546OTtVmYpOLiPagtaGULSIPthVN1uK0b7hpX09NCbQDfRUcdijbQRyqOPmytXN5s7BjbpeLRZiCkmmV4YCxtqBVMPuVr+zeH9+8X15V27k7uxPgyCO+xAwJ0bTMULYU4pJiRpKsHQkSInyOzkhTQx95RLRUf/cErmqmA92A6+NL2Gd/TijkCRF7jnZ6SHbFsJaSf2nNSLrllqJ+GEni48FDbsSgDGAaJOxQTrBksQYIc6r/CnEXcYSljjurQ/jeFP4P6psFyyxYhzqNPTCoDFgGK2ANWKAEKuAAVEENYHANHsEzeDFujSfj1XgbWEeMr5kl8KuMj088ebP6</latexit> <latexit sha1_base64="F9nzIegExF7ioCCnhMI4xCYEaFE=">AAACO3icdVDLSgMxF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ALVbq82</latexit> h

✓ 4ˆ � 5 3 n ◆ 1 5 ⇡ 1 . 06 ˆ � n � 1 / 5 , <latexit sha1_base64="RtGGtO8ILOPIq2pyroW4mEk+qu0=">AAACRnicdVBNixMxGH6nfq31q+rRS3ARVtCa0Xa3HoRVLx5XsLsLnWnJpJlO2ExmSN4RS8iv8id48ezNm1cvHhTxaqajsIo+EHh4PkjyZLWSFin9GPXOnD13/sLWxf6ly1euXhtcv3Foq8ZwMeWVqsxxxqxQUospSlTiuDaClZkSR9nJ89Y/ei2MlZV+hetapCVbaZlLzjBIi0FakCckUSLHnSQ3jLtRUjB0iZWrkvn52LtH2idGrgq8O3ddJPZu7D1JWF2b6g2Jh3SXnG4RPXf34wdjf28x2KbDx3R3MhqRluzReEI6JR63xQ2295/St58A4GAx+JAsK96UQiNXzNpZTGtMHTMouRK+nzRW1IyfsJWYBapZKWzqNjN4cicoS5JXJhyNZKOebjhWWrsus5AsGRb2b68V/+XNGswnqZO6blBo3l2UN4pgRdpNyVIawVGtA2HcyPBWwgsWpsKwfD+M8Pun5P/k8OEwpsP4ZVjjGXTYgltwG3Yghj3YhxdwAFPg8A4+w1f4Fr2PvkTfox9dtBf96tyEP9CDn6ofs3c=</latexit> <latexit sha1_base64="50AFhZ12WguaQSaO7crJI4F5CK8=">AAACRnicdVC9bxMxHPWFrxK+0nZksagqFQmCDUmbDkgFFsYikbZS7hL5HF/Oqs93sn9XEVn+q9hZWJjZGPgDWBhAiBVfjkoFwZMsPb0P2X5ppaQFQj5FnUuXr1y9tna9e+Pmrdt3eusbR7asDRdjXqrSnKTMCiW1GIMEJU4qI1iRKnGcnr5o/OMzYaws9WtYViIp2ELLTHIGQZr1khw/xbESGezEmWHcDeKcgYutXBTMT4fePdE+NnKRw/2payPUu6H3OGZVZco3mPbJLr7YwnrqHtJHQ/9g1tsi/X2yOxoMcEP2CB3hVqHDprjC1sEz8vbz+jt9OOt9jOclrwuhgStm7YSSChLHDEiuhO/GtRUV46dsISaBalYIm7j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28xzGrKlN+xrRHdvHNFtYT94q+HviX006X9N6R3WG/jxuyR+gQrxQ6aIpLdNEah9POZTwreV0IDVwxa8eUVJA4ZkByJXw7rq2oGD9jczEOVLNC2MQtZ/D4eVBmOCtNOBrwUr3ZcKywdlGkIVkwyO3fXiP+yxvXkA0TJ3VVg9B8dVFWKwwlbjbFM2kEB7UIhHEjw1sxz1mYCsLy7TDC9U/x/8nxmx4lPXpEuvsf1nNsomdoG+0givbQPvqIDtEIcfQFfUM/0M/oIvoe/YquVtFWtO48RX+ghX4Dm7yxMw==</latexit> I loved this. Genetic algorithms, R^2, and Gaussian estimation are the kind of thing that they tell you you'll never need to use again once you graduate. But we were using them for a real world project! It was great.

Slide 30

Slide 30

But don't let that distract you; this accuracy made it easier for the software to kill people.

Slide 31

Slide 31

We'd been working with the project owner throughout this process.

Slide 32

Slide 32

Whenever we hit one of these milestones, we'd tell him. He'd be happy about it, but a question always came up. He wanted it to sniff for the signals put out by phones in addition to wifi hotspots. This is a much harder problem from a technical perspective. The functionality necessary to do this is a setting on the wireless network controller. Neither iPhone nor Android supported that option. We'd need to jailbreak or root the phone. The closest solution we ever found was a SourceForge project that seemed promising. We didn't fully understand its use and it wasn't well documented.

Slide 33

Slide 33

We told the project owner that we'd get to it later. None of us thought it was that important: we had the technology to find WiFi Access Points working. That was the goal. Each time we'd demonstrate the new exciting tech we'd built though, the same question came up.

Slide 34

Slide 34

We got wifi hotspots located! Great, does it find phones?

It's taking seconds instead of minutes! Great, does it find phones?

We looked into it finding phones, it seems unlikely but maybe! Ok, we'll come back to it.

Look at this genetic algorithm, it’s so much more accurate now! Great, does it find phones?

I had been distracted.

Slide 35

Slide 35

R 2 ⌘ 1 � P i ( y i � f i ) 2 P i ( y i � ¯ y ) 2 <latexit sha1_base64="uV6A8sEfYhhvheNCvWMQJDteJSA=">AAACO3icdVDLSgMxFL3js9ZX1aWbYBF0YZkpPuqu6salirVCp5ZMmrHBzMMkIwxh/suN4De4ENy4caGIW/dmWgUVvZDL4Zxzk9zjxZxJZdsP1tDwyOjYeGGiODk1PTNbmps/kVEiCG2QiEfi1MOSchbShmKK09NYUBx4nDa9i71cb15RIVkUHqs0pu0An4fMZwQrQ3VKR0dnupq59DJhV8hZ09qVSYA6mmUrad7X/Lyv5qYMuZG5Cv12aNfDAuk0+7R1SmW7sm1v1tbXUQ62bKeGBoyzgZyK3a9yfef++BYADjqlO7cbkSSgoSIcS9ly7Fi1NRaKEU6zoptIGmNygc9py8AQB1S2dX/3DC0bpov8SJgTKtRnv09oHEiZBp5xBlj15G8tJ//SWonya23NwjhRNCSDh/yEIxWhPEjUZYISxVMDMBHM/BWRHhaYKBN30YTwtSn6H5xUK45dcQ5NGrswqAIswhKsgANbUId9OIAGELiGR3iGF+vGerJerbeBdcj6nFmAH2W9fwAZNbGh</latexit> <latexit sha1_base64="F9nzIegExF7ioCCnhMI4xCYEaFE=">AAACO3icdVDLSgMxFM34rPVVdekmWARdWGak2rqrunFZxdZCp5ZMmrHBzMMkUxjC/Ja60J9wIbhx40IRF27cm2kVtOiFXA7nnJvkHidkVEjTfDBGRsfGJyYzU9npmdm5+dzCYl0EEcekhgMW8IaDBGHUJzVJJSONkBPkOYycOOf7qX7SI1zQwD+WcUhaHjrzqUsxkppq546OTtVmYpOLiPagtaGULSIPthVN1uK0b7hpX09NCbQDfRUcdijbQRyqOPmytXN5s7BjbpeLRZiCkmmV4YCxtqBVMPuVr+zeH9+8X15V27k7uxPgyCO+xAwJ0bTMULYU4pJiRpKsHQkSInyOzkhTQx95RLRUf/cErmqmA92A6+NL2Gd/TijkCRF7jnZ6SHbFsJaSf2nNSLrllqJ+GEni48FDbsSgDGAaJOxQTrBksQYIc6r/CnEXcYSljjurQ/jeFP4P6psFyyxYhzqNPTCoDFgGK2ANWKAEKuAAVEENYHANHsEzeDFujSfj1XgbWEeMr5kl8KuMj088ebP6</latexit> <latexit sha1_base64="F9nzIegExF7ioCCnhMI4xCYEaFE=">AAACO3icdVDLSgMxFM34rPVVdekm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xrRHdvHNFtYT94q+HviX006X9N6R3WG/jxuyR+gQrxQ6aIpLdNEah9POZTwreV0IDVwxa8eUVJA4ZkByJXw7rq2oGD9jczEOVLNC2MQtZ/D4eVBmOCtNOBrwUr3ZcKywdlGkIVkwyO3fXiP+yxvXkA0TJ3VVg9B8dVFWKwwlbjbFM2kEB7UIhHEjw1sxz1mYCsLy7TDC9U/x/8nxmx4lPXpEuvsf1nNsomdoG+0givbQPvqIDtEIcfQFfUM/0M/oIvoe/YquVtFWtO48RX+ghX4Dm7yxMw==</latexit> � � = arctan q (cos � 2 · sin( � � )) 2

  • (cos � 1 · sin � 2 � sin � 1 · cos � 2 · cos( � � )) 2 sin � 1 · sin � 2
  • cos � 1 · cos � 2 · cos( � � ) . <latexit sha1_base64="a8rWboUmcNzLCDepDma0iVeLuIY=">AAAC53ichVLNjtMwEHbC31L+unDkYrFC6mpFlFTLbjkgVcCB4yLR3ZXqUk0cp7XWcYI9QaqivAAXDiDElTfhGbjxBtx4A4TblAoiVoxk6fM3831jexwXSloMw2+ef+HipctXtq52rl2/cfNWd/v2sc1Lw8WI5yo3pzFYoaQWI5SoxGlhBGSxEifx2dNl/uSNMFbm+iUuCjHJYKZlKjmgo6bdn+yZUAjMylkGjxkYjqApSw3witnXBiumRIo9xnPLirmc9hlPcnT1ureWKtctgV1m5GyOu6/6ey1FtFE0Bg82cJ1pWbvtedZ1XbXFG9u9dsP/2tY0mHZ3wuBReDDY36dLcBhGA9ow0UMaBeEqdobDH9+/EEKOpt2vLMl5mQmNXIG14ygscFKBQcmVqDustKIAfgYzMXZQQybspFrNqab3HZPQNDduaaQr9k9FBZm1iyx2lRng3LZzS/JfuXGJ6WBSSV2UKDRvGqWlopjT5dBpIo3gqBYOADfSnZXyObgZo/saHfcIv29KzwfH/SAKg+iFe40npIktcpfcIz0SkUMyJM/JERkR7iXeW++998GX/jv/o/+pKfW9teYO+Sv8z78AqBLw7Q==</latexit> <latexit sha1_base64="bBypDv+Hq6eOHSwTquHX3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eYmCaZcUsjXbJ/KkpIrZ2nE1eZAs5sM7cg/5UbFpj0RqXUeYFC87pRUiiKGV0MncbSCI5q7gBwI91ZKZ+BmzG6r9Fyj/D7pvRscNQNojCInrvXeEzq2CC3yR3SIRE5IH3yjBySAeFe7L3x3nnvfem/9T/4H+tS31tpbpK/wv/8C8CX8b8=</latexit> <latexit sha1_base64="RmvxwxTCl5oVk7MWd0wvmc0Wj80=">AAAC53ichVJNbxMxEPUuX234aIAjF4sIKVXFajcqNByQKuDAsUikrRSHaNbrTax6vYs9ixSt9g/00gMIce1f4safQTjJEsGKipEsPb+Z98b2OC6UtBiGPzz/2vUbN29tbXdu37l7b6d7/8GxzUvDxYjnKjenMVihpBYjlKjEaWEEZLESJ/HZ62X+5JMwVub6PS4KMclgpmUqOaCjpt2f7I1QCMzKWQYvGRiOoClLDfCK2Y8GK6ZEin3Gc8uKuZwOGE9ydPW630iV65bALjNyNsfdD4O9liLaKNYGTzewybSs3fYq67qu2uKN7V674X9taxpMu70weBE+H+7v0yU4CKMhXTPRMxoF4Sp6pImjafc7S3JeZkIjV2DtOAoLnFRgUHIl6g4rrSiAn8FMjB3UkAk7qVZzqukTxyQ0zY1bGumK/VNRQWbtIotdZQY4t+3ckvxXblxiOpxUUhclCs3XjdJSUczpcug0kUZwVAsHgBvpzkr5HNyM0X2NjnuE3zelV4PjQRCFQfQu7B2+ap5jizwij0mfROSAHJK35IiMCPcS79z77H3xpX/hf/W/rUt9r9E8JH+Ff/kLfGjt1g==</latexit> All of the cool problems we were solving: finding nodes, speeding things up, making more accurate predictions. It was all so cool, so much fun. I hadn't thought about why we were putting all this work into finding a better place to sit and get good wifi. That doesn't even make sense if you look at it for more than a few seconds. It’s

Slide 36

Slide 36

Does it find phones.

Slide 37

Slide 37

This was never about finding better wifi. It was always about finding phones. Phones carried by people. I was building a tool for the military to find people based on where their phones where, and shoot them.

Slide 38

Slide 38

I tried to rationalize this then. The military is in place to protect Truth, Justice, and the American Way. But this was the same time that we found out the government had been spying on Americans in the US with drones. The military is a tool of the government, and it seemed like we couldn’t trust the government as well as we’d thought.

I didn't want to be a part of building something used to kill people, especially since I knew I'd never know who used against or have a say in that decision.

Slide 39

Slide 39

I rationalize it now too. We were interns, and we didn't even have clearance. The projects this company did for the government were classified Top Secret. I wasn't allowed to know what they were. My code probably got thrown away and forgotten. Probably.

Slide 40

Slide 40

This was an extreme example of code used in a way that the creator did not intend it. The project owner conveniently left out its purpose when explaining the goals. I conveniently didn't focus too much on that part. It was great pay for me at the time. It was a great project. Maybe I just didn't want to know what it would be used for. I got distracted.

Distracted by the technology. It would be just as easy to get distracted by the cool framework a company used, the great design of the app that would look good on your portfolio, or some really nice o ffi ce amenities, or that others are doing this so it’s probably ok.

Slide 41

Slide 41

There are other examples of when code is used in ways it wasn't intended, and of code that does bad things. Most aren't as black and white. The unifying factor in all of them is that a developer wrote the code that did these unethical or immoral things. As a profession, we have a superpower: we can make computers do things.

We build tools, and ultimately some responsibility lies with us to think through how those tools will be used.

Not just what their intention is, but also what misuses might come out of them. None of us wants to build things that will be used for evil.

Slide 42

Slide 42

So how can we carefully consider the potential impacts of our software projects? Honestly, I don't have any answers to this.

I don't think that there really is a universal answer yet, because if we had it I have to believe we'd not be building these dangerous pieces of software.

Slide 43

Slide 43

I do have a couple of ideas though.

The first is to add to the planning process a step where we come up with the worst possible uses of our software.

In opting in folks to an email list by default, the worst case might be that we send them a bunch of unwanted email and they unsubscribe. Maybe they even stop being a customer.

"Am I willing to sell my hypothetical startup's soul for a bigger mailing list, when that might be all that keeps the company afloat? Yeah, no problem." That makes sense to me. I don't think it's the best practice, but in the end it's not physically hurting anyone.

If I had sat down and thought about what the wifi location app could be used for in the worst case, I would have come to a very different conclusion.

Slide 44

Slide 44

Another, the thing that I think I should have done, and that we can all do more of, is to simply not take requests at face value.

The project owner at the Defense contractor I worked at didn't spell out what the reason for the code was. But at least in retrospect, it wasn't a big leap of logic. "We're going to build an app to find wifi signals" is all true, but it's not the whole truth. Asking them, or myself, "why" enough times probably would have led me to a much earlier understanding. Why? To find the sources. Why? To go to them. Why?

Slide 45

Slide 45

It’s a major problem when we’re given so much power in tech, but we’re not doing anything to ensure that we use it safely. Thinking about what we’re doing and being careful not to build things that can be used maliciously is really important.

Slide 46

Slide 46

Don't get distracted by deadlines and feature requests. Think about the consequences of what you're building. Build in safeguards to prevent misuse, or don't build it at all because it's too dangerous.

Slide 47

Slide 47

I'm asking you to do something about this. It's only fair that we talk a bit about how and when to take a stand.

Slide 48

Slide 48

Before saying no then, there are some things to consider:

Can I afford to leave here without a job financially?

Am I likely to be able to rely on my network to get me another job?

Have I built up a trust with my employer where I can go to them with this type of thing and feel confident that I'll be heard out instead of summarily shown the door?

The answer to these questions was no for me in 2011. Sometimes, something is important enough to you that you should still do something.There's a lot that goes into these decisions and they have consequences. I'd like to think that I would still say no.

Slide 49

Slide 49

Different scenarios need di ff erent ways of analyzing what you should do. In some cases, the right thing to do say nothing and build the product. It isn't a simple thing to make this decision.

Slide 50

Slide 50

But don't get distracted by having to think through it. Sometimes your code can kill people.

Slide 51

Slide 51

How I Built Software to Kill People A cautionary tale by @calebthompson

https://www.calebthompson.io/talks/dont-get-distracted Obviously I don’t have slides, so I’ve uploaded basically the script of this talk, along with some suggestions for further reading, to this URL. If you’re looking for something to share, I’d love it if you would use this link.