Hello World
I love coding. There, I've said it. It really is one of the most useful and enjoyable skills you can treat yourself to. I was the very first child in the UK to learn using a personal home computer and, like most people back in the early days of personal home computing, I started with the programming language BASIC and moved on to HTML when the internet became generally available. From there I learned CSS, then JavaScript, then ActionScript 3, XHTML, RegEx and finally PHP. I'm no genius, in fact I believe anyone and everyone can, and really should, learn to code.
Learning to Code
For anyone considering learning a little Coding my first piece of advice is "Don't wait!". There's never been a better time to start and, when it comes to coding, your age really ain't nuthin' but a number.
Why learn to Code?
Because it’s fun!
Coding is like a wonderful puzzle box that, once solved, just opens up to reveal another puzzle box. It can also be like building some crazy mysterious machine- all brass and crystal and strings. It can be beautiful and broken but then fixing it’s half the fun and sometimes you’ll have no idea why what you did fixed it or why it’s suddenly able to do amazing things you never intended it to.
The more you tinker the more you learn and, as you grow to understand its mysteries, you’ll feel like some kind of wizard, seeing structure and patterns that most people find incomprehensible.
I’ve seen a few lines of code create hauntingly beautiful artwork, resolve business critical issues, reverse-engineer DNA strands, cut production times in half or just generate an army of self-replicating rubber-legged robots, each furiously engaged in a custard-pie fight inside a tumble dryer!
Why learn to Code?
Becuase knowledge is power
Why rely on an “intellectual priesthood” of expensive digital gurus every time your site needs fixing? Say your boiler breaks. You wouldn’t want to fix it yourself but wouldn’t it feel great to be able to just fix a leaky tap without having to call a plumber?
Even basic coding skills will save you money and help you understand whether those you employ are pulling their weight.
Why learn to Code?
Because it’s easy
It’s easier than you might think to pick up a little coding and it’ll look great on your CV once you’re up to speed with even the simplest coding languages.
Coding languages are just like any other language. You learn one and it’s easier to learn the next and you don’t need to learn an entire language to get by in it. Sure, at times it’ll be frustratingly difficult but a game that’s too easy is no fun.
Did I mention coding really is a lot of fun?
Which coding language should I start with?
A lot of people ask me "which language should I start with if I'm learning to code?" and there's no single "right" answer to this question, which isn't very helpful. So, for those who insist, here's a simple list that represents a sensible and achievable path to a career in coding:
-
HTML
-
CSS
-
Javascript
-
PHP
-
RegEx, Python, C, Ruby, SQL, etc (advanced languages, depends on what you need to work on)
Fundamentals of All Code
As any of my learners will have found already, there can be a lot of jargon in Coding but I think this short list of the basic, fundamental components of Coding will provide a solid foundation for all further development, regardless of which Coding language you learn:
1) Comments
Comments allow you to leave notes to yourself (and others) within your code. Comments don’t get run as part of your program, it’s really handy to be able to do this.
The different Coding languages use different methods to declare a line of code a comment, for example:
// This is a comment in JavaScript
<!— This is a comment in HTML —>
/* This is a comment in CSS */
caveat: https://www.xanthir.com/b4U10
2) Integers
An integer is just a whole number any whole number (1,2,3,4…).
3) Variables
Variables are just a kind of receptacle for a value, be it a numeric value or a piece of text, whatever. If you say “X=2” then “X” is the variable and “2” the value it holds, Refer to “X” in your code and you might as well be writing “2”. Using variables is really common in Coding.
4) Conditional Statements
For example, in JavaScript, If, Else, Else If and Switch allow you to create conditional statements, sort of like “If there’s whole milk at the shop then buy it, else get semi-skimmed milk”.
5) Loops (like For or While loops)
Example of a While loop:
While loops execute a block of code as long as a specified condition is met.
while (i < 10) {
text += "The number is " + i;
i++;
}
BEWARE!: If you forget to increase the variable used in the condition, the loop will never end. This may crash your program or cause a browser to “hang”, etc.
You can make loops conditional, for example:
for (i = 0; i < 5; i++) {
text += "The number is " + i + "<br>";
}
i=0 sets up the variable “i” to be “0”, the loops runs as long as “i” is less than 5 and 1 is added to the variable “i” each time the loop runs.
In this example
Statement 1 sets a variable before the loop starts (var i = 0).
Statement 2 defines the condition for the loop to run (i must be less than 5).
Statement 3 increases a value (i++) each time the code block in the loop has been executed (increments)
6) Nested Statements
For example, you can put a load of “if” statements inside an “if” statement.
if (condition1)
{
// Code here executes when condition1 is true
if (condition2)
{
// Code here executes when condition2 is true
}
}
7) Arrays
Think of arrays as like filing cabinets where you store a bunch of values. You can even get really fancy and create “multi-dimensional arrays”, which are basically just an array that stores a load of arrays, like a filing cabinet where each file contains another filing cabinet.
In javaScript arrays might look similar to these examples:
var cars = ["Saab", "Volvo", "BMW"];
var cars = new Array("Saab", "Volvo", "BMW");
Don’t overlook the power of these simple code elements, they’re used in everything from database manipulation to games design.
8) Functions
You can write your own magic words in code!
You define what you want to happen when you create the function then, every time you “call” that function by the name you gave it, all the code it contains will run. They’re really, really useful.
Here’s an example that uses two number variables (v1 and v2), that are fed in to the function inside those brackets after it’s name (“MyFun”):
function myFun(v1, v2) {
return v1 + v2; // The function returns the product of p1 and p2
}
Here “return” means that when you “call” the function in your code you might as well have written the product go the function.
One great thing about functions is that, if the value of v1 or v2 is changed elsewhere in your code, the function doesn’t need to be rewritten or updated! It just spits out its result using whatever those new values were. Awesome.
Contact
I'm always looking for new and exciting opportunities. Let's connect.