cs
cs
Binary Code
The concept of binary code is quite simple. Every 0 means off or disabled, and
every 1 means on or enabled. In other words, you can look at them as a switch or
lever. If you’re looking at binary code and you see a 1, then you know that
particular data point is “on,” or has been initiated. The opposite is true when you
see a 0 in the code.
While that’s a rudimentary definition of binary code, it will certainly help you
understand the language much better.
To quantify how that kind of code can tell a computer what to do, or communicate
rather, you must consider how these machines handle the information.
That’s because binary code is the fundamental or core language that computers use
to process and read data. And it would be too difficult for us to work with, at
least as-is. Instead, we use another form of communication, or language, called
programming languages. These languages — of which there are many — translate
information into binary so that the computers can interpret the data and make use
of it.
When you learn to code, really you’re learning to speak to computers in a language
they can understand. So, even though you may not be using binary directly, it’s
still important that you know what it is and how it works.
Today’s computers are much more advanced and complex, and those 1’s and 0’s can
represent any symbol, letter, number, or segment of data. Binary just happens to be
how the computers process the information.
Every time you store data, inside the computer that information is stored in
something called a capacitor, using electrons. This type of system is what makes up
a memory module, or DRAM. Boiled down to basics, these capacitors are essentially
the same as the switches, but they can hold more information, or rather more
nuanced details.
Today’s computers get most of their data storage and processing power because of
how capable DRAM or advanced capacitors are. Let’s say your computer has 4GB of
DRAM, which is the base capacity of most computers on the market today.
Each GB (Gigabyte) contains a billion bytes or 230 bytes. For every 1 byte, there
are 8 bits. To calculate how many bits there are, or switches, we need to use a
little math.
So, that means there are 34 billion switches in 4GB of RAM. Now imagine higher
capacities of RAM like 8GB, 16GB, or even 64GB! The same is true for massive hard
drives at 1TB or beyond! Any one of those bits, or switches, can be used to store
information. That’s a lot of room to store data.
That is precisely how computers use binary to store long strings of information.
The long strings of 1’s and 0’s can be used to denote particular letters, numbers,
and symbols. This is called binary code, while reading it is called “decoding.”
That’s all good to know, but it doesn’t answer an important question. What is
binary? How does it work and how do computers use it?
The standard form of numerics relies on the decimal number system, starting at 0
and it goes up to 9. This is the most basic representation, which we all learn in
school. Computers don’t use this, however, at least not in its direct form.
Also referred to as the base-ten numeral system, in the decimal system, as the
digits grow — beyond the 10’s, 100’s, 1000’s, etc. — we increase by powers of 10,
expanding more and more.
Binary works in a similar way, except it relies on powers of 2, not 10. So, a
computer uses longer strings of binary which correspond with digits beyond 1’s and
0’s.
For storing content like text, those strings are used to denote letters. A number 1
would be “A,” the number 2 would be “B,” and so on.
For images and other content, binary is used the same way. This is why images and
photos are displayed in pixels. Every pixel has a numerical value associated with
it, which tells the computer what colors to display.
CODING
You’ve seen the craze for learning code. But what exactly is coding? Coding is what
makes it possible for us to create computer software, apps and websites. Your
browser, your OS, the apps on your phone, Facebook, and this website – they’re all
made with code.
Coding 101
If you don’t know the first thing about coding, you’ve come to the right place.
We’ve put together a beginner’s tutorial which will give you all the background
information you need on coding, before you start learning it for real.
It starts with an explanation on the benefits of learning coding. Here, you’ll find
out what you’ll be able to do once you know how to work with code. Then, you’ll get
a deeper understanding of how coding works, and how the code you write gets
converted into an instruction that a computer can ‘understand’. Very satisfying to
know!
Finally – and most importantly – there’s a step-by-step action plan that will
outline the fastest and easiest way to get started in coding, and become a coder in
6 months.
First, you develop an analytical thinking while you learn to code. Instructing the
computer what to do helps us develop the habit of analyzing any process or problem
in a step wise manner. When w learn to break a process into small steps, it becomes
easy for us to solve real world problems by analyzing them in a better manner.
Learning to code also helps you land high paying jobs. Nowadays, programming jobs
are most sought after jobs and you can easily land a $100k job if you learn to code
efficiently in at least one programming language.
Another benefit of coding is continuous learning. If you are a programmer, you have
to learn new things daily to develop softwares. Computer science industry is a
relatively new industry. Due to this, there are various tools, techniques, and
programming languages launched every year. To compete in the job market, you need
to learn the new tools and programming language. Thus, continuous learning becomes
your habit.
Computers only understand binary language. On the other hand, humans cannot work
with binary language at a level more than simple addition or subtraction.
Therefore, we have developed high level programming languages to interact with the
computer.
There are different types of programming languages with different use cases.
FORTRAN and ALGOL are algorithmic languages mainly designed for mathematical and
algebraic computations.
COBOL and SQL are business oriented programming languages mainly used by businesses
in their operations.
Pascal, Basic, and Logo programming languages are mainly used for educational
purposes.
Python, Java, C++, C#, Ada, and Visual Basic are object oriented programming mainly
used for developing applications. These languages map each real world entity into a
software object. Hence, these languages are most suitable for creating complex
applications with numerous functionalities.
If you want to become a software engineer specialized in app development, you can
start with an object oriented programming language like Python, C++, or Java.
If you want to get into web development, you can start with HTML and CSS for Front
end web development. Subsequently, you can learn to code in JavaScript. Knowing
JavaScript will help you in getting started with various advanced tools for web
development.
If you want to get into data analytics, You can start with SQL or Python.
Learning coding has many benefits – whether you’re looking for a career in the
industry, starting a new hobby or just wanting to understand technology. Continue
onto the next page to find out about the benefits of learning coding. You might
also like this article on advantages of being a programmer.
First Website
So your dream is to have your own website. But you don’t have the coding skills to
create it.
Now’s the time to turn your dream into a reality! All you need to make a static
website is a knowledge of HTML and CSS code, the basic languages of websites. If
it’s a dynamic website you want – like a web application – you may also need
JavaScript and/or server-side scripting.
When you’ve written your code, you’re ready to upload your website to the Internet.
It’s as simple as that. For this, you’ll need a domain name (your website’s
address) and a web host (the company that manages your website’s server).
background-color: blue;
Obviously this is limited. A computer can display millions of different colors, and
remembering the names of every single one of them is impossible. And spare a
thought for that poor guy whose job it is to come up with the names!
background-color: #DDEEFF;
You’ve probably used hex codes before. You probably use a hex color picker to
generate your codes. But it’s likely you have no idea what a hex code means or how
it’s generated. Learning this is surprisingly easy and satisfying, and once you’ve
got your head around it you’ll be able to write your own hex codes without the need
for a color picker.
The six digits of a hex code are in fact three two-digit numbers, each representing
the level of red, green and blue. So #000100 is zero red, the darkest possible
shade of green without being totally black, and zero blue. #010101, because the
three values are all equal, is the darkest possible shade of grey, and #020202 is
the second darkest. And of course #000000 is black. But what about #FFFFFF for
white – what do the letters mean?
Hex codes use the hexadecimal number system to make it possible for 256 numbers to
be represented with only two digits. Instead of counting 0 through 10 like our
regular decimal number system, it counts 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D,
E, F and then 10, followed by 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D,
1E, 1F and then 20. Make sense?
This means that 256 numbers can be represented using only two digits, instead of
the 100 that are possible with our decimal number system (0 through 99). So the
highest possible two digit number is not 99 but FF (equal to 255). This is why
white is #FFFFFF, pure red is #FF0000, pure green #00FF00 and pure blue #0000FF.
Binary code is at the absolute heart of anything that goes on inside a computer –
and yet it’s something that most code tutorials don’t cover.
Here’s an explanation of the fundamentals of binary. At the end you should have a
basic idea of what all those 1s and 0s mean.
Binary Numbers
The binary number system is a base-two system, meaning it uses two distinct digits
– 0 and 1. The decimal number system we’re all familiar with is a base-ten system,
meaning it uses ten distinct digits – 0 and 1, but also 2, 3, 4, 5, 6, 7, 8 and 9.
Counting in the decimal system, when all ten digits have been exhausted, the next
number is represented as ’10’. In the binary system, it’s the exact same. After 0
and 1 comes 10. In fact, here are the first 15 numbers expressed in binary:
0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111.
As you can see, the binary system counts up in a logical order, and whenever a
number made up of entirely 1’s is reached, an extra digit is added. This is exactly
the same thing that happens in the decimal system when a number made up of entirely
9’s is reached.
As you can also see, there are 16 distinct numbers that can be represented in 4
digits or less (1 through 15 as well as 0). This can be calculated because 16 = 24.
Hexadecimal System
The hexadecimal system, or hex system, is closely related to the binary system.
Here’s why.
To represent the number 255 in binary, it takes 8 digits. That’s a lot, considering
the decimal system only needs 3 digits to represent 255. However, the hex system
goes one step further and allows the number 255 to be represented in only two
digits.
This is because the hex system is base-sixteen, and 162 = 256. In other words, the
highest number that can be represented with two digits in hex is 255. In other
words still, any 8-digit binary byte can be represented as a 2-digit hex byte.
This is great for both computers and humans. For computers, it saves space, and for
humans, it improves readability.
If you’re wondering, the 16 ‘digits’ that the hex system utilizes are the numbers 0
through 9 and then the letters A through F. F is the hex code for 15, and FF is the
hex code for 255.
Binary Letters
Binary code representing numbers is pretty uniform – there’s only one way to do it.
However, there are multiple methods of representing letters and symbols in binary
code. These methods are called encodings.
For example, the ASCII encoding assigns unique binary bytes to 128 different
characters. This makes it possible to encode any string of text. This is the string
‘Hello World’ encoded in ASCII:
Each byte represents a letter (except for the one that represents the space between
the words, of course). The spaces between the bytes are only there to make the
binary more readable for us. Computers do not read them.
In short, the fastest and easiest way to become a coder today is to focus on web
development. In fact, you can become a well-rounded web coder in just 6 months, and
this article outlines a month-by-month plan for how to do that. It’s a loose guide
and the aim is to give you a general idea of what coding languages you might want
to learn, and in what order.
Designing and building your own simple website is the best way to learn HTML and
CSS. If you use training like Treehouse, you’ll be walked through this process. You
can also research HTML and CSS on your own, but it will be hard. It’s kind of like
having to first find the pieces of a jigsaw puzzle before you can assemble them.
It should take about a month to get a good, solid HTML and CSS foundation. Then,
you can move on to some real programming…
it requires no installation
you can use it to build upon your HTML and CSS website.
JavaScript coding is sometimes called front-end development, because JavaScripts
are run on a user’s computer. Conversely, back-end development refers to scripts
run on a web server.
If you use Treehouse, you’ll get the opportunity to enhance your walked-through
HTML and CSS website with JavaScript. Then, when you feel you have a good grasp of
the language, design and build your own web app with JavaScript. To do this, you
will want to learn how to plan, design and build a coding project.
JavaScript is an exciting language with many possibilities, and will go a long way
towards you becoming a coder. Take two months to learn and start using it.
Many websites use back-end scripts to fetch data from databases, or to share
content between multiple web pages. PHP is the most popular coding language for
back-end development. In more recent times, Ruby on Rails has emerged as a bit of a
competitor to PHP.
Choose one of the two to learn and specialize in. Many coders find PHP is more
beginner-friendly, while Rails has more of a learning curve. But the choice is up
to you.
If you use Treehouse, you’ll be walked through how to make a dynamic, interactive
web application with either PHP or Rails. Then, create your own simple web
application – like you did with JavaScript, but this time using PHP or Rails.
Again, give yourself two months to learn and start using either PHP or Rails. If
you want to learn both, give yourself at least two months for each one.
There are two ways you can do this. The first option is to set up a personal
portfolio website, and sell yourself by showcasing the websites and web
applications you’ve created in your 6 months learning coding. The second option is
to build a big-time web application – one that makes use of everything you’ve
learnt, which you will deploy online for the world to see and use. This will take
you more than a month, but it will be worth it.
The final step is to go off job-hunting. You can search for coding jobs in your
area, or alternatively, you can choose to be a self-employed coder, either as a
freelancer or by starting a tech business.
You’ve invested in good coding training, and you have some basic code skills under
your belt. If you’re up for the challenge, let go of the training and start working
on your own, self-directed project. You could choose to make a website, an app, or
whatever is relevant to what you’re learning.
Building a project is the fun part of coding, and it gives you useful experience.
So you want to make sure you do it well. We’ve put together a series of articles to
help you accomplish this. First, you’ll gather ideas for your first programming
project. Next, you’ll plan your programming project and lastly, build it!