Computer Programming for Absolute Beginners

Book description

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.

Table of contents

  1. Computer Programming for Absolute Beginners
  2. Why subscribe?
  3. Contributors
  4. About the author
  5. About the reviewer
  6. Packt is searching for authors like you
  7. Preface
    1. Who this book is for?
    2. What this book covers?
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Reviews
  8. Section 1: Introduction to Computer Programs and Computer Programming
  9. Chapter 1: Introduction to Computer Programs
    1. A brief history of computing
    2. A brief history of programming
    3. What is a program?
      1. How does a computer program work?
    4. Understanding the binary system
      1. Understanding ASCII and Unicode
      2. Representing other forms of data
      3. Boolean algebra
      4. Machine code – the native language of the computer
      5. Example machine code
    5. Summary
  10. Chapter 2: Introduction to Programming Languages
    1. Why do we have programming languages?
    2. How programming languages have evolved?
      1. The modern era of programming languages
      2. Why so many languages?
    3. The family tree of programming languages
    4. Translating code into something that the computer understands
      1. Interpreting
      2. Compiling
      3. Comparing interpretation and compilation
      4. Languages that both compile and interpret
    5. Syntax and the building blocks of a programming language
      1. Keywords
      2. Operators
      3. Code blocks
      4. Relations to mathematics
    6. Summary
  11. Chapter 3: Types of Applications
    1. Standalone applications
    2. Client-server applications
      1. Example of a chat application
      2. Example of an email client
      3. Client-server, a two-part solution
    3. Web applications
      1. Example of a social network
      2. What makes web applications unique?
    4. Mobile applications
    5. Distributed applications
      1. SETI@home
      2. Peer-to-peer networks
    6. Cloud-based applications
      1. Advantages of adopting cloud-based applications
      2. Cloud service models
    7. Other types of applications
      1. Systems software
      2. Programming software
      3. Serverless applications
    8. Summary
  12. Chapter 4: Software Projects and How We Organize Our Code
    1. Code modules
    2. Working with software projects
    3. Working with packages to share code
      1. Package managers
    4. Avoiding conflicts using namespaces
      1. Delving into namespaces
      2. Namespaces in JavaScript
      3. Namespaces in Python
      4. Namespaces in C plus plus
      5. Namespaces in other languages
      6. Using namespaces in our calculator application
    5. Summary
  13. Section 2: Constructs of a Programming Language
  14. Chapter 5: Sequence – The Basic Building Block of a Computer Program
    1. The importance of sequences
      1. Defining the problem
      2. The solution to the problem
      3. Understanding statements
      4. Compound statements
      5. Separating statements
      6. Making the code readable by indenting and using empty lines
      7. Making the code understandable using comments
    2. Summary
  15. Chapter 6: Working with Data – Variables
    1. Declaring and initializing variables
      1. Understanding variables
    2. Primitive data types
      1. Boolean type
      2. Numeric type
    3. Composite type
      1. Operators – things we can do with variables
      2. The concept of values and reference variables
      3. Working with numbers
      4. Manipulating strings
    4. Summary
  16. Chapter 7: Program Control Structures
    1. Controlling the execution path
      1. Selection statements
      2. Iteration statements
      3. Conditional statements
    2. Selection with the if statement
    3. Selection with the switch statement
    4. Iteration with the for loop
    5. Iteration with the while loop
    6. Iteration with the do while loop
    7. Iterating over sequences using for each
    8. Summary
  17. Chapter 8: Understanding Functions
    1. Deciding what goes into a function
    2. Writing a function
      1. Moving code into a function
    3. Returning values from a function
    4. Function arguments
    5. Functions in action
      1. Splitting the code further
      2. Putting it all together
    6. Local and global variables
    7. Summary
  18. Chapter 9: When Things Go Wrong – Bugs and Exceptions
    1. Understanding software bugs
      1. NASA's Mars Climate Orbiter
      2. The Morris worm
      3. Defining a software bug
    2. Understanding types of software bugs
      1. Arithmetic errors
      2. Division by zero
      3. Arithmetic overflow/underflow
      4. Logical errors
      5. Syntax errors
    3. Finding bugs using a debugger
      1. Breakpoints
      2. Working with exceptions
      3. Common reasons for exceptions
      4. Exceptions and the call stack
    4. Handling exceptions
    5. Summary
  19. Chapter 10: Programming Paradigms
    1. Understanding structured programming
      1. Statements
      2. Program state
      3. Comparing imperative and structured programming
    2. Understanding object-orientated programming
      1. Classes and objects
      2. Understanding encapsulation
      3. Class methods
      4. Inheritance
    3. Understanding functional programming
      1. Pure functions
      2. Mutable and immutable data
      3. Avoiding side effects
      4. Declarative programming
      5. First-class functions
    4. Understanding logic programming
    5. Other paradigms
      1. Function-level
      2. Array programming
      3. Quantum programming
    6. Multi-paradigm languages
    7. Summary
  20. Chapter 11: Programming Tools and Methodologies
    1. Understanding version control systems
    2. Unit testing
    3. Integration testing
    4. Other types of tests
    5. Software releases
    6. Understanding software deployment
      1. Deployment automation
      2. Code maintenance
    7. Software development process methodologies
      1. Waterfall development
      2. Spiral model
      3. Agile development
    8. Summary
  21. Section 3: Best Practices for Writing High-Quality Code
  22. Chapter 12: Code Quality
    1. Defining code quality
      1. CISQ's quality model
      2. Understanding user quality
      3. Putting them together
    2. Writing code with readability in mind
      1. Using comments and documentation wisely
      2. Using names as documentation
      3. Reading other people's code
      4. Rewriting your code
    3. Writing code with efficiency in mind
      1. Removing redundant or unnecessary code
      2. Optimizing the use of memory and processors
      3. Using efficient algorithms
    4. Is smart code smart?
    5. Code quality – best practices
      1. Limiting line length
      2. Limiting function/method length
      3. Avoiding deep nesting
      4. Using the DRY principle
      5. Using code conventions
    6. Summary
  23. Appendix A: How to Translate the Pseudocode into Real Code
    1. The pseudocode examples
      1. Hello world in pseudocode
      2. Variables declaration in pseudocode
      3. The for loop in pseudocode
      4. Functions in pseudocode
      5. while loops, user input, if, and for loops in pseudocode
    2. C plus plus
      1. Hello world in C plus plus
      2. Variable declaration in C plus plus
      3. The for loop in C plus plus
      4. Functions in C plus plus
      5. while loops, user input, if statements, and foreach loops in C plus plus
    3. C#
      1. Hello world in C#
      2. Variable declaration in C#
      3. The for loop in C#
      4. Functions in C#
      5. while loops, user input, if statements, and foreach loops in C#
    4. Java
      1. Hello world in Java
      2. Variable declaration in Java
      3. The for loop in Java
      4. Functions in Java
      5. while loops, user input, if statements, and foreach loops in Java
    5. JavaScript
      1. Hello world in JavaScript
      2. Variable declaration in JavaScript
      3. The for loop in JavaScript
      4. Functions in JavaScript
      5. while loops, user input, if statements, and foreach loops in Java
    6. PHP
      1. Hello world in PHP
      2. Variable declaration in PHP
      3. The for loop in PHP
      4. Functions in PHP
      5. while loops, user input, if statements, and foreach loops in PHP
    7. Python
      1. Hello world in Python
      2. Declaring variables in Python
      3. The for loop in Python
      4. Functions in Python
      5. while loops, user input, if statements, and foreach loops in Python
  24. Appendix B: Dictionary
    1. A
    2. B
    3. C
    4. D
    5. E
    6. F
    7. G
    8. H
    9. I
    10. J
    11. K
    12. L
    13. M
    14. N
    15. O
    16. P
    17. R
    18. S
    19. T
    20. U
    21. V
    22. W
  25. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Computer Programming for Absolute Beginners
  • Author(s): Joakim Wassberg
  • Release date: July 2020
  • Publisher(s): Packt Publishing
  • ISBN: 9781839216862