ebook img

Computer Programming Fundamentals: The Principles and Concepts of Programming Languages and the Best One for You to Learn PDF

157 Pages·5.361 MB·
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Computer Programming Fundamentals: The Principles and Concepts of Programming Languages and the Best One for You to Learn

Computer Programming Fundamentals The Principles and Concepts of Programming Languages and the Best One for You to Learn By A. B. Lawal Computer Programming Fundamentals The Principles and Concepts of Programming Languages and the Best One for You to Learn ISBN : 9788835823681 Copyright © 2020 AB Prominent Publisher All rights reserved. Published in the United States Limit of Liability/Disclaimer of Warranty All information given in this book is based on my own research and does not constitute technical, financial or professional advice. The author and publisher cannot be held responsible for the consequences of actions taken, or any consequences through inaction, as a direct or indirect result of the information in this book. All trademarks are the property of their respective owners. All information is used at your own risk. Whilst all content is checked for accuracy, no information contained within this book or in any of its links is to be used without taking technical, professional and marketing advice first. Anyone seeking advice should consult an Independent Advisor. The author and publisher of this book are not liable or responsible for any other websites or services linked to or from it. It is forbidden to reproduce any part of this book in any form or medium . Reselling is prohibited . Table of Contents Table of Contents 1. Getting Started 1.1. Why Take This Course? 1.2. Steps and Sequence 1.3. Computer Programming Ideas Idea Number 1 Idea Number 2 1.4. Source Code 1.5. Why Code Looks Like Code 1.6. Getting the Computer to Understand You: The Machine Code 1.7. Pros and Cons of Compiler and Interpreter 1.8. What's the Deal with All the 1's and 0's? 1.9. The Binary Code 1.10. 8-Bit/64-bit Computer Architecture 1. The Rules of Programming Languages 2.1. Introduction to the Syntax of a Programming Language Case Sensitivity Statements Whitespace Comments Keywords 2.2 Case Sensitivity and Capitalization 2.3. Writing Statements Ending Statements 2.4 Using Pseudocode 2.5 Dealing with Whitespace 2.6 Adding Comments to Your Code 2.7 Keywords 1. Working with Data 3.1. Input, Output and Everything In-between 3.2. Creating and Naming Variables The Camel Case 3.3. Using Variables and Operators 3.4. Choosing and Using Data types 3.5 Applying Data Type Numeric Variables Boolean Values Text/Character Data type Built-in Primitive Data Types 3.6. Creating and Using Constants 3.7. Understanding Language Differences 1. Managing Program Flow 4.1. Introduction to Program Flow 4.2 Making Choices and Conditions Brace Styles If/ELSE Statements 4.3. Creating Complex Conditions Multiple Branches 4.4 Creating Loops While Loop Infinite Loop Loop Counter For Loop For-In/For-Each Loop 1. Making Things Modular 5.1. Introduction to Grouping and Separation 5.2. Creating Functions How to Run/Call a Function Code Reuse 5.3. Returning Values and Using Parameters Functions with Parameters 5.4 Using Recursion Recursive Function Calls 5.5. Creating and Using Composite Data types 5.6. Using Arrays and Collections Difference Between Composite Data type and Arrays Basic Array Characteristics Collections 5.7 Introduction to Object-Oriented Programming What Are Objects? Class and Object Properties and Methods of a Class Instantiation 1. Programming in the Real World 6.1 Introduction to Frameworks and Libraries Introduction to Library Standard Library Specialized Libraries Libraries vs Frameworks 6.2 Software Development Kit - SDK 6.3 Application Programming Interface - API 6.4 How to Choose the Best Programming Language to Learn My Top 3 Suggestions for a First Programming Language 1. My Honest Advice Final Words 1. Getting Started I'm not going to begin by trying to persuade you that programming is important. You already know this. Unlike some, I won't begin by pretending that everything about programming is always simple and easy. A lot of it is, some of it isn't and takes time, but you already know this too. So instead, let me begin by telling you why this book is different and how it will make learning programming at least easier, if not always easy. You see, most people would have you jump straight into one programming language. We're not going to do that here. Instead, we will first explore a couple different languages and use them to make sense of programming itself. What I really mean is that you’ll get clear on the most important ideas, concepts and the rules that lie at the heart of all programming languages. After all the basics make sense, you will ultimately know which programming language is the best for you to learn. We'll cover the terminology, the jargon and the words we use every day in programming: terms like algorithms, recursion, object orientation, static typing, pseudocode, multi-threading and lots more. But it's not sufficient to be able to talk like a programmer. More than that. You'll understand the meaning behind those words so when you want to, you can think like a programmer and there is huge flexibility in that thinking. Programming is not one thing. It is not fixed. It’s different for different people. For some, programming is corporate; it's all business. For others, programming is game development, art, music, language or telling a robotic arm how to deal cards. If you want to be able to take this infinitely reconfigurable machine (robot), one that can be different from moment to moment, and turn it into the machine that does what you want it to do you need to first have an idea in your head and then turn it into a computer program. It's not about what language you use or what operating system you have. It is about how you think. 1.1. Why Take This Course? You could take this course for a lot of different reasons. Let's quickly cover three of them. 1. You want to become a programmer or software developer First, you want to become a programmer or a software developer. If you want to build programs for a desktop or laptop, for the web or a phone, whether it's Mac, windows, Linux or whatever else may come in the future, what we're covering here are the core ideas and skills you will always need and always come back to . 1. You work with, manage or live with a programmer or software developer You may have no intention of becoming a programmer right now, but you do work with programmers, manage or live with them, and you've been thinking it might be useful to know more about their world and what's important to them. Maybe you just want to get a better idea of what exactly a programmer actually does all day long. You'll get that here. 1. You’re not sure if it’s just your passion What if you're not completely sure about this? What if it’s just your passion? Perhaps you're worried this might not be for you or maybe it's too late. Maybe if you were wired up the right way, surely would have done this already. It's okay. Programming doesn't have to be the grand passion of your life. If it is, fantastic! But right now, I don't even need you to be totally sure about what you plan to do with this knowledge. But is there something in it you find interesting? That's good enough. We can work with that. When you read about it or see it on films or TV, is there something about programming and coding that looks interesting or a little intriguing? It might also sometimes look a bit intimidating, unfriendly, frustrating or boring. Sure. It can be those things. For some people it's just a job. But programming can be incredibly rewarding both intellectually and in your career. Whatever background you're coming from, I guarantee you that learning more about computer programming is always worth it. 1.2. Steps and Sequence To learn anything well, we should always be unashamed to ask even the most basic question. So, what is a computer program? Okay, I get it. That sounds too easy. I can take a room full of random people and ask, what is a computer program? I will get answers because everybody kind of knows that… A computer program is a way to tell a computer what to do. That's true but useless. It doesn't help us here. Or I'll get… A computer program is a list of instructions. This is also true and a bit more specific but still not very helpful. What does this really mean? What kind of instructions would be in such a list? What do they look like? How do you tell a computer to do something and what can you actually tell it to do? Oh sure. It would be great if we could actually just talk to it but as you can guess, our instructions need to be a little more specific. So... A computer program is a collection of instructions that can be executed by a computer to perform a specific task. Now before I show you some, I will admit that if you take them one by one, the instructions we can use in a computer project program are going to seem a little simple, unremarkable, unimpressive and a bit dull because they're simple things like add one number to another number. That's the kind of thing we can actually ask a computer to do. Add one number to another number, display the word “hello” on the screen, beep for one half of a second. These are specific self-contained and very small instructions. Many people have heard this but they don't want to admit that the idea of computer a program just being a collection of teeny tiny instructions is satisfying. It doesn't feel like a good enough answer. Here's what I mean. If you've ever tried one of these many, “learn to code interactively” programming tutorials on the web, they'll usually have you begin by typing some simple instructions. Whether you're trying to learn JavaScript, Swift or Python, what they ask you to type will usually look something like this: Fig 1.2.1: Simple program Instruction Fig 1.2.1 shows one instruction telling the computer to display some text on the screen. You can use this one instruction to make a program to display Hello, World! on the screen. That's a program that just does one very basic thing: to prove that it works. So, you write this, learn how to run or execute your new computer program and you get your result! Then you wonder if you're supposed to feel a programmer now. But when you look at the kind of thing you actually like to do on your computer and yours does not feel like the same thing as this: Fig 1.2.2: A red ball challenge computer game So, I forgive you for thinking, okay, I can understand how this “Hello, World” program happens but there's no way, this computer game is just a list of instructions like add one number to another number. But it is! It really is. As we'll see, all computer programs are constructed from multiple small specific individual instructions. Think of a recipe in a cookbook because that's also a list of instructions. It's a series of steps to follow to make one dish and it doesn't matter if that recipe should be short and simple or long and difficult. They all come down to specific, well-defined instructions like add one-quarter teaspoon salt or heat oven to 220 degrees. By itself, as in programming, each individual step is kind of boring and looking at one instruction by itself tells us nothing. One instruction in a recipe could be used to make a cake, but it could also be part of a huge multi-day preparation of a 12-course state banquet for a hundred people involving truffled quail jelly and live lobsters. In cooking and in programming if you want impressive complicated results, you will still use basic, simple instructions, you will just have a lot more of them. When you understand this fact intellectually, there'll be no part of your brain thinking, “yup, I don't see how we get from hello world to hello world of Warcraft”. It's okay if that's not apparent yet. That's why we're doing this course. But we start simple. We have to start with the programming equivalent of how to boil an egg because even if it's unexciting, it's how we get the first ideas into our bones. 1.3. Computer Programming Ideas Idea Number 1 Here’s the first idea in programming: We build incredibly complex results from combining lots of simple instructions. Idea Number 2 Idea number two is that: The order of those instructions is incredibly important. So, imagine we're following a basic recipe with just 10 steps to it. Computer Programming Fundamentals The Principles and Concepts of Programming Languages and the Best One for You to Learn By A. B. Lawal Computer Programming Fundamentals The Principles and Concepts of Programming Languages and the Best One for You to Learn ISBN : 9788835823681 Copyright © 2020 AB Prominent Publisher All rights reserved. Published in the United States Limit of Liability/Disclaimer of Warranty All information given in this book is based on my own research and does not constitute technical, financial or professional advice. The author and publisher cannot be held responsible for the consequences of actions taken, or any consequences through inaction, as a direct or indirect result of the information in this book. All trademarks are the property of their respective owners. All information is used at your own risk. Whilst all content is checked for accuracy, no information contained within this book or in any of its links is to be used without taking technical, professional and marketing advice first. Anyone seeking advice should consult an Independent Advisor. The author and publisher of this book are not liable or responsible for any other websites or services linked to or from it. It is forbidden to reproduce any part of this book in any form or medium . Reselling is prohibited . Fig 1.3.1: A basic recipe It's simple enough. But supposing we take just two of these steps where we add four eggs and combine and then bake for 40 minutes at 350 degrees. We don't change anything about these instructions. We just put them the wrong way around, that is, bake for 40 minutes, then add four raw eggs and combine. One result is going on a plate and the other is going in the garbage! So even though each instruction or step might be well-defined, they're also often dependent on each other. The right sequence is the difference between a result that works and a result that doesn't. So, if you understand the idea that to write a recipe, one that other people could follow reliably, you would have to think it through. You'd have to focus on exact quantities. You'd have to break it into small steps and have those steps in the right order, and you'd probably have someone test it to make sure you didn't forget something. It's the same process we need in programming: to think through a larger idea, break it into small steps (those individual instructions), make sure the amounts are correct, and the sequence is exact so we can tell the computer to do it again and again a million times a second if we need to. Unlike a recipe where we do have some flexibility about how to phrase it for human beings to understand, we must now write our instructions in a way that the computer understands using a programming language. We have a lot of options for that. So, let's see a few them. Table of Contents Table of Contents 1. Getting Started 1.1. Why Take This Course? 1.2. Steps and Sequence 1.3. Computer Programming Ideas Idea Number 1 Idea Number 2 1.4. Source Code 1.5. Why Code Looks Like Code 1.6. Getting the Computer to Understand You: The Machine Code 1.7. Pros and Cons of Compiler and Interpreter 1.8. What's the Deal with All the 1's and 0's? 1.9. The Binary Code 1.10. 8-Bit/64-bit Computer Architecture 1. The Rules of Programming Languages 2.1. Introduction to the Syntax of a Programming Language Case Sensitivity Statements Whitespace Comments Keywords 2.2 Case Sensitivity and Capitalization 2.3. Writing Statements Ending Statements 2.4 Using Pseudocode 2.5 Dealing with Whitespace 2.6 Adding Comments to Your Code 2.7 Keywords 1. Working with Data 3.1. Input, Output and Everything In-between 3.2. Creating and Naming Variables The Camel Case 3.3. Using Variables and Operators 3.4. Choosing and Using Data types 3.5 Applying Data Type Numeric Variables Boolean Values Text/Character Data type Built-in Primitive Data Types 3.6. Creating and Using Constants 3.7. Understanding Language Differences 1. Managing Program Flow 4.1. Introduction to Program Flow 4.2 Making Choices and Conditions Brace Styles If/ELSE Statements 4.3. Creating Complex Conditions Multiple Branches 4.4 Creating Loops While Loop Infinite Loop Loop Counter For Loop For-In/For-Each Loop 1. Making Things Modular 5.1. Introduction to Grouping and Separation 5.2. Creating Functions How to Run/Call a Function

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.