Computer Programming for Absolute Beginners
eBook - ePub

Computer Programming for Absolute Beginners

Learn essential computer science concepts and coding techniques to kick-start your programming career

  1. 430 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Computer Programming for Absolute Beginners

Learn essential computer science concepts and coding techniques to kick-start your programming career

Book details
Book preview
Table of contents
Citations

About This Book

Get to grips with the building blocks of programming languages and get started on your programming journey without a computer science degree

Key Features

  • Understand the fundamentals of a computer program and apply the concepts you learn to different programming languages
  • Gain the confidence to write your first computer program
  • Explore tips, techniques, and best practices to start coding like a professional programmer

Book Description

Learning how to code has many advantages, and gaining the right programming skills can have a massive impact on what you can do with your current skill set and the way you advance in your career. This book will be your guide to learning computer programming easily, helping you overcome the difficulties in understanding the major constructs in any mainstream programming language.

Computer Programming for Absolute Beginners starts by taking you through the building blocks of any programming language with thorough explanations and relevant examples in pseudocode. You'll understand the relationship between computer programs and programming languages and how code is executed on the computer. The book then focuses on the different types of applications that you can create with your programming knowledge. You'll delve into programming constructs, learning all about statements, operators, variables, and data types. As you advance, you'll see how to control the flow of your programs using control structures and reuse your code using functions. Finally, you'll explore best practices that will help you write code like a pro.

By the end of this book, you'll be prepared to learn any programming language and take control of your career by adding coding to your skill set.

What you will learn

  • Get to grips with basic programming language concepts such as variables, loops, selection and functions
  • Understand what a program is and how the computer executes it
  • Explore different programming languages and learn about the relationship between source code and executable code
  • Solve problems using various paradigms such as procedural programming, object oriented programming, and functional programming
  • Write high-quality code using several coding conventions and best practices
  • Become well-versed with how to track and fix bugs in your programs

Who this book is for

This book is for beginners who have never programmed before and are looking to enter the world of programming. This includes anyone who is about to start studying programming and wants a head start, or simply wants to learn how to program on their own.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Computer Programming for Absolute Beginners by Joakim Wassberg in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Ciencias computacionales general. We have over one million books available in our catalogue for you to explore.

Information

Section 1: Introduction to Computer Programs and Computer Programming

This section gives you an understanding of the relationship between computer programs and programming languages, as well as providing you with an understanding of how code is executed on a computer.
This section has the following chapters:
  • Chapter 1, Introduction to Computer Programs
  • Chapter 2, Introduction to Programming Languages
  • Chapter 3, Types of Applications
  • Chapter 4, Software Projects and How We Organize Our Code

Chapter 1: Introduction to Computer Programs

Programming is the art and science of writing instructions that a computer can follow to accomplish a task. This task can be playing a game, performing a calculation, or browsing the web, for example. However, before we can learn how to write programs, we should understand what a program is and how a computer can understand and execute the instructions we give it. In this chapter, we will study this in more detail, along with the basics of what a computer is, how it works, and its history.
Even a basic level of understanding of these topics will help us later on when we discuss the different aspects of writing programs, as we can then relate to how the computer will treat the code we write.
In this chapter, we will cover the following topics:
  • A perspective on the history and origins of the computer
  • Background knowledge of the original ideas behind programming
  • Understanding what a computer program is
  • Learning how a computer program works
  • An understanding of what machine code is

A brief history of computing

