Learn Basics of Coding
Learn Basics of Coding
Acknowledgement
I would like to take this opportunity to express my heartfelt
gratitude to the following which have played a significant role in the
creation of this “Learn basics of coding” book:
(4-5)
2. Introduction and Fundamentals of Programming Languages.
(6-9)
(10-12)
(13-16)
5. Basic understanding of C programming language.
(16-17)
Chapter 1
What’s Code and How it works ?
Computers are becoming so embedded into our daily lives it's almost impossible to
imagine a world without them.
But computers would be nothing without the code that tells them what to do.
In this lesson you’ll learn what code is and how coders use it to help the world run
smoothly. You’ll also learn about the World Wide Web, and two coding languages that
make it possible.
What is code?
Coders are people who understand and work with these languages on a daily basis.
So, what does a coder do? Coders are the architects and builders of the digital
world. They use code to create programs that run on most of the machines you see
and use every day: from laptops to phones, TVs, cars and internet-connected
fridges.
In fact, the device you’re using right now to read this lesson ( ebook ) has a
complex program that makes sure the screen, speakers, microchip and ‘you’ work
together in harmony.
To build these programs, coders write small sequences of tasks that they want the
machines to perform. We call these sequences ‘algorithms’.
For example, cars, have computer programs that monitor all of their systems. An
algorithm within a car’s program could be the following: “If a button is pressed on
the car’s dashboard, make the engine status appear on the screen.”
The amount of code can range from just a thousand lines, which a simple mobile
phone game would need to run, to over 2 billion lines, like the code that powers
Google’s search engine.
Let’s focus on one of the world-changing applications of code: the World
Wide Web.
Did you know the Internet and the Web are actually different things?
In fact, the World Wide Web is just an application that's been built using
the Internet.
Well, when you click on a link or type a web address, you’re actually
asking another computer to send you an HTML file. That file contains the
information your browser needs to display a web page.
Now that we’ve explored the basics of coding, from computer programs,
to algorithms, to HTML and CSS, it’s time to continue your learning. Try
your hand at writing a bit of code yourself: it’s not as difficult as you
might think.
Chapter 2
Introduction and Fundamentals of
Programming Languages.
The field of coding is constantly evolving to keep up with all of the new
applications, computers and digital devices that are developed every year.
Hundreds of programming languages now exist, with new ones emerging all the
time.
In this lesson we’ll explore why there are so many programming languages, how
these languages are used, and what the future holds for code.
Kotlin, Rust and Julia. No, not the names of pet dogs. These three are just a
tiny example of the number of programming languages available - today, there
are over 250 of them.
The reason is that it’s much quicker to communicate in languages that are
built for a specific task, rather than to use a generic one for everything. And
as computer programming has evolved, so have the ways that coders build
programmes.
Let’s take a look at the fundamentals of coding in more detail and some of
its most common applications.
The most basic language that computers understand is called ‘binary’. You
might have heard this term before. Binary code is made up of ones and zeros,
and these are the only characters that the language uses. It’s easy for
computers to understand but incredibly difficult for humans. So not even the
best coders write programs using it. Instead, they write in their preferred
programming language and it gets converted into something a machine
understands.
Let’s look at an analogy that will help us to understand what abstraction is.
Imagine you’re designing a house. It’s much faster and easier to draw a basic
sketch, outlining the shape, the materials, and the fittings, than it is to go into
detail about every nail, brick, and plank of wood. As long as you communicate
the essence of that house, the architects and builders will fill in the gaps.
‘C’ and ‘Assembly’: Computers can understand them relatively easily. This
means they can translate the code very quickly and they don't need much
memory power to run programs. This makes ‘C’ and ‘Assembly’ perfect for
building smaller computers that tell devices such as cars, digital watches,
thermostats and traffic lights how to work.
Languages like “C++” and “Swift” are written at a higher level of abstraction.
These are easier for people to work with, but a little resource intensive for
machines to read. Coders use these languages to build things like the mobile,
tablet, and desktop apps that you use on a daily basis. These languages are
really versatile as they need to perform lots of different tasks.
If you look at how a social network application is coded, then behind the
photos, updates, and likes is a huge database that securely stores data from its
millions of users. By manipulating the data with SQL, social networks can
recommend friends, target ads, and show you relevant content.
But, the most commonly used programming
language in the world is "JavaScript". Whenever
you're on a web page and you see a game,
interactive chart, or lots of moving elements,
you're seeing JavaScript at work. In fact, 95% of
the 10 million most popular web pages use it.
JavaScript is a 'scripting' programming
language, which is a family of languages
designed to be as friendly as possible for
coders.
Now that we’ve explored some of the applications of code, take some time to
research the computer programs you use on a daily basis. Put on your detective
hat and search online to see which languages were used to build them, and
what’s happening behind the scenes.
To wrap up, there are many programming languages out there, each used to
achieve different goals. A mix of low, mid and high level languages enable
coders to write for a range of purposes, whether it’s C and Assembly to program
smaller computers and devices, or SQL and JavaScript to manage databases, and
JavaScript for bringing interactivity to websites.
Almost all companies now use digital systems to conduct their day-to-
day business. They use advanced accounting software for smart
bookkeeping; teams communicate by email, messaging, or video
conference; vendors track sales through sensors and databases; and often
retailers sell products that only exist in the digital world.
In the last 50 years the speed and size of computer microchips has
changed massively. The computers that put a man on the moon cost $3.5
million and were the size of a car. Today, the average smartphone is 12
million times faster and fits in your pocket.
ATMs use APIs connected to banks all over the world to check how much money
you have in your account. If you want to get money out in Paris, the ATM program
quickly contacts your bank in London, deducts the amount off your balance,
transfers it to the ATM company, and you get your cash. All in a few seconds, and
all because of APIs.
When you book a hotel room through a centralised booking site, like
Booking.com, you are relying on an API that connects the booking form with
room tracking systems in thousands of hotels all over the world. If the hotel
tells the booking site they have a free room, you can book away!
Music streaming applications like Spotify track which songs are being played the
most across the world. They use this data to automatically generate playlists that
feature the most popular artists and songs, often tailored specifically to your
musical tastes.
Using APIs, programs can communicate with each other, which in turn helps us to
complete tasks faster and more efficiently in our daily lives and in the
workplace.
The world of code is constantly evolving. Let’s briefly look at two important
trends in technology that are shaping how people code: artificial intelligence and
machine learning.
Artificial intelligence and machine learning are both branches of computer science,
and both contribute to the development of machines being able to make smarter
decisions.
These exciting new technologies are providing us with new ways of looking at
old problems, and are helping to transform the way coders can shape the
digital and physical worlds.
So that was a brief introduction to some of the ways code affects our
everyday lives. Take a look around your home, or your workplace.
And if not, what around you do you think could benefit from these
technologies?
Chapter 4
Working in code: Developers &
everyday industries
Today’s industries are becoming more and more reliant on digital technologies
to succeed. But whilst code is what powers the work we do on a daily basis, most
of us are only just beginning to harness its full potential.
In this lesson you’ll learn why code is important in the modern workplace, and why almost
everyone can benefit from having a basic understanding of code.
Today, many manual and repetitive tasks are automated. This has led to massive
increases in efficiency and the numbers of new products and services. In an
ideal world, we would let computers do things they’re good at, leaving humans to
do the things we’re good at.
For example,
machine learning allows computers to complete regular tasks in an ever-more
efficient way, by automatically learning what works best from past experiences.
The rapid changes in the world of digital technology means jobs we can't even
imagine today will be created. So to stay ahead in the modern workplace we
need to learn how to work with these new coding languages, devices, and
applications, and use them to enhance our own productivity.
Mobile Developers use programming languages like Java and Swift to make the
apps and games you use on your phone. Since the Apple and Google app stores
were launched 10 years ago, the world of apps has enjoyed enormous popularity.
There are now millions to choose from, no matter what kind of smartphone you
have.
Data Scientists use code to gather, analyse and understand massive amounts of
data. They are becoming increasingly in demand as companies look for experts
to help their teams make smarter business decisions. By using data and evidence,
teams can understand the real cost or benefit of different choices - from the
value of placing an advertisement, to a breakdown of the time that’s spent on
different business activities.
System Administrators are the mechanics of the digital world. They often work in
larger companies making sure that their complex computer systems are
configured properly and working effectively. Most are highly skilled
professionals, often required to look after both the digital software and the
physical hardware.
And finally, Robot Programmers of course use code on a daily basis make all
sorts of robots work. Within the manufacturing industry, robots are everywhere,
and they all need to be programmed with maneuvering and decision-making
capabilities to do their jobs properly. Some robots put out fires, some explore
outer space, and others build cars on assembly lines.
These are just four examples of jobs that utilise coding, but there are
hundreds and hundreds of others out there, in almost every industry. And as
code becomes increasingly important, so will the jobs that utilise it.
In addition to full-time coding roles, some jobs also utilise code alongside
their day-to-day work, despite not explicitly being coding jobs. Here are a few
examples:
Researchers, journalists, and marketers now use task automation tools like If
This Then That and Zapier to make the laborious task of collecting data from
multiple sources much easier. With just a few clicks, they can set up these apps
to collate information from multiple web pages, post across multiple social
media accounts, or notify them when their name is mentioned online.
Designers, art directors and other creative professionals can benefit from basic
coding knowledge too. Where once they would have been limited to a
relatively static and constrained medium, they now can use code to explore
new ways to express ideas and create experiences.
Last but not least, engineers in many fields often write computer programs
to help test and design their creations - from fine-tuning car dashboards,
to simulating passenger movement at airports. Whilst most of their time is
spent completing engineering work, many of them now need a basic
understanding of a coding language like Python to keep up in their field.
Now you know a bit more about code in the world of work, do a little
research into the industry you work in, or another one that interests you.
What new technologies are being developed that might change the way you
work?
With the world changing faster than ever, it pays to stay ahead of the curve
Chapter 5
Basic Understanding of C language
Learning everything about the C language is a vast undertaking, but I can
break it down into several sub-topics and explain each one in a simple
manner. I will provide examples and anecdotes to help you understand,
and I'll also ask you questions to test your understanding. Once you submit
your answer, I'll identify any mistakes and provide feedback. Let's begin!
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
Question: What is the purpose of the #include <stdio.h> line in the above
code?
Feedback: The #include <stdio.h> line is a preprocessor directive that
includes the standard input/output library, which contains functions like
printf() for displaying output. Good job!
Explanation: Variables are used to store data in a program, and data types
define the kind of data that can be stored. C provides various built-in data
types, such as int for integers, float for floating-point numbers, and char
for individual characters.
Example: Here's an example that declares and uses variables of different
data types:
#include <stdio.h>
int main() {
int age = 25;
float height = 1.75;
char grade = 'A';
return 0;
}
Question: What is the data type of the variable grade in the above code?
Feedback: The data type of the variable grade is char. Well done!
Now, let's move on to the next sub-topic.
#include <stdio.h>
int main() {
int score = 85;
return 0;
}
I am writing this letter to express my deepest gratitude for
your support and for choosing to read my book, Learn
Basics of Coding.