Let me give you an example of one of the programs they ask you to write while taking the course.
This program is supposedly the best they could come up with for a program that looks through a text and tells you if it found your name or not. If you don’t know anything about coding, and even if you do it will still probably take a while to analyze what’s going on in this code because it’s so bad, here’s what it does:
- It takes two inputs: any body of text and your name
- It keeps track of the first letter of your name and the length of your name
- Anytime it finds the first letter of your name, it saves that letter plus X characters after to a list. X being the total length of your name minus 1
- It will then return that list to you if your name was found, or return “your name wasn’t found” if it wasn’t found.
Here’s the problem with this. If you gave it these two inputs:
body of text: “Hello. My, my what a day”
It will return [“M”, “y”, “, ” “];
and say that your name was found. The thing is, it didn’t find my name at all. It only looked for the first letter of my name, matching the capitalization, and took X characters afterwards. Lame.
Wow, awesome. It was able to perfectly find my name! /sarcasm
There was no unnecessary nested for loops that had to be written for this, just simple one function, and it works perfectly. That’s the way you write a proper “find name within a given text” program, not in the way they gave.
Don’t get me wrong, I’m grateful that they provide this awesome service to millions who don’t know a thing about programming. But really, when you want to excite people who have never programmed before, asking them to create a broken program won’t make them excited to learn anything more.
Written on: 10/2/2016