How (not) to write computer-related stuff in your story.

My qualifications: degree in Computer Science, 16 years as a software analyst, database specialist, programmer and tester. Also, web design, basic/good knowledge of 10+ programming languages, reasonably good knowledge of two operational system families (linux, windows) and generalised knowledge of How These Things Work.

Also, common sense. And being married to an admin/programmer. Not ashamed to admit I use him as an important resource.

And an ability to spot serious bullshit in stories ;)

How to write about computer stuff?

If you know that shit, you already know how to. Just don’t put too much technobabble.

If you know more or less but not really, only vaguely, read on below.

If you know nothing… be vague. If you had never ever seen anyone using anything more complex than a text processor, write the situation in a nice and generalised fashion. Describe how the person hacking looked focused as they typed rapidly or stared at the darkened screen, deep in thought… Just don’t mention what they have on the screen.

If you know nearly nothing about computers (or at least no more than how to use Windows)

First, for basic reference, watch this clip: https://www.youtube.com/watch?v=SZQz9tkEHIg and try hard to stay away from the more crappy solutions, as per the expert’s comments (so no typing on one keyboard by two people to make it faster, sorry NCIS). Really, being fuzzy and poetic about the hacker’s partner watching them as they struggle is better than making the hacker send stuff from Emacs through Sendmail and have a reader die of sheer second-hand embarrassment.

What you CAN write (these are reasonable scenarios of what can happen)

X spend several hours trying to crack the security on the target server. The certificates were up to date, the passwords changed often and the admin seemed to be more paranoid than average. To no avail. He would have to take the oldtimey route of starting with the weakest link in the chain. The people.

It was a tough job, and no doubt about it. X wasn’t yet ready to throw in the towel, but it seemed as if someone had paid their IT security team very well. He would need to find a new angle of approach. Like, going through the mail server. First, overload the e-mail system. Second… will be later.

After all the trouble he went to, the password was simply stuck to the bottom of the manager’s drawer, on a post-it note. The only thing he had to guess now was – which system did it apply to?

Learning a new programming language was not as easy as some claimed it to be, especially when you had to switch from another, using a completely different logic and syntax. Old habits die hard and X caught herself putting the semicolon in the wrong place yet again, making the whole compilation crash.

The code was pretty complex, with multiple loops and a huge tree of logical conditions branching at several levels. Analysing what exactly went wrong in it would take X several hours, considering the mess Y had made of the comments and the shitty formatting he had applied. First things first. She cracked her knuckles and started to add indents, to make the whole thing easier to read for a human being.

The pop-up window suddenly closed by itself. Uh-oh. Either a virus or someone had quietly taken the control of her system… but how? She had blocked remote desktop connections, her Skype was offline, her… Another window closed. Whatever it was, it must have come from one of the pages she had visited. That was the price of trawling that part of the internet. Quickly, she pulled out the network cable and sighed in relief. The computer didn’t have wifi, so as long as she didn’t reconnect it, no new damage could be done. Hopefully.

Facts and truths

