New to coding? Get a brief overiew of what is is.
With people as diverse as Bill Clinton, Ashton Kutcher, will.i.am, Stephen Hawking and Richard Branson all endorsing learning to code it’s hard to get away from hearing about coding. But what is coding exactly? [caption id=”attachment_68” align=”alignnone” width=”628”] Mark Zuckerberg endorses coding[/caption]
What is coding?
Coding is just another name given to computer programming. To break it down in to simplistic terms, computer programming is the activity of writing a computer program. The word program according to dictionary.com means: A plan or schedule of activities, procedures, etc., to be followed. And that’s literally all a computer program is too; a list of instructions that a computer will perform in a certain order. These instructions are written as a program (code) and then sent to a computer’s CPU.
How computers work
All computers include a component within them called the Central Processing Unit (CPU) which is responsible for co-ordinating the whole computer, loading web pages, running word processors and doing everyday computing tasks. Unfortunately, the CPU is quite dumb and can’t quite work out how to do this on it’s own and relies upon being fed instructions to be told what to do. These are the instructions that are contained within computer programs which is often referred to as just code. [caption id=”attachment_65” align=”alignnone” width=”1920”] Binary code is a series of zeros and ones.[/caption] To make it even worse, CPUs can only understand two things: zero and ones. This is binary. So in order to make your computer do something useful you must give the CPU some instructions in binary. That might be quite tedious for most of us to remember what binary number represents each instruction let alone writing out a program like this. Imagine if you put a one instead of a zero – talk about needle in a haystack! Instead of writing binary instructions modern computers allow programmers to write instructions in a programming language which is more readable by humans. This is then converted to binary so that the CPU can understand the instructions and follow them.
Different languages
There are literally hundreds of different programming languages to choose from. Some of them are historically old and no longer used. Some of them are continually revised and updated with different features and support being added. In the same way a person can learn Spanish, French or Arabic they can also learn different programming languages like PHP, JavaScript or C++. Some languages are described as low-level as they are look and work more like the binary instructions that the computer needs. They also work very closely with the computer’s hardware. Other languages are described as being high-level as they are more readable by humans. To see the difference between low-level and high-level languages, let’s take a look at some examples. All the examples print the phrase “Hello World” to the screen.
Assembly Example
section .text ;section declaration ;we must export the entry point to the ELF linker or global _start ;loader. They conventionally recognize _start as their ;entry point. Use ld -e foo to override the default. _start: ;write our string to stdout mov edx,len ;third argument: message length mov ecx,msg ;second argument: pointer to message to write mov ebx,1 ;first argument: file handle (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel ;and exit mov ebx,0 ;first syscall argument: exit code mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel section .data ;section declaration msg db “Hello, world!”,0xa ;our dear string Code from http://www.tldp.org/HOWTO/Assembly-HOWTO/hello.html
C++ example
#include
Python example
print “Hello World” As you can see the assembly language program is pretty complicated and it’s hard to understand what’s going on. This is because it is a low-level language and is providing the specific instructions that the CPU needs to do the job. The C++ example looks slightly more like English and is quite a lot shorter than the assembly version. This is because it is a high-level language and is intended to be understood by humans, not the computer. Finally, the Python example is the shortest of them all – just one line to do the same job! So now you know what code looks like, what would you use it for?
What is coding used for?
Code is literally all around us in the modern world, nearly every electrical device has a CPU (or a microchip that does the equivalent). Your phone, your TV, your car, even your toaster has some kind of CPU that is dumb and requires a computer program written for it to be organised and to get things done. You can therefore write programs that do a variety of jobs:
- Applications (like Microsoft Word, Google Chrome for example)
- Web pages / application
- Android or iPhone Apps
- Games
- Programs for your toaster (although I’d recommend working up to that one).
Each language has it’s own suitable uses and areas that they excel in. For example, a low-level language like C++ produces programs that are very fast and can access the computer’s hardware easily so make it a good choice for creating computer games. PHP on the other hand is a high-level language that is used for creating dynamic web pages but it performs comparatively slowly so wouldn’t be much good for creating a 3D game. Depending on what you are interested in creating there are different languages that have their specific uses, learning curves and pros and cons.
Popular languages
Here’s a quick table to summarise some of the most popular languages:
Java
Used to build desktop / web applications and also Android apps
A bit of a learning curve but a very employable skill if you are looking to make a career out o coding.
C / C++
Used to build operating systems, applications and games.
A steep learning curve that requires you to have a good understanding of how the computer’s memory works. Great to learn if you want to write programs for things other than a computer too.
Python
Used to build applications, web sites, games security and networking tools – basically anything!
Quick to pick up and there is a good community supporting programmers. Some people describe Python as having it’s own way of doing things which doesn’t necessarily translate well to other languages.
Visual Basic
Used for writing Macros in Excel and other Microsoft Office applications
There is only really one use for VisualBasic (unless you consider it’s sibling VisualBasic .NET). It’s a handy skill to know if you want to pep up your Excel sheets.
C#
Used for building Windows programs, web applications and Windows Phone apps.
A very Microsoft specific language but there is a good demand for the language in the Workplace. It has a similar learning curve to Java.
PHP
Used for building dynamic web pages.
A very specific language which comes under a lot of criticism from more senior programmers. Still a hugely useful and popular language though.
JavaScript
Used for adding interactivity and more functionality to web pages.
An (almost) necessary language for web developers. Simple to pick up but harder to master.
Assembly
Used for creating components of an operating system or programs that work directly with hardware.
Very much like writing binary instructions for a CPU but using a small set of three letter codes instead of ones and zeros.
Ruby
Used for creating web applications, security and networking tools.
The Ruby on Rails framework is hugely popular in creating web applications. Ruby itself is easy to pick up, trying to be more like English than most other languages.
Swift
Used for creating Apple software such as for desktop apps for OS X and iPhone apps.
Probably a steeper learning curve than other languages (Swift is based on Objective-C which is based on C) but is essential to learn if you want to build anything Apple.
Go
Used for building applications and utilities
Created by Google and used in lots of open-source software. Similar to the C language so has a steeper-than-most learning curve.
R
Used for data mining and data analysis
A completely different kettle of fish to the above languages. The language has a niche area that it has uses for and the difference in language style may mean there is a steep learning curve.
HTML/CSS
Used for building web pages.
Not technically programming languages but HTML & CSS have come to fall under the term code. They allow web developers to describe what content a web page should have and how it should look.
Reasons to learn to code
When most people think of coding they think of learning it to start a career. Perhaps it might be a skill that they want so that they may grow in their existing job. With the average software engineer’s salary being $80,778 (£33,942 in the UK) it’s tempting to get excited about learning to code and finding a lucrative job in the industry. There are however many other reasons why you might want to learn to code:
- Build a website for your band/club/school/self
- Make a game
- Create your own app that solves a problem that’s specific to you, your friends or your family
- Do some in-depth data analysis for a school / work project
- Design a tool that will save you time by automating a simple task
- Create awesome flashy Excel sheets
- Create an electronic/robotics project with a Raspberry PI
There have been articles over the last few years telling people not to learn to code. The articles do have some valid points; it’s not for everyone. But where I think they miss the point is that not everyone wants to make a career out of learning to code. You might want to learn to code because it’s:
- Satisfying
- Challenging solving problems
- Creative
- Fun
- A skill that makes you think about things differently
If you are just doing some coding at home for fun or a personal project – why shouldn’t you just do it? There are so many ways to code and also so many languages to choose from that anyone can learn some kind of coding. So if you have a reason to code whether that be to start a career or do something just for fun you might be wondering if you are up to the challenge.
Is coding right for me?
Coding can be a frustrating but ultimately rewarding activity. It’s one that takes time to perfect and this might mean it’s not everyone’s cup of tea. There are some people who will claim they can do it in short time frames like eight weeks but that isn’t an expected time-frame. Usually people who find a passion in coding have one or more characteristics:
- Good problem solving skills or at least like the challenge of problem solving
- Creative
- Patient
- Willing to learn
- Not afraid to ask for help
You don’t need to be worried that you’re not smart enough to be good at coding. The Python code example earlier showed how to write a program with just one line! There’s nothing about learning a programming language that’s out of the reach of most people. The key is to pick the right language for what you want to do and also set your expectations. It’s unlikely that you will become an expert at anything over night. If you are the kind of person who is prepared to put in the effort and not give up at the first hurdle then coding is right for you. The only sure-fire way to know if you’ll get on with coding is to give it a go.
Where to start
First of all, work out what you want to do. Do you want to build a website? Got an idea for an iPhone app? Just want to write programs to get your computer to do stuff just for the hell of it? What you want to achieve will greatly determine where you should start. But if you’re not sure then learning the basics of web development is always a great place to start.
Why?
Well, it’s probably got one of the easiest learning curves and you can see what you’re doing appear in your web browser every time you refresh your page. With web development you’ll learn how to create user interfaces with web pages using HTML and CSS and then be able to apply the JavaScript language to this to make them interactive and functional. You can then move on to more advanced topics by using a high-level programming such as PHP or JavaScript to create more complex applications (like adding user accounts, login pages and searching). Also, web development with HTML/CSS and JavaScript is also quite forgiving – if you make a mistake with something the rest of your web page will still show and you will see something. This is contrast to a low-level language like C++ which won’t allow even a small mistake in your code. There are also so many more languages and projects you can get involved in if you understand the fundamentals of web development. Finally, with web development there are tons of resources available to get started. You can download a special text editor such as Atom to help you write your code but you can just use any standard text editing software like Notepad or TextMate to write your programs. Other than that all you need is a web browser to view your pages. I have created a beginner’s guide to HTML for you to get started with web development so be sure to check that out if you want to get started
That’s it
So now you know have your answer to ‘what is coding?’ are you interested? If you have an idea of what you want build or what kind of programs you want to write, share it in the comments below – I would love to hear what you have planned!