Hello, reader. I don't know how you stumbled upon this book- whether it be you wanted to learn the first couple things of programming, or if you just wanted a refresher. For that, I say thank you and I hope I satisfy those needs.
Now that you have picked up this book, and have started reading under the section "Author's Notes", let me tell you a little about myself. Yes, I would like you know about me for certain reasons, and no, I would not like you to skip ahead to the first chapter. My name is Eric Stone, and I am currently 16 as I am writing this. My writing style is one that expects the reader to answer; one that I account for multiple versions of those answers. I break the fourth wall a lot, and as you can see so far, I seem to be doing a great job of that. The first thing that you might or might not be wondering (however I'm still going to address it) is "Why should I read this book written by a 16 year-old?". There are many answers to this, and many answers that I will not be going through. You should continue this book written by a 16 year-old because no matter how old I am, information is still information.
I am happy to say that I am a part of the First Robotics Competition (or FRC as it is referred to), and VEX Robotics. "What does this have to do with anything?" You might be asking. These two programs are where I learned how to program, and where I learned the mindset I needed to program. I highly suggest getting into one of the two.
You can find out about VEX teams here: http://www.vexrobotics.com/wiki/Nearly_Everything_You_Wanted_to_Know_About_Participating_in_VEX_Robotics_Competitions
You can find your local FRC team here: http://www.usfirst.org/whats-going-on.
"What is FRC/VEX?" You might or might not also be asking. Now, I like to explain it the same way my coach does, so I'll directly quote him:
"Imagine you never heard of the game of basketball. Instead, you just know that you'll end up playing a game in a gym on a court with hardwood floors. That's about it. You have a bunch of different athletes at your disposal. Tall ones, fast ones, stout and strong ones, etc.
Then six weeks prior to your first game, they reveal to you the rules of this new sport of "basketball." You learn about the new game object - a round bouncy ball and the rule about bouncing it whenever you want to move around. You learn the different ways to score points and the various rules of engagement. Immediately you set out forming up your team. By your analysis of the rules you determine it would be good to use your tallest and quickest athletes, with a focus on agility and vertical jumping ability over the really broad and powerful guys. Then you have to come up with a strategy for playing the game, having never seen it played, and you have to teach the athletes to properly handle the game object and execute the various tasks such as dribbling, shooting, blocking and rebounding. And don't forget that you have only six weeks before your first of two regional tournaments. Pretty challenging, right?
So then imagine this... what if you couldn't create your entire team? Instead you could only prepare one athlete to play the game and represent your school. You would have to decide which skills to optimize for. Do you want a really tall center, a fast and agile point guard? A power forward type? You have to make a choice and stick with it. Then when you get to your tournament you are given a match list that pairs you randomly with the single athletes brought by other schools. You see that in your first match, all of your teammates are point guards. How does that effect your strategy? In some matches, your partners will be woefully outmatched because some schools have no tall kids, and others are just born to play the sport. Some didn't have a court to train on so they only practiced in a classroom. Some didn't get any practice at all.
In subsequent matches, the teammate you performed so well with in an earlier round will become your opponent. How does that effect the way you defend each other? And what about that kid you popped with an elbow while going for that rebound in round 2 of the qualification matches? In round 5 he is going to be on your team.
All along the way, you are playing to be one of the top 8 teams for in the elimination rounds. With each qualification match you are building stats that will affect your final standing, but remember that they are team stats, not individual stats. So your athlete benefits and suffers based on the quality of each newly assembled team he plays on in each round. Building a solid strategy based on your group's strengths is critical. Playing as a team is also critical. If your player is a Michael Jordan type, then every team he plays on will have a better chance of winning, but he still has to deal with being keyed on by a tough defense.
In the end, the top 8 players (as determined by the aggregate team stats complied from all their matches) get to pick their teammates in a draft of sorts. Starting at the top and working down to 8, they each pick their first teammate. Then back up from 8 to 1 they pick a second, and so on. When the playoff teams are assembled, the finals begin in a best-of-three-per-round playoff bracket. Each individual player on the winning team, representing five different schools, goes home tournament champ.
Then at the end of the season, no matter how well you did, you have to start all over next year with a brand new sport."
Pretty challenging, huh? I strongly encourage joining as I have, because it accelerates learning in so many ways. I was taught the entire year course of "Introduction to Computer Programming" in 2 weeks. If you were wondering, my team number is 1138- Eagle Engineering. Even if you are on the edge of joining your local team or starting a new one, keep in mind that it looks amazing on resumes and it's an experience like no other.
You will come to know that I am a Google fan boy. A thing I would like to mention in these notes is that if you have a problem, Google it. I cannot tell you how many times a quick Google search has left people speechless by the sheer quickness of it. Yes, you can ask someone, but there is a completely possible way of searching the question on the internet. You have the knowledge of almost everything in history at your finger tips: use it.
Onto programming: Following these notes is an "optional chapter" for the program that I am using for this tutorial to program in. Because all languages share common wording and syntax, it really does not matter which language I program with to show you what they are. So, I'm going to teach you in Java, the language I started with.
In programming, Ctrl + C (copy) and Ctrl + V (paste) are your very best friends. Become acquainted with them, because you will be using them religiously throughout your career (But more on that in a different section). I will guarantee that when you try to run your program that you will have problems. There are few times when I can recall starting a program for the first time with no problems. Be knowledgeable that you will be frustrated at times, and shocked at others.
The goal of this book is to teach the very basics of all programming. It is to show you all of the things that common languages share, like the "if statement" and "while loop". It, in no means goes into specifics of a function that relates to only one language. With this book, it is completely possible to make calculators, text-adventures, and simple math programs in every common language (with exceptions).
[website of 1138 programming] -go there for troubles/add in question comment box
Which Program I'm Using and How You Set it Up*
*This section is not mandatory and you may skip it if you have no interest in knowing which program I am using and have no interest in following along. It's fine if you don't follow along, and I recommend you to follow what I'm doing, but I have deemed that this book can be understood without directly doing what I'm doing and experimenting with a program.
Before we actually get to learning programming, we need to set up the program to program in. I recommend downloading the program "Eclipse" to program in, because that is what I'll be using and what this tutorial is going to focus around. It is free, and a quick Google search should get you to a download page. Install it, open it up, and set your workspace anywhere you want it to be. This is where all of your programs will go.
[diagram of workspace prompt]
Set your workspace spot to put all your work and press "ok". Now you see a screen filled with buttons, gadgets, and menus. "Where do I begin? What do I do? What is life?" Are common questions after setting your workspace up and seeing eclipse for the first time. Although I can't answer the third question, the first thing you should do is create your first project.
[diagram of beginning page]
[diagram of clicking file]
[diagram of hovering new]
[diagram of clicking new java project]
Now, name your project anything you want and click Finish.
[picture of hovering over finish]
You will see your new project appear on the left side of the screen. Now right click the project you named, hover over "new" and click "class".
[picture of right clicking project and hovering over new under class]
You should see this popup window:
[picture of class popup window]
Name it whatever you want, but make sure to click "public static void main(String[] args)". Yes, you will see a small caution sign at the top saying "The use of the default package is discouraged". Do not fret, it's completely natural.
[picture of clicking the public static void]
Now, press finish.
[picture of pressing finish]
You will see this:
[picture of what the default program says]
Tada! You are ready to start programming
Author's Notes
Hello, reader. I don't know how you stumbled upon this book- whether you wanted to learn the first couple things of programming, or if you just wanted a refresher- but for giving me a chance, I say thank you and I hope I satisfy those needs.
Now that you've picked up this book and committed to getting through this, let me tell you a little about myself. Yes, I would like you know about me for certain reasons, and no, I would not like you to skip ahead to the first chapter. My name is Eric Stone, and I am currently 16 as I am writing this. My writing style is one that expects the reader to answer; I try to account for multiple versions of those answers. I know no fourth wall, as you may have noticed. The first thing that you might or might not be wondering (spoiler alert- I'm answering regardless) is "Why should I read this book written by a 16 year-old?". Valid question, but you'll have to take me on faith here- I do know how to program, and no matter how old I am, information is still information.
You will come to know that I am a Google fan boy. A thing I would like to mention in these notes is that if you have a problem, Google it. I cannot tell you how many times a quick Google search has left people speechless by the sheer quickness of it. Yes, you can ask someone, but there is a completely possible way of searching the question on the internet. You have the knowledge of almost everything in history at your fingertips: use it.
On to programming: Following these notes is an "optional chapter" for the program that I am using for this tutorial. Because all languages share common wording and syntax, it really does not matter which language I program with to show you what they are. So, I'm going to teach you in Java, the language I started with.
In programming, Ctrl + C (copy) and Ctrl + V (paste) are your very best friends. Become acquainted with them, because you will be using them religiously throughout your career (more on that in a different section). I will guarantee that when you try to run your programs, you will have problems. There are few times when I can recall starting a program for the first time with no problems. Be knowledgeable that you will be frustrated at times, and shocked at others.
I strongly recommend using a PC (preferably running the Windows Operating System). Macs may have the hype, but PCs are far more open-natured, Linux works fine, and is even better because of its power, but for casual use, I use Microsoft's Windows.
The goal of this book is to teach the very basics of all programming. It'll show you all of the things that common languages share, like the "if statement" and "while loop". It, in no means goes into specifics of a function that relates to only one language. With this book, it is completely possible to make calculators, text-adventures, and simple math programs in nearly every common language. I cannot do everything for you, however. Some of programming requires an imagination and the ability to think outside of the box to solve problems.
With that, I send you forth, young squire, to conquer programming!
The Program I'm Using and How You Set it Up*
*This section is not mandatory and you may skip it if you're not interested. Reading this is definitely recommended, and will not bring the end of the world.
Before we actually get to learning the language, we need a place to speak it. I recommend downloading the program "Eclipse" to program in, because it's free, and I use it. This is also your time to experience the magic of the quick Google Search, which should get you right to a download page. Install it, open it up, and set your workspace anywhere you'd like it to be. This is where all of your programs will go.
Set your workspace as a spot to put all your work and press "ok". Now you see a screen filled with buttons, gadgets, and menus. "Where do I begin? What do I do? What is life?" Are common questions after setting your workspace up and seeing Eclipse for the first time. Although I can't answer the third question, the first thing you should do is create your first project. To do, first exit out of the "welcome" screen.
Now click "File" in the upper left corner.
Hover over "New" and click "New Project".
You will be prompted to now name your project. Name it, and click "Finish".
A blank workspace appears here, with your newly-named Java Project. Go ahead and right-click it.
Hover over "New" and click "Class". (Don't worry if you see a lot of words you're not sure about- you'll learn about what they are later in life.)
After clicking "Class", you will be prompted to name this class, just like you named the Java Project. Again, you can name it whatever you want. Name if after your little brother. Name it after your cat. But don't click "Finish" yet- we're not done with this page. When you name the class, a little notification at the top of the page will tell you, "The use of the default package is discouraged". Ignore it.
In the section about "method stubs," go ahead and check the first box "public static void main (String[]args)"-and then "Finish".
When you press "Finish", this page comes up. Tada! It's now time to start programming!
So there you go. This is where you'll be running your program. Don't worry. It's really easy.
To run your program, just look at the upper left hand corner. What's that? A bright green play button? Lets press it! (You have to actually have a functioning program to have something print out though.)
If you look to the bottom of the screen, you will see four tabs: Problems, Javadoc, Declaration, and Console. Click on Console if it isn't highlighted there already.
Of course, nothing will appear there anyway, because you haven't typed anything yet, but that's how to run your program!
Now that you have picked up this book, and have started reading under the section "Author's Notes", let me tell you a little about myself. Yes, I would like you know about me for certain reasons, and no, I would not like you to skip ahead to the first chapter. My name is Eric Stone, and I am currently 16 as I am writing this. My writing style is one that expects the reader to answer; one that I account for multiple versions of those answers. I break the fourth wall a lot, and as you can see so far, I seem to be doing a great job of that. The first thing that you might or might not be wondering (however I'm still going to address it) is "Why should I read this book written by a 16 year-old?". There are many answers to this, and many answers that I will not be going through. You should continue this book written by a 16 year-old because no matter how old I am, information is still information.
I am happy to say that I am a part of the First Robotics Competition (or FRC as it is referred to), and VEX Robotics. "What does this have to do with anything?" You might be asking. These two programs are where I learned how to program, and where I learned the mindset I needed to program. I highly suggest getting into one of the two.
You can find out about VEX teams here: http://www.vexrobotics.com/wiki/Nearly_Everything_You_Wanted_to_Know_About_Participating_in_VEX_Robotics_Competitions
You can find your local FRC team here: http://www.usfirst.org/whats-going-on.
"What is FRC/VEX?" You might or might not also be asking. Now, I like to explain it the same way my coach does, so I'll directly quote him:
"Imagine you never heard of the game of basketball. Instead, you just know that you'll end up playing a game in a gym on a court with hardwood floors. That's about it. You have a bunch of different athletes at your disposal. Tall ones, fast ones, stout and strong ones, etc.
Then six weeks prior to your first game, they reveal to you the rules of this new sport of "basketball." You learn about the new game object - a round bouncy ball and the rule about bouncing it whenever you want to move around. You learn the different ways to score points and the various rules of engagement. Immediately you set out forming up your team. By your analysis of the rules you determine it would be good to use your tallest and quickest athletes, with a focus on agility and vertical jumping ability over the really broad and powerful guys. Then you have to come up with a strategy for playing the game, having never seen it played, and you have to teach the athletes to properly handle the game object and execute the various tasks such as dribbling, shooting, blocking and rebounding. And don't forget that you have only six weeks before your first of two regional tournaments. Pretty challenging, right?
So then imagine this... what if you couldn't create your entire team? Instead you could only prepare one athlete to play the game and represent your school. You would have to decide which skills to optimize for. Do you want a really tall center, a fast and agile point guard? A power forward type? You have to make a choice and stick with it. Then when you get to your tournament you are given a match list that pairs you randomly with the single athletes brought by other schools. You see that in your first match, all of your teammates are point guards. How does that effect your strategy? In some matches, your partners will be woefully outmatched because some schools have no tall kids, and others are just born to play the sport. Some didn't have a court to train on so they only practiced in a classroom. Some didn't get any practice at all.
In subsequent matches, the teammate you performed so well with in an earlier round will become your opponent. How does that effect the way you defend each other? And what about that kid you popped with an elbow while going for that rebound in round 2 of the qualification matches? In round 5 he is going to be on your team.
All along the way, you are playing to be one of the top 8 teams for in the elimination rounds. With each qualification match you are building stats that will affect your final standing, but remember that they are team stats, not individual stats. So your athlete benefits and suffers based on the quality of each newly assembled team he plays on in each round. Building a solid strategy based on your group's strengths is critical. Playing as a team is also critical. If your player is a Michael Jordan type, then every team he plays on will have a better chance of winning, but he still has to deal with being keyed on by a tough defense.
In the end, the top 8 players (as determined by the aggregate team stats complied from all their matches) get to pick their teammates in a draft of sorts. Starting at the top and working down to 8, they each pick their first teammate. Then back up from 8 to 1 they pick a second, and so on. When the playoff teams are assembled, the finals begin in a best-of-three-per-round playoff bracket. Each individual player on the winning team, representing five different schools, goes home tournament champ.
Then at the end of the season, no matter how well you did, you have to start all over next year with a brand new sport."
Pretty challenging, huh? I strongly encourage joining as I have, because it accelerates learning in so many ways. I was taught the entire year course of "Introduction to Computer Programming" in 2 weeks. If you were wondering, my team number is 1138- Eagle Engineering. Even if you are on the edge of joining your local team or starting a new one, keep in mind that it looks amazing on resumes and it's an experience like no other.
You will come to know that I am a Google fan boy. A thing I would like to mention in these notes is that if you have a problem, Google it. I cannot tell you how many times a quick Google search has left people speechless by the sheer quickness of it. Yes, you can ask someone, but there is a completely possible way of searching the question on the internet. You have the knowledge of almost everything in history at your finger tips: use it.
Onto programming: Following these notes is an "optional chapter" for the program that I am using for this tutorial to program in. Because all languages share common wording and syntax, it really does not matter which language I program with to show you what they are. So, I'm going to teach you in Java, the language I started with.
In programming, Ctrl + C (copy) and Ctrl + V (paste) are your very best friends. Become acquainted with them, because you will be using them religiously throughout your career (But more on that in a different section). I will guarantee that when you try to run your program that you will have problems. There are few times when I can recall starting a program for the first time with no problems. Be knowledgeable that you will be frustrated at times, and shocked at others.
The goal of this book is to teach the very basics of all programming. It is to show you all of the things that common languages share, like the "if statement" and "while loop". It, in no means goes into specifics of a function that relates to only one language. With this book, it is completely possible to make calculators, text-adventures, and simple math programs in every common language (with exceptions).
[website of 1138 programming] -go there for troubles/add in question comment box
Which Program I'm Using and How You Set it Up*
*This section is not mandatory and you may skip it if you have no interest in knowing which program I am using and have no interest in following along. It's fine if you don't follow along, and I recommend you to follow what I'm doing, but I have deemed that this book can be understood without directly doing what I'm doing and experimenting with a program.
Before we actually get to learning programming, we need to set up the program to program in. I recommend downloading the program "Eclipse" to program in, because that is what I'll be using and what this tutorial is going to focus around. It is free, and a quick Google search should get you to a download page. Install it, open it up, and set your workspace anywhere you want it to be. This is where all of your programs will go.
[diagram of workspace prompt]
Set your workspace spot to put all your work and press "ok". Now you see a screen filled with buttons, gadgets, and menus. "Where do I begin? What do I do? What is life?" Are common questions after setting your workspace up and seeing eclipse for the first time. Although I can't answer the third question, the first thing you should do is create your first project.
[diagram of beginning page]
[diagram of clicking file]
[diagram of hovering new]
[diagram of clicking new java project]
Now, name your project anything you want and click Finish.
[picture of hovering over finish]
You will see your new project appear on the left side of the screen. Now right click the project you named, hover over "new" and click "class".
[picture of right clicking project and hovering over new under class]
You should see this popup window:
[picture of class popup window]
Name it whatever you want, but make sure to click "public static void main(String[] args)". Yes, you will see a small caution sign at the top saying "The use of the default package is discouraged". Do not fret, it's completely natural.
[picture of clicking the public static void]
Now, press finish.
[picture of pressing finish]
You will see this:
[picture of what the default program says]
Tada! You are ready to start programming
Author's Notes
Hello, reader. I don't know how you stumbled upon this book- whether you wanted to learn the first couple things of programming, or if you just wanted a refresher- but for giving me a chance, I say thank you and I hope I satisfy those needs.
Now that you've picked up this book and committed to getting through this, let me tell you a little about myself. Yes, I would like you know about me for certain reasons, and no, I would not like you to skip ahead to the first chapter. My name is Eric Stone, and I am currently 16 as I am writing this. My writing style is one that expects the reader to answer; I try to account for multiple versions of those answers. I know no fourth wall, as you may have noticed. The first thing that you might or might not be wondering (spoiler alert- I'm answering regardless) is "Why should I read this book written by a 16 year-old?". Valid question, but you'll have to take me on faith here- I do know how to program, and no matter how old I am, information is still information.
You will come to know that I am a Google fan boy. A thing I would like to mention in these notes is that if you have a problem, Google it. I cannot tell you how many times a quick Google search has left people speechless by the sheer quickness of it. Yes, you can ask someone, but there is a completely possible way of searching the question on the internet. You have the knowledge of almost everything in history at your fingertips: use it.
On to programming: Following these notes is an "optional chapter" for the program that I am using for this tutorial. Because all languages share common wording and syntax, it really does not matter which language I program with to show you what they are. So, I'm going to teach you in Java, the language I started with.
In programming, Ctrl + C (copy) and Ctrl + V (paste) are your very best friends. Become acquainted with them, because you will be using them religiously throughout your career (more on that in a different section). I will guarantee that when you try to run your programs, you will have problems. There are few times when I can recall starting a program for the first time with no problems. Be knowledgeable that you will be frustrated at times, and shocked at others.
I strongly recommend using a PC (preferably running the Windows Operating System). Macs may have the hype, but PCs are far more open-natured, Linux works fine, and is even better because of its power, but for casual use, I use Microsoft's Windows.
The goal of this book is to teach the very basics of all programming. It'll show you all of the things that common languages share, like the "if statement" and "while loop". It, in no means goes into specifics of a function that relates to only one language. With this book, it is completely possible to make calculators, text-adventures, and simple math programs in nearly every common language. I cannot do everything for you, however. Some of programming requires an imagination and the ability to think outside of the box to solve problems.
With that, I send you forth, young squire, to conquer programming!
The Program I'm Using and How You Set it Up*
*This section is not mandatory and you may skip it if you're not interested. Reading this is definitely recommended, and will not bring the end of the world.
Before we actually get to learning the language, we need a place to speak it. I recommend downloading the program "Eclipse" to program in, because it's free, and I use it. This is also your time to experience the magic of the quick Google Search, which should get you right to a download page. Install it, open it up, and set your workspace anywhere you'd like it to be. This is where all of your programs will go.
Set your workspace as a spot to put all your work and press "ok". Now you see a screen filled with buttons, gadgets, and menus. "Where do I begin? What do I do? What is life?" Are common questions after setting your workspace up and seeing Eclipse for the first time. Although I can't answer the third question, the first thing you should do is create your first project. To do, first exit out of the "welcome" screen.
Now click "File" in the upper left corner.
Hover over "New" and click "New Project".
You will be prompted to now name your project. Name it, and click "Finish".
A blank workspace appears here, with your newly-named Java Project. Go ahead and right-click it.
Hover over "New" and click "Class". (Don't worry if you see a lot of words you're not sure about- you'll learn about what they are later in life.)
After clicking "Class", you will be prompted to name this class, just like you named the Java Project. Again, you can name it whatever you want. Name if after your little brother. Name it after your cat. But don't click "Finish" yet- we're not done with this page. When you name the class, a little notification at the top of the page will tell you, "The use of the default package is discouraged". Ignore it.
In the section about "method stubs," go ahead and check the first box "public static void main (String[]args)"-and then "Finish".
When you press "Finish", this page comes up. Tada! It's now time to start programming!
So there you go. This is where you'll be running your program. Don't worry. It's really easy.
To run your program, just look at the upper left hand corner. What's that? A bright green play button? Lets press it! (You have to actually have a functioning program to have something print out though.)
If you look to the bottom of the screen, you will see four tabs: Problems, Javadoc, Declaration, and Console. Click on Console if it isn't highlighted there already.
Of course, nothing will appear there anyway, because you haven't typed anything yet, but that's how to run your program!