In general, there are some things you should remember, and here I’m listing them based on fanfiction I’ve read recently, mostly MCU (because here people try to get into details in order to give Peter, Tony or Ned some tech content to talk about and fail, a lot – if you recognise your fic or plot device here, pls don’t be angry, just accept that it was an example of how it goes wrong, sometimes hilariously).

  1. If someone doesn’t know a specific programming language, they aren’t going to learn it in one afternoon. Or a week. At least not to the level needed to write an AI.
  2. Writing an AI is a Totally Separate Thing. Person learning programming at school or at the uni, even if they are pretty smart, will not just “write an AI” like that. It requires making a complicated analysis, thinking up the algorithms, writing specification, making a prototype, proof of concept and then a tons and tons of testing.
  3. Amount of code one can write and analyse reasonably is limited. One fic I saw mentioned trillion lines of code. Nope. Windows 10 has (estimated) 50 million lines of code. If a person had a trillion lines of code, it would take them 300 years to write them. If they wrote 100 lines per second. Seriously, check your numbers for order of magnitude.
  4. When you write code, it doesn’t change by itself on the screen, unless you have a virus in your system.
  5. Typing code in the editor does not affect the rest of the code (one already entered). It can affect subsequent reruns of your program, but not the code. Code is a text document.
  6. Nobody can debug a piece of software by just glancing at the screen. Unless the error is so obvious that a basic-level programmer would notice it – comma instead of a dot, for example – the issue will usually be found by reworking the code to make it show more messages and tracking where it fails (note: the amount of time needed depends on the complexity of the program itself, language used, operational system and hardware on which you are working).
  7. You can’t just interface computer with alien tech and expect it to Just Work. Unless you want the ‘work’ to be limited to ‘go up in flames’, of course. Computer needs drivers to use hardware and Windows 10 doesn’t come equipped with the correct set of libraries to manage a battery that used to be a part of Chitauri ship. Unless there is something about Bill Gates that we don’t know.
  8. You usually can’t fix a too-slow mobile phone by cleaning it physically (but it may work with an overheating laptop, especially if there is cat fur involved).
    1. You can fix a too-slow smartphone by closing all 40+ tabs in Chrome (done it recently, not on my mobile)
  9. Every deleted data can be undeleted, unless someone plays with a heavy magnet near the drive in question. Usually it will be the data you don’t wish anyone to undelete (while your master thesis will be, without a doubt, eaten by the black void of your disk space)
    1. Freezing the drive and then working it all over with a hammer works lovely as a permanent delete, in most cases
  10. Operational systems come in several flavours.
    1. Windows (variety of versions) is what everyone knows. Graphical user interface, but good old MS DOS that is under it somewhere still remains. You can use the clickable interface happily all your life and never touch the text mode window. But you also can do a lot of complicated and/or cool stuff by using Power Shell (which is a program that allows you to type a variety of commands, more complex than just “open file X in application Y”).
    2. Apple MacOS – the thing that you have on your Apple-whatever computer. Graphical user interface. Many graphic designers use it. Never touched it myself, the closest I came to it is my iPhone and iPad (which run on iOS, which is not the same, even if it looks similar and connects to the greater whole of Apple systems).
    3. Unix – usually a server OS, has both text and graphical mode. Really powerful control of the user over the system, if user is admin (root). If user is not admin, user may turn out to not be able to do anything. That depends on the admin’s mood.
    4. Linux – like Unix, only written in Open Software model, free and comes in many many many varieties. Traditional flamewars between fans of Slackware and the proponents of Debian are well-known (the same for any other combination of distribution codenames). Open Software means that every piece of software is distributed to users in an open form, plain code. So if you know the language, you can try learning about the way application works by reading it. NOT an easy or quickly-done thing.
  11. Programmers occasionally use other people as rubber ducks, to work through a logical process. They talk to the other person as if they were talking to a rubber duck who knows nothing about the subject, thus going into details they usually would have missed, due to making certain shortcuts and assumptions. The other person may be another programmer (playing dumb) or a non-IT/layman who knows when to ask “but what does that really mean”. Or a rubber duck, as such.
  12. Programmers occasionally use pseudocode (not all of them, but some do) in order to NOT actually write the program yet, but to show the logic of it. It may be the equivalent of making a rough draft of a picture or an outline of a story.
    1. Note: I used this method multiple times, mixing syntax of different languages to better envision certain parts of code, adding human-readable text and notes to it. Including doing it on paper, while discussing the idea with someone.
    2. Textbooks on algorithms and similar subjects use the pseudocode to show certain examples and logic in order to not force the students into using specific language, but to remain agnostic to the technology used
  13. A bit of off-topic, but many of the same rules apply to maths and physics. If your protagonist is really really smart but doesn’t know the topic of the equation in question or doesn’t know the aspect of physics being discussed, they will not spot the “obvious error”, because persons involved would have already spotted it before.
    1. So, yeah. All the “Peter visits SI on field trip and everyone asks for his opinion and he tells people they forgot the minus here” stories are very much unrealistic. Even in the world of people mutated by a spider bite, certain rules should be kept. Scientists check their work multiple times and they don’t forget to correctly carry the minus. They are not middleschoolers.
  14. Being very smart doesn’t mean you can understand a complex algorithm immediately. Just faster than others. But never at a glance. You will not fix someone’s AI at a glance. At a glance you can see stuff like:
    1. “You forgot to give an ending condition to this loop” (this means some operation will be repeated infinitely, see also: Magician’s Apprentice)
    2. “This if clause else seems to be ignoring all negative numbers” (so it will not show any result for some values, making the program crash or do something idiotic if certain conditions are met)
    3. “You used single = instead of ==” (and yeah, it’s a problem in C and C++; “x = 7” is “let x equal 7”, assignment; while “x == 7” is a comparison operator, “is x equal to 7” – https://www.includehelp.com/c-programming-questions/what-is-difference-between-assignment-and-equalto-operator.aspx)
    4. “it’s an off-by-one-error, this loop runs one additional time” (common issue in many, many languages and probably every programmer has done this at least once: https://en.wikipedia.org/wiki/Off-by-one_error)
  15. Being experienced will make the programmer more knowledgeable about the types of algorithms used, so it may potentially give such programmer the ability to spot approaches that won’t fit the problem (less effective sorting method, wrong regular expression)
    1. Sometimes it may turn out that a change of programming language will help with solving the issue more effectively
  16. If you want to write scary shit, mention Internet of Things (smart fridge that orders for you) affected by something common (smart fridge that orders food for you but you forgot to turn it off when you went for vacation so the delivery guy kept dumping food on your porch for 2 weeks, in July, because the fridge was empty…)
    1. It doesn’t have to be a HAL-level intelligence, it can be a dumb smart fridge that will eat through your credit card and make your house smell of mold, old cabbage and rotten meat. It’s already BAD, we don’t need a whole space station full of bad.
  17. Destroying the monitor doesn’t mean the computer isn’t working anymore. It still is and if there was a virus eating the hard drive, it’s still munching away on it. Unless it’s an iMac or a HP that has the central processing unit in the butt of the monitor.
  18. If the user (player) manages to convince the game to let him get out of the boundaries (survive while dropped off the map etc), they will not find themselves in an unexpected, wonderful no-rule level. Most probably, the game will just freeze on them, not knowing how to handle the exception. Unless the game is being live-developed by an underlying AI (Hi, Ender) and so every attempt to break out of the standard is anyway monitored and immediately cushioned against, there is nothing for the player to explore – if it wasn’t written by the author, it won’t exist.
  19. If you ever manage to find yourselves (your playing character) in such a weird place in the game, be assured – the authors planned it and it was put there on purpose.
  20. Human and human-similar beings can’t catch a computer virus. Unless the being in question is Nebula, but she probably keeps her antivirus software religiously up to date.
  21. Virus, trojans and other backdoors don’t need graphical representation to do damage to your computer. In fact, unless we move to ones that are supposed to be scary and not just fisking annoying or dangerous, the majority of viruses and so on are quiet and tell you nothing about themselves until they are done damaging your stuff or want you to pay for the safety of your data.
  22. The Jurassic Park One: “It’s unix, I know this system” – NOPE. You wouldn’t sit in front of a computer running complex genetic experiment and say “Oh, it’s Windows, I know how to click it” and proceed to easily gain control over a power grid of a park full of dinos. Nope. No.
    Just, no. Sorry, Lexie.
  23. You don’t need 7 separate computers for 7 separate chat windows with 7 separate people, unless you can’t use browser window tabs. Sorry, Sherlock.
  24. It is possible to snoop on anything people do in your wifi network. There were cases of hackers setting up access points that simulated Mc Donalds or other places with free wifi and then logging all the traffic in order to trawl for usernames and passwords.
    Happy browsing next time you eat a Mc Chicken.
  25. The thing you write in is a programming language. To do this, you use an editor. You can write any kind of code using Windows Notepad or Linux pico editor, but it will be annoying and slow. Specialised software with highlighting and automatic formatting make it easier to work with code.
    Think about it like writing text. You can write the same story in Word, LibreOffice, Notepad, Wordpad or OneNote. The story doesn’t change, just your ability to publish or share it changes. You can write any kind of text in Word – a poem, a short story or a novel. Or you can write it in Notepad, but it will be… not as comfortable! And then there is specialised software like Scrivener that makes it so much easier to organise. Right?
    Same rule applies to coding. So the fact that someone’s screen is showing Notepad and not fancy multicoloured text in cryptic editor doesn’t mean they aren’t programming. It just means they are stubborn and use the most primitive tool available in Windows system ;)
    I could use Notepad to write the code of a webpage in HTML, a perl script, a bash script or a Python program (perl, bash and Python are programming or scripting languages). So the tool in which we write doesn’t affect the general ability to create code, just the comfort.
    Not many people write their own language just to code something special, unless the payoff of creating a whole new language (with all required dependencies, libraries etc – huge amount of hassle) is significant and will give them some kind of large benefit.
  26. SPOILER!!! EDITH in Spider-Man FFH
    Seriously, FFS, not FFH.
    I mean.

    Yeah, Peter took her back from Beck. And yes, there was no “handover” from Beck to him, so why the hell did EDITH even obey? Or what? Tony hardcoded Peter as superuser?
    (that’s why an IT analyst and a security specialist should not be watching movies about teen wannabe hackers, we get migraines)
    Why EDITH didn’t identify Beck as a dangerous wacko on sight…? She was so ready to read everyone’s e-mails and texts on the bus and NOW she gets shy? Also, how come she didn’t react when someone used her to attack her designated superuser…!?!
    Yeah, IT-related plotholes make me break out in hives.

  27. More electric power doesn’t mean more computing power. The fact that you connect your computer to stronger source of electricity won’t make it calculate the password faster.
  28. You can’t compress very well an already-compressed file. You can’t just compress files infinitely, making them fit on a smaller disk space. Sorry, Mr Finch.
  29. There are the following types of data carriers:
    1. USB pen drives – common, cheap, you can buy them everywhere, many companies, many sizes
    2. Memory cards – same, physically smaller, require a reader to get data from them
    3. DVDs – these round ones, can hold ~4,5 gigabytes of data
    4. CDs – also shiny round ones, a bit older, can hold ~750 megabytes of data
    5. Floppy disks
      1. 3,5’’ – the ones that look like the Save button in your software – can hold 1,44MB of data (which is an enormous amount of GIF files, really astounding number of karaoke midi files or 4-8 games from the 80’s); the drive for these is the one with a small button to push the floppy out
      2. 5,25’’ – the bigger, softer ones – up to 1,2MB of data (slightly less than 3,5’’); drive for these is the one with a switch that moves 90 degrees and locks the floppy in
    6. 8’’ – even bigger, also up to 1,2MB of data, I’ve never seen the drive for this with my own eyes; last new model of the disk introduced in 1976
    7. Tapes – Spectrum, Commodore and several other computers used tapes as source of software. Very funny noise you at some point learnt to interpret as “this is loading” and “this is not loading at all, damn it, just wasted an hour waiting…”
    8. There is always an option of carrying around a full-sized hard drive and connecting it to a computer though a specialised enclosure that uses USB.
  30. Hackers (the more social ones) use USB drives left in random places like meeting rooms of a company to fish for stupid employees – people tend to plug in “found” usb sticks to see what’s on them; this is the best way to lose access to your laptop and give your company’s data to the Bad Guys.
  31. Other data carriers usage in text should depend on when you put your story and where. At my uni in early 2000 we still used floppy disks (3,5’’) for various purposes, but CDs (both Audio and data) were in use, too. CD writers were slow, clunky and ate a lot of memory
  32. Theoretically, if you are very patient, you can connect to a dial-up by whistling.
  33. There is no tech available currently that would actually read your thoughts as such. Electrical activity, yes. Content of the thoughts, no.
  34. Even if we put our story in a world with magic, high-tech with no explanation and near-magical inventions, still some reason has to be applied to the way this all works. Unless a machine is programmed and prepared to do something (perform certain task) it will not do it correctly. The more specialised the machine, the less likely you are to be able to use it for a purpose it was not intended for.

A bonus story that is here just to explain why I’m so sure about some of this

It was late evening (maybe 22:30, 23:00) and I was sleepy, but my boyfriend was sitting over a piece of code that was just giving completely buggy results. I was falling asleep propped on his shoulder, he was torturing the keyboard and muttering. I finally asked what the problem was and he started explaining.

(Background: it was our 4th year at the uni, me studying computer science in econometry and he studying just plain old good computer science at one of the major unis in our country, he had much bigger experience in programming than me, but I wasn’t exactly an idiot; just sleepy)

So he started explaining that this part does this, and this is that and I was yawning and squinting at the screen and finally, being – as I said – rather sleepy, I asked “but does the table start from 0 or from 1…?”. It turned out to be the solution (at least to that error).

Now, in order for this to work, you need BOTH people involved to have a non-zero experience in programming and the one needing help to be in a hurry or really distracted. If he had had time to go over it (see “rubber duck”), he would have found the problem. I, on the other hand, had had already at the time a good dose of theory and experience in programming using at least 5 different languages. The concept of the table of data having first element at key = 0 was common among them, and so was the error of people assuming it should be key = 1, just because it seems more natural.

It was an example of an Off By One Error: https://en.wikipedia.org/wiki/Off-by-one_error

When it won’t work? When the person who is looking doesn’t know shit about coding or has minimum experience just putting stuff together in one language and has no theory basics.

In summary: It’s not enough to just be bright. You also have to learn stuff before you are able to do it.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.