Humans have always built tools and made innovations to make life more comfortable and to allow us to do more things faster and more efficiently. We need to go back in time a few hundred years in order to see the first attempts at building a tool that could resemble a computer. However, before we do that, we might want to define what a computer is. Wikipedia offers the following definition:
A computer is a machine that can be instructed to carry out sequences of arithmetic or logical operations automatically via computer programming.
So, a computer is a programmable machine that performs arithmetic or logical operations. Let's review a few inventions from the past using this definition to ascertain which of them could be considered a computer.
To begin, we can rule out the Jacquard machine, which was the automated loom invented in the early years of the 19th century. These looms could be programmed using punch cards, but they produced woven silk, which, of course, is not the result of an arithmetic or logical operation. Programmability, using punch cards, was an idea that survived well into the computer age, but these looms were not computers.
If we go even further back in time, we find devices such as the abacus that helped us to get the results of arithmetic operations; however, they were not programmable.
In the 1770s, Pierre Jaquet-Droz, a Swiss watchmaker, created some mechanical dolls that he called automata. These dolls could read instructions and could thereby be considered programmable, but they did not perform arithmetic or logical operations. Instead, he created one doll that could play music, one that could make drawings, and one that could write letters (they are referred to as the musician, the draughtsman, and the writer):
Figure 1.1: The Jaquet-Droz automata (photograph by Rama, Wikimedia Commons; Cc-by-sa-2.0-fr)
Figure 1.1: The Jaquet-Droz automata (photograph by Rama, Wikimedia Commons; Cc-by-sa-2.0-fr)
In order to see something that resembles a computer, we will need to look at Charles Babbage's inventions. He originated the concept of a programmable computer with his ideas for a machine, called the Difference Engine, and later, a more advanced version called the Analytical Engine. Of the two, the Analytical Engine was particularly groundbreaking as it could be programmable, which meant it could be used to solve different problems. He presented his work in the first half of the 19th century, and even if the machines were never completed, we can agree that Babbage is a very important person behind the basic concept of the programmable computer.
During the first half of the 20th century, we witnessed some analog computers, but it was not until the second world war, and the years following, that we saw the birth of real digital computers. The difference between an analog and a digital computer is that the former is a mechanical machine that works with an analog input such as voltage, temperature, or pressure. In comparison, a digital computer works with input that can be represented by numbers.
Many people consider the Electronic Numerical Integrator and Computer (ENIAC), constructed by J. Presper Eckert and John Mauchly between 1943 and 1946, as the first digital computer because it was the first one that was both completed and fully functional:
Figure 1.2: Betty Jean Jennings and Fran Bilas, both programmers, operate ENIAC's main control panel – U. S. Army Photo (Public Domain [PD])
Figure 1.2: Betty Jean Jennings and Fran Bilas, both programmers, operate ENIAC's main control panel – U.S. Army Photo (Public Domain [PD])
Since then, we have seen tremendous development up until the point we are at today. However, even though our modern computers can do so much more and at a much faster rate than these earlier inventions, the basic principles of how they operate remain the same.

A brief history of programming

A programmable computer needs to be, well, programmed. So, of course, the history of programming goes hand in hand with the evolution of computers.
In 1833, Charles Babbage met Ada Lovelace, daughter of poet Lord Byron. She became very impressed and interested in Babbage's plans for his programmable machines, and their collaboration began. Among other things, she wrote some notes outlining her ideas for how the Babbage Analytical Engine could be programmed. We can call her the inventor of programming, even if we had to wait over 100 years until we had the machine that could make her ideas come true. Her status today is summarized in a History Extra article, from 2017, by James Essinger:
Today, Ada is quite rightly seen as an icon of feminist scientific achievement, a heroine of the mind, and one of the earliest visionaries in the early history of the computer.
In her notes, Lovelace did a couple of remarkable things. The first was that she wrote an algorithm for how Bernoulli numbers, a sequence of rational numbers often used in number theory, could be calculated by the Analytical Engine. This algorithm is considered by many to be the first computer program. Second, she outlined the future of what these machines could do, and, in her vision, she saw that they could be used to draw pictures and compose music. The fact is that when we finally could build a computer, the way they were programmed was heavily influenced by her ideas:
Figure 1.3: Ada Lovelace, aged 17 (portrait by Joan Baum; PD-Art)
Figure 1.3: Ada Lovelace, aged 17 (portrait by Joan Baum; PD-Art)
The first digital computers were programmed using machine code – the only thing a computer understands. Later in this chapter, we will talk more about machine code and explore what it is. And, as you will discover, it is just a sequence of numbers.
In 1949, John Mauchly proposed something called Brief Code, which was later renamed to Short Code. Short Code can be considered to be one of the first higher-level programming languages. A higher-level programming language is a way for us to write inst...

Table of contents

  1. Computer Programming for Absolute Beginners
  2. Why subscribe?
  3. Preface
  4. Section 1: Introduction to Computer Programs and Computer Programming
  5. Chapter 1: Introduction to Computer Programs
  6. Chapter 2: Introduction to Programming Languages
  7. Chapter 3: Types of Applications
  8. Chapter 4: Software Projects and How We Organize Our Code
  9. Section 2: Constructs of a Programming Language
  10. Chapter 5: Sequence – The Basic Building Block of a Computer Program
  11. Chapter 6: Working with Data – Variables
  12. Chapter 7: Program Control Structures
  13. Chapter 8: Understanding Functions
  14. Chapter 9: When Things Go Wrong – Bugs and Exceptions
  15. Chapter 10: Programming Paradigms
  16. Chapter 11: Programming Tools and Methodologies
  17. Section 3: Best Practices for Writing High-Quality Code
  18. Chapter 12: Code Quality
  19. Appendix A: How to Translate the Pseudocode into Real Code
  20. Appendix B: Dictionary
  21. Other Books You May Enjoy