How AI makes English a programming language
Text to code, text to app, and what that means for the creation and use of software
Hello from Utah! It snowed last week adding to an already record snowpack, and it will be 65 degrees next week. Everyone is worried about it flooding like it did in the 80s. 😶
Let’s dive into why AI makes English a programming language, and why that is going to change the world.
AI gives everyone the ability to program, by describing what they want the computer to do in English, and the computer figuring out how to do it.
Being able to describe a system you want, and then being able to have the computer build that system, is going to change how we build and use software.
In this episode we are going to look at:
Why everyone wants to program
Why programming is hard and expensive
How AI is making it much easier to code
Tools you can use to try programming out today even if you don’t know how to program
Next week we will consider the effects of everyone being able to program. Including:
What happens when anyone can create an app with AI?
What the future could look like when everyone can program
Everyone wants to program aka Everyone wants a Jarvis
In the Marvel universe, Tony Stark has Jarvis, a computer assistant.
People love the idea of Jarvis. Talking to a computer, and having it give you valuable timely responses is the science fiction dream.
“Computer what is the melting point of steel?”
“The melting point is between 2550 - 2790°F. Hull temperature is 1500°F and rising by 5 degrees per minute. I’ve calculated we have 3.5 hours to leave this area before the hull melts.”
Instead of having to learn the concepts of logic, programming languages, and computer science, you just explain what you want, and it does it.
We have come a long way towards Jarvis since the first electronic programmable computer, the Colossus, was invented in 1943. The history and progress of speech to text means computers are able to turn human speech into digital text with 95%+ accuracy rates.
Having computers understand the requests and then fulfill them… is another issue that computers still struggle with.
The reason they struggle, and the reason why Jarvis doesn’t exist (yet), is that computers are dumb, and you have to tell them exactly what you want them to do.
Computers are dumb
A classic learning exercise in computer science class is, “write ‘code’ to make a peanut butter and jelly sandwich.”
Students will write out how to make a PBJ sandwich on paper or note cards, and the professor will pick several of the students ‘programs’, and execute them.
Students always forget to include relevant details which leads to the professor stabbing through peanut butter jars with a knife, tearing bread apart, and putting jam on the table.
While a funny classroom exercise it illustrates a painful point.
Computers are ‘dumb’. You have to tell them exactly what to do. While a human may understand that you need to take the top off a jar of peanut butter before you insert a knife, the computer doesn’t. It will do exactly what you tell it to do.
If you tell a computer to take the number 1, then double it as many times as it can, it will. This will create a number so big it fills the available storage space and crashes the program.
Here is an example I wrote that does exactly this.
Did I want the computer to crash? No. But because it did exactly what I told it to, no matter the context, environment, or other considerations it did.
Other dramatic examples of this are Computer Numerical Control or CNC machines. You can program the machine to use a tool to make amazing metal, plastic, and wood parts. But the machine will do exactly what you tell it to do.
If you tell it to move the metal part while the drill is still trying to remove material, you get a very expensive error.
This is where programmers come in. Programmers learn how to talk to computers, and how to tell the computer exactly what to do, to get a certain outcome.
Programmers understand the context, the environment, the desired outcome, and then translate that knowledge into the instructions for the machine.
Programming a computer is hard. Therefore….
Programmers are rare
While it can feel like everyone is working in ‘tech’ these days, the fact of the matter is, not many people can program computers.
There are an estimated 27 million professional computer programmers in the world. With a world population of about 8 billion, that means that about one person in 300 programs computers professionally.
1 out of 300 is not a lot. 0.3% percent or 1/3 of 1%.
Even if we 10x that number with everyone who can program, but don’t do it professionally, that is only 3.3% of the world.
Learning to program is difficult and it takes time to master the skill. It is also a really valuable skill.
When something is hard and very useful, it becomes very valuable. Therefore…
Programmers are expensive
US News reports that:
Computer Programmers made a median salary of $93,000 in 2021. The best-paid 25% made $122,600 that year, while the lowest-paid 25% made $62,840.
$62,000 a year is $29.81 an hour.
$120,000 a year is $61.00 an hour.
Upwork the freelance marketplace confirms this. They list the rates typically charged by programmers as:
Beginner: $25 per hour
Intermediate: $41 per hour
Advanced: $80 per hour
Programmers are expensive, and programmer time is the main ingredient or input into creating software. So this means that….
Apps are expensive to build
There have been millions of words written online about how much it costs to build an app.
Most of the top results are SEO articles for various companies that will build you an app. But the latest industry reports show the cost to create a mobile application is between $30,000 and $250,000, with an average cost of $171,450.
For the standard 8 hours a day, 5-days-a-week worker, there are about 2,080 work hours in a year.
Hiring an advanced programmer to work on your app for a whole year costs $166,000 dollars. If you want the app in half the time, you could hire two programmers to work for half a year, which would still cost $166,000.
The cost of creating code, is a high barrier to entry for someone to build an app or piece of software. Because apps are expensive to build and maintain…
We don’t build enough software
I think nearly everyone has an idea for an app. Humans love to build tools.
And everyone can see a problem or task in their life that could be made easier with the right tool.
I have had countless friends come to me with app ideas. Ideas for book review websites, internet-connected water faucets, weekly study group reminders, canyoneering trip planners, and more.
Computers are a powerful tool and people want to use that tool. Yes, computers are dumb but they can do things much faster than humans, and they can do them forever. This means the possibilities for applications and tools are nearly endless.
The problem is to build that tool, you have to:
learn to program the computer yourself, or
hire someone to program it for you.
That was the situation for the whole history of computers, from 1943 until now. But we now have a third option.
Have the computer create the code.
AI can write software
There is a type of AI model called transformers. Transformers can be used to generate new data.
Specifically, we can train the transformer model on large amounts of text. We can then give the transformer new text, and ask it to predict the text that would follow it.
(If words like models, and train etc confuse read this quick guide to AI terms)
If we give this transformer model tons of text to train on, and lots of parameters, we get a Large Language Model (LLM).
Large Language Models are artificial intelligence tools that can understand input text, and then predict future words, letting them create new text.
On a small scale this is auto-correct on your iPhone. On large scale, this is ChatGPT.
ChatGPT can understand text and generate text.
Computers are programmed with text.
This means that LLMs can generate code.
Why are LLMs (like ChatGPT) good are generating code?
There are many reasons why LLMs are particularly effective at writing code, the two we will cover are:
The structured nature of code (code has lots of rules the computer can learn)
The initial ease of verifying outputs (you can run the code to check if it is right)
Structured nature of code
By learning from billions of pages of text, LLMs can learn the rules of language. It can learn for example that English has syntax, a set of rules, for combining words into sentences.
The syntax rules of English tell us that, nouns generally precede verbs. So the words dogs and barked could be combined as Dogs barked but usually not Barked dogs.
When the LLM learns these rules, it can use them to predict additional text. When ChatGPT uses the word ‘dog’ it often uses it correctly, because of the number of times during training when it saw the word ‘dog’ precede the word ‘barked’.
Software is even more rule-based and grammatical than conversational English.
Programming languages can be thought of as very formal languages with extremely explicit sets of rules governing what language element can and cannot be used, in specific combinations, to produce a desired outcome.
You can imagine programming languages as the pickiest of grammar enthusiasts. Instead of just correcting you when you miss a comma, the program will refuse to do anything if you miss a comma.
Here is two quick example programs I wrote. One prints a full name from a first and last name, the other doesn’t work at all. The only difference is one comma.
This is incredibly frustrating for people learning to code and veteran programmers alike. There are countless memes expressing the frustration.
However, the very grammatical persnickety exactness that frustrates humans, is perfect for LLMs like ChatGPT.
Humans will write English in lots of different ways which makes it difficult to learn. These two sentences in English mean approximately the same thing.
Hark! The dogs barked fiercely at the midnight hour.
The dogs barked a lot at 12 am.
The LLM needs to learn all the rules, and meanings, and intricacies, and syntax of those two very similar sentences to be able to accurately predict other words. This is difficult.
But, what if all humans wrote sentences about dogs in exactly the same way? For the LLM, this would make it much easier to learn the rules.
That is exactly what programming languages do. For a program to work, it has to be written in very specific and largely identical ways.
Here is an example. Programs need to store things. Numbers, images, data, storing something then using it is a foundational building block of any program.
A variable in programming is a place to store those values.
In Swift, you have to write a variable exactly like this:
var <variable name> : <type>
= value
Want to store the first couple digits of Pi? You have to write it like this:
var pi : Double = 3.14
In English the above code snippet says “create a variable named pi
, which stores a number that can have a decimal place called a Double
, and assign pi an initial value of 3.14
”.
And for the computer to understand that, the programmer has to write it using that exact syntax.
Even though a human would understand just fine if you wrote var as variable you can’t. Has to be exact.
Even though a colon and semi colon look the same, you can’t replace the : with ; it has to be exact.
This makes it much easier for the LLM to learn the rules of the programming language. Every variable is going to follow exactly the same syntax, so learning and then predicting the next words becomes much easier.
But LLMs have a problem. They just predict the next words. They don’t know the next words. And so, LLMs often just make stuff up, which is called hallucination.
Ease of verifying output (just run it)
LLMs hallucinating or making stuff up is a big unsolved problem in AI right now.
If you ask an LLM for the population of the top 10 most populated countries on Earth, it would give you a list. But you would have to then independently verify each number because it is predicting the next words, and it might make something up. Unstructured data is harder to fact-check.
Code on the other hand is relatively easy to fact-check initially.
You can just run it.
If the code does what you wanted, it is to a degree, correct.
Of course, there are issues with this approach. I would need to check if the program was actual doing things correctly. I would need to verify that the sum of the first 100 digits starting at 1 is actually 5050.
And there are other issues like security, scalability, and accuracy. These are all things that have to be verified with AI-generated code. You wouldn’t want an AI generating the code to run your Grandpas pacemaker without someone looking at it and checking it a few times.
But for simple programs or simple tasks, AI can easily generate code that is useful, and more importantly very cheap. This makes programmers more productive.
AI helps programmers get more productive
The open secret with programming is that developers look up stuff constantly. They have to. No one came memorize perfectly all the rules and syntax and concepts perfectly.
Let’s take an example. Computers store dates in specific formats. Javascript, the code that runs websites, specifically stores a date as the number of milliseconds that have elapsed since midnight at the beginning of January 1, 1970, UTC.
So Dec 25th, 2023 is stored as 1703536000000
1703536000000 is useful to computers, not very useful to humans.
Humans write dates down in thousands (millions?) of different ways. So if you want to print that date out as a human-readable date, there are tons of little settings and options you can configure.
Do you want the full month's name? In what order do you want the days vs the months?
Most programmers don’t remember all these little settings off the top of their heads, so they look them up with a Google search.
After finding the documentation or someone explaining the documentation, they read it, understand it, maybe copy a code sample, then modify it to what they need, and finally test it.
With AI, the whole process is much shorter. Simply ask for the code you want, copy the code sample, then test it.
Since programmers are already constantly turning to reference materials, reference materials that write themselves to your specific use case, and that you can add to your program with a few key strokes, are a natural fit, and an incredible tool.
The proof is in the widespread adoption AI is already having in the coding world.
AI is already helping to write a lot of software
One of the first coding LLMs released was Github Copilot. GitHub wrote a blog post about the results, and they are shocking.
Since its preview in 2021, and widespread public release on June 21, 2022 Copilot is generating tons of usable code. On average 46% of all the code being uploaded to Github is generated with AI. Already.
Developers report being 55% faster.
And this is just the beginning.
The tools to help human control computers are only going to get better.
And they are going to get easier and easier. If you have never tried programming, with these tools, now is a great time to start.
Text to app tools you should try today!
We don’t have any true text to app tools yet. You still have to take the results the AI gives you, copy and paste them into the right places, and then figure out how to run them. The cool thing is, AI can help tell you how to do this part as well.
Twitter is full of examples of people using AI tools to create software they otherwise would not have been able to create.
Here are the tools I would check out.
ChatGPT
Cost: Free, paid plans available
One of the reasons ChatGPT is amazing, is the wide variety of things it can do. One of the things it does pretty well is generating code.
In general, GPT-4 feels like a junior programmer. They are very fast at typing, and know about a lot of libraries, but they are careless and easily confused.
I asked ChatGPT to ‘Can you create a simple web app that will display the weather at a given zip code? Using javascript and html and css?’
I took the code it gave me and put it into Replit (a very useful online coding tool that can run your code which we will talk about later) and tried it out.
I got errors. I copied the errors, and after feeding the errors back into the chat, it suggested how to fix them.
It gave me new code that I tried. Repeating this cycle allows ChatGPT to slowly fix its errors and get to working software.
After about 30 minutes, I had a working little web page that can show the weather at a specific location.
You can view the code here. I couldn’t put the working app since it exposes the API keys in the code and if someone else uses key, it costs me money. 😄
If you want a free mini course about how to make apps with ChatGPT, reply to this email, I will build it and send it to subscribers if enough people want it.
Replit
Cost: Free, paid plans available.
Replit combines everything you need to write, run, and collaborate on code in just a web browser. You don’t need to install anything, and you can share what you built.
Replit is cool for several reasons:
It's free to use and has many helpful tools that make it easy to write and test code in different programming languages.
People can work together on the same code at the same time (Google Docs for code!), which is helpful for teamwork and learning from others.
Replit has a big community of people who share their code and help each other learn.
Ask an AI for code and you can run and share it on Replit.
Copilot
Cost: $100 a year.
https://github.com/features/copilot
Aimed at programmers, Copilot lets you integrate with the tools you are already using to write code and then prompt it with a comment.
So a programmer can write something like
//generate a random number
and Copilot will write the code right there in the text editor
Copilot is used extensively by professional programmers.
Tabnine
Cost: $144 dollars per year
Also aimed at programmers, Tabnine lets you integrate with the tools you are already using to write code and then prompt it with a comment.
Basically an exact Copilot competitor.
Pico
Cost: Free
More of toy but still really cool, Pico allows you to describe the app you want and then it will build it. You can inspect the code to see how it was built and change it.
AI tools are making it easier and easier for everyone to create tools and programs. I am excited for everyone to have their own personal Jarvis.
Thanks for reading! See you next week.
-Josh