What Is Programming
What Is Programming
Computer programming, also known as coding, is the process of creating software. But what
exactly is software, and how is it made?
What is Software?
Software is a set of instructions for a computer to perform.
Instead of manipulating ingredients, computers manipulate data. The instructions inside software
look more like this:
These instructions are usually called source code. Source code is just a set of written instructions
that a computer can understand.
require 'open-uri'
require 'json'
FRONT_PAGE_URL = 'https://reddit.com/r/all.json'
front_page = JSON.load(open(FRONT_PAGE_URL).read)
top_post = front_page['data']['children'][0]['data']
puts 'The top post on reddit is:'
puts top_post['title']
puts top_post['url']
This program displays the current top post on reddit, like this:
Here is the exact same program, written in a similar language called Python:
As you can see, programming languages are very different to natural languages. Natural
languages are ambiguous, with many different layers of meaning – sarcasm, innuendo, and those
sorts of things. That’s great if you’re communicating with a human, but computers don’t
understand any of that.
Computers take everything literally. If you ask a computer whether a number is odd or even, it
will always answer “yes.” I’m not even joking – here is the Ruby code:
This code displays “true,” which is technically correct. The number five is either odd or even,
but that’s not what I meant.
Large pieces of software – like Windows, OS X, and big-budgets games – are made up of
millions and millions of lines of code. When you have that much code, you need to plan out how
the code will be written, and how different parts of the code will work together. This kind of
planning is called design or architecture. On large projects, a lot of time is spent designing and
architecting before code is written.
Another large part of making software is testing. Just because the code has been written doesn’t
mean it is correct. The code might crash sometimes, or give the wrong results, or freeze, or any
number of other problems. To try and avoid these problems, professional software developers
have various different ways to test their code.
Then there is debugging, which is the process investigating, diagnosing and fixing problems in
source code. This is a skill in itself.
Conclusion
So programming is writing instructions for a computer to perform. The instructions, called
source code, are written in special languages that are unlike natural human languages. It also
involves planning, testing, and debugging source code.