Great Introduction to Coding
This course teaches programming for absolute beginners. It provides over 50 hands-on coding exercises, so you spend most of your time getting good at coding, not just watching videos. The difficulty builds gradually so you're always ready for the next step.
Most people can complete this course in about 6 months at 10 hours per week.
Refined in a Classroom
This course material has been used for 3 years in a face-to-face classroom, for adult job training. This has resulted in many refinements to the course material, eliminating bugs and errors, and ensuring no steps are missing, so you can trust the quality of the course.
Many of the classroom students are now working in professional software development, and have had wonderful things to say about this course. "It's hard, but in a good way, and everything is explained well; I don't get lost."
Native English Speaker
All voice-over is done by me (your instructor), and I'm a native English speaker from the midwest of the United States; I speak clearly and carefully. I also provide full text transcripts of all videos, and am working on closed captioning, so that you can easily follow along with what I'm saying.
Videos Easy to Review
The course assumes basic computer literacy but no prior programming experience. We'll start out simple and carefully explain every step.
I explain new vocabulary every step of the way so you don't get lost, and I make sure the topics don't skip around. Each topic gently prepares you for the next topic in the course. I focus on the core Java language, especially the most important areas you would actually use on the job.
I use lots of pictures, code examples with arrows pointing out the important parts, and careful demonstrations of how and why things work.
Every video starts with an overview slide, so you can quickly review code examples when you come back to it later. Then we go into the details, and summarize at the end with some journal questions for you to remember, apply, and elaborate on the material you've just learned.
The early part of the course emphasizes hands-on practice and repetition to build a strong memory of the material. Then as we introduce more complex topics, it shifts to software design and strategies for problem solving, so you're ready for the next level.
Practice assignments use what you just learned, in a simple exercise. Challenge assignments use the same topics, but in a more interesting and complex way. Freestyle assignments give you a few requirements and then encourage you to get creative, building your own ideas. I found that learners who only do class exercises don't get enough practice at creating their own ideas, which holds them back professionally. Freestyle exercises give you that necessary practice and are also great fun!
Good for Teachers
This material is well-suited to teaching computer science in junior high and high schools, as a more professional approach than using Scratch. Teachers with advanced students will find this useful for both themselves and their students. (Udemy does provide institutional subscriptions.)
Most graphics were licensed through PresenterMedia (obligatory attribution) - many thanks to them for providing such great concept graphics with the ability to customize colors and text. The colorful slides and memorable pictures make learning coding a lot more fun.
Introduces the foundation concepts for what programming is, and some basic vocabulary that we'll be using in upcoming lectures.
Download and install BlueJ (free) from www.bluej.org. We use the default configuration. If you're already comfortable with installing software, you can skip the video and do the installation by yourself.
Shows how to use BlueJ and write a program that displays a message on the screen. See "Hello.java" in the downloads area of this lecture for a short practice program you can experiment with.
Tips on how to type punctuation marks, and the value of touch-typing. Focuses on the names that the tech industry uses for the punctuation marks.
Shows how to step through code one line at a time, using the debugger tool. This is like a play-pause button for your code, so you can see it run slowly. Later in the course, you can use this to figure out where your code has mistakes in it.
Your first coding assignment is copy work, for typing practice and visual awareness. This improves your ability to accurately read source code, and it's a chance to practice with BlueJ hands-on. If you get stuck during this assignment, and just can't get it to work after a few attempts, go on to the next few videos and come back to this.
Teaches the vocabulary necessary to discuss source code in more depth. Shows animated simulations of some of the concepts. Includes a vocabulary review guide.
Gives you tips for how to find your mistakes. Explains common errors and how to fix them. Helps you recognize what to pay extra attention to as you work.
In this assignment, you will write a program that makes the computer print the beginning of a story, as text. See the "Requirements" attachment to this lecture for the details.
Be careful to pay attention to newlines and quote characters. In particular, when Alice is thinking "without pictures or conversations?" make sure those quotes around her words show up in the results when you run your program.
In this assignment, you will write a program that makes the computer print a poem. See the "Requirements" attachment to this lecture for the details.
Your program will print a snippet from "Through the Looking Glass" (public domain text). Pay careful attention to spacing and new lines. Compile and run your code. Check your results carefully.
This video will discuss strategies for making your learning more effective, and getting good results from the effort you put in. We'll discuss precise thinking, memorization, planning, and problem solving.
Learn how to make the computer ask the person questions, and then hold on to their answers in named variables, for printing on screen later.
(If you download the Questions.java file from the resources, make sure it saves with a capital Q not a lowercase q in the file name, and that the file name is exactly Questions.java not Questions.java.txt or something like that.)
Learn about the different kinds of variables you can use. We'll explore numeric variables (integer and decimal), and also text variables (String) and yes/no variables (boolean). These help you build more interesting programs.
In this practice assignment, you'll build a short program to take the names of 3 items on a grocery list, the quantity to purchase, and the cost, and calculate the total grocery bill.
Pay attention to what part of the text the code should print, versus what part of the text the user at the keyboard should be typing in. This assignment is different from the ones you've done before, because the code does not produce everything you see. Some of it is typed in by a person after you run the program, and they can type different things in each time. The program should work for any numbers the user types in. See the "Requirements" pdf attached to the lecture for details.
In this practice, you'll help Pirate Lady Ching's crew plan the number of treasure chests they must build for her. To do so, you'll ask the user about current prices, and how much Lady Ching has invested, and then calculate how many chests can be built for that price.
Again, pay careful attention to what the code does versus what a person types in. Your calculations and math must work correctly for any (reasonable) numbers that the person types in response to a question. This is a challenge problem, which means you'll be working harder to do the planning and get all the pieces exactly right. Respect your struggle, take breaks when you need them, and stay persistent. Work out the math with pencil and paper ahead of time if that helps you understand it.
This quiz will ask you to pay close attention to code syntax. You're going to see a bunch of questions that ask you to determine whether or not the code compiles. Look for typos and syntax mistakes that might cause problems.
Probably the biggest thing that holds back adults who are trying to learn programming is that they're afraid to do things wrong. They're afraid to break things.
But there's no risk in the kind of code you are currently writing. Experimenting is really quite safe. You will learn more by playing with it, experimenting to see what you can discover, and exploring how and why code breaks. This will help you learn about and understand the error messages you see when you are coding.
Learn how the code expects to convert numbers between decimals and integers, and considerations with rounding versus truncation of the digits. Learn how you can ask for input in one data type, and then convert it to a different data type so it works for a different part of your code.
For this assignment, you will write your own software requirements document, using the information in this lecture as a guide. You can write by hand on paper, or using a word processor on your computer, whichever you prefer. You will be changing your mind as you write, so leave plenty of space for edits if you're handwriting it. Don't stress out if you're not sure what to write in various places, yet. Make an effort, try to figure it out, and keep notes about your thoughts and concerns. You will be able to come back to your questions later, as you learn more, and figure them out.
Use the coding skills you've learned so far to build something you find interesting and enjoyable. This is about practicing your thinking process around code. It's about discovering how you can dream up an idea and then build it. Keep your idea fairly simple for now, using only the things you've already learned. But have fun with it!
See the Q&A document attached to the lecture for details.
How do we make the program do something different based on circumstances? The program needs a way to ask a question and make a decision based on the answer. This video will explore conditions, which let the program ask questions and get answers. Part 2 will then explore if statements, which use the answers to take different actions.
How do we make the program do something different based on circumstances? Part 1 explored conditions, which let the program get answers to questions. This video is part 2, and it will explore if statements, which let the program run specific code depending on those answers.
In this practice, you'll help a sandwich shop manager see if they met their sales goals for the day. You'll ask them how many of various items they sold, and compare the number they sold to the daily goal. If they met the goal, you'll print "Made goal" and if they fell short, you'll print "Fell short".
This video explains the spacing and alignment of source code. Proper spacing improves how quickly you can read and understand your code. It starts to become important when you're using "if" statements. It becomes more important in future lessons when you start using functions and loops. BlueJ provides an auto-indent feature that will show you the proper spacing for your code. This can be helpful while you are learning.
When we did variable comparisons inside if statements, during recent lectures and assignments, we only compared numbers. Strings have to be compared a little differently. Let's learn how to compare text accurately.
This program will be a bit of a question-and-answer routine. Your program should ask the user at the keyboard 2 questions: the weather and their mood. Then, depending on what they typed in, it should make a suggestion on how to spend a few hours having fun.
Check your understanding before you move on. The first time through the quiz, try working out the problems with your mind and pencil and paper. If you miss any problems, then go back through them with BlueJ and experiment until you understand why a particular answer is right.
If you struggle with any topics on this quiz, review the information on data types, variables, and comparisons. You should be solid on following the flow of simple programs such as you'll see in this quiz.
If you made it through the quiz, then you've learned a lot about programming language fundamentals. You can use print, create and use primitive variables, do comparisons, and make decisions using if statements. You can do math calculations, use the basics of boolean variables, think logically about how the code works, and trace down and fix bugs. You can read and understand other people's code.
That's a really great foundation for programming! It means you're starting to understand how programs go together, and how to accomplish tasks using code.
This video is going to discuss flowcharts: diagrams that help you plan out what software should do.
A software flowchart diagram lets us plan out the steps, carefully and in order, that a software program must go through to accomplish its task. Drawing a flow chart helps you plan your own software, and it can also help you solve practice and challenge problems in this course. It will stop you from getting confused as you tackle harder challenges.
Iterative design is a way of planning and improving software. This video helps you learn to plan larger programs, especially software for other people.
What is iterative design? A design is a plan. An iterative design is a plan you keep improving as you make progress towards it.
The word "iterate" means to do something again and again, or to do each of several small steps one after another.
In the context of software development, an iterative design means gradually enhancing a program to be better and better. It can also refer to adjusting your plan before you start making software.
This program will be a small interactive story book, of the "choose your own ending" variety. The person at the keyboard will get some multiple-choice options for what happens next in the story. Depending on what they choose, the story changes.
Up to now, you have worked with code that mostly ran in a straight line from beginning to end. This exercise won't do that. Instead, it will branch in many directions, as a choose-your-own-story experience. Your flow chart for this will look broad and branching, like a tree. Plan with a flow chart first, before you start writing code.
This video explores how to figure out logical combinations of several boolean values. For instance, if the sky is blue and the weather is warm, or the sky is orange and the weather is comfortable, then take my camera outside when I walk. How do we combine true and false values with lots of AND and OR operators?
Let's talk about demonstrating your software to others, working with others to build software, and evaluating your learning progress so you know when to practice more, and when to move ahead.
Create a program - any design you like - that has some similarity to an interactive story. There should be some varying paths through the program, and some things that the person at the keyboard types in. The design is up to you! Remember to demo your result to a friend or classmate.
This slide deck provides information on how to evaluate your progress in the course. It examines how deeply you know the various topics, and where you might need more practice. Take your time doing a self-evaluation. This is an important step in building your ability to evaluate your learning, make good judgement calls about when you need more practice, and ensure that you know what you need before you move on. The checklist is attached as a downloadable file so you can print it and write on it.
How do we make pieces of the code reusable, without retyping them? We put them into a method and give them a name. This video explores how to make reusable chunks of code.
In this practice assignment, your code will print the lyrics to a song – without you retyping the repeating words multiple times. You'll create a method to hold the repeated part and call it each time you need those lines to print.
Explore how to send variables into a method, to change the data available to it. Focus on the input parameters, and understand how to define a method, and call a method, passing variable values in the call.
Type in existing code. Run the code, and figure out what it does right and wrong. Provide the missing code so that the assignment works correctly. Especially focus on understanding what a return value from a method is, and how it's used.
Take some code that already exists, find the mistakes in it, and finish creating the code so it works correctly. This code will create a very simple calculator.
Create a program that asks the user which language, English or Spanish, to provide words in. Then the program asks the user for a number, and prints the spelled out word for that number, in the chosen language. This makes use of method calls, method return values, and a little bit of keyboard input.
Using some already-provided code, create a program that takes in numeric dates and formats their month, day, and year to a set of different layout formats.
This does NOT use any calendar or date APIs, and you should NOT be trying to look up how to do this on the internet. (Those solutions use much more advanced techniques from later in this course; they will only confuse you.) Instead, use the simple statements you already know (if statements, String variables, numeric comparisons, ability to create Strings as "thing1" + variable + "thing2") to handle each piece. You already have all the code skills you need for this. You just have to think carefully and find clever ways to do each part.
Pay careful attention to method input parameters versus method return values. If you don't understand what that means by now, repeat the past few lessons and practices, create some freestyle code of your own with the same ideas, and make really sure you get it.
This assignment is a bit challenging for those who understand it well, but it's impossible if you don't fully understand input parameters and returns. The course work is about to get harder quickly, so this is an important place to evaluate your learning and make sure you really understand what you're doing.
You'll be writing a set of reusable methods such as isOddNumber, isEvenNumber, isVowel, isConsonant.
Some code is already provided. Do not change the provided code. Just fill in the blanks _____ and write code in the // TODO sections, checking your work as you go. Remember that your methods can reuse your other methods; for example, a letter that is not a vowel must be a consonant. Sometimes this trick can reduce the amount of code you need to write.
Method signatures are a way to uniquely identify which method is being called. A method signature is a combination of the method name, plus how many and which data types are used in the input parameters. You can have multiple methods with the same name, as long as their input parameters are different. Sometimes you'll want to have related methods do similar things; this helps you plan out how to do that.
A leap year is a calendar year where February 29 is added to keep the calendar aligned with the movement of the Earth around the Sun. You will write a method isLeapYear() that determines whether a given year is a leap year. You only need to consider years greater than 500 and less than 5000. You don't need to worry about historical anomalies or calendar changes.
A major focus on this exercise is to think about how to accurately test your code. We'll introduce the idea of test-first development, where you write the test scenarios BEFORE you write the code that they're testing. This helps make sure that you are thinking about all aspects of the problem, accurately, before you write your code. It's a well-organized (and often, very satisfying) way to code. As you start to build larger and more complex programs, the ability to plan your test cases and code them ahead of time will help you stay organized and reduce bugs.
Practice designing your own program. Practice planning and organizing skills. More deeply understand using functions/methods.
You will come up with an idea, write down your plan, write a list of test cases for it, and then write the code to accomplish your idea. See the doc attached to the lecture for details.
While loops let you repeat the same block of code many times, without retyping it. The loop keeps running as long as the condition is true. This lets you do something until a user asks to quit.
This is a silly little short program just to practice syntax. No point in making it more than it is! Get comfortable with how to use a while loop in your code.
When you are using loops for problem solving, you need to think about what happens before the loop as you set up; what happens during the loop that gets repeated; and what happens after the loop is done. This helps you plan how to use a loop correctly to accomplish your goals.
Your business associate wants a program she can use like a calculator, but it only needs to add. She wants to be able to add up long lists of numbers without having to touch + each time.
Practice using while loops. Be able to follow the flow of code execution, before, during, and after a loop.
Your favorite charity has contacted you for help. They recently ran a successful fundraiser and they want to send a personalized thank you note to every donor.
They will provide you with the text of the letter. They will use the software (after you build it) to type in the donor names and amounts. For each donor, your software will print a thank you letter personalized for that donor.
Practice using while loops and variables to repeat a process until the user has indicated they are done.
Print the numbers from 1 to 30 by using a while loop, and as few lines of code as possible. This is a quickie practice problem leading into upcoming concepts.
Print the numbers from 0 to 100 but only those divisible by 5 (0, 5, 10, 15, 20, ...) by using a while loop, and as few lines of code as possible. This is a quickie practice problem leading into upcoming concepts.
Learn about do-while loops, which are similar to while loops but check the true-false condition at the end instead of the beginning. These are sometimes more useful when getting user input from the keyboard.
Take a set of inputs from the user, and make sure they fit within prescribed rules. Keep asking until the user gets it right. This provides reliable input to later steps.
Practice using do-while loops. Practice using more than one loop in a program. Put loops in context with methods and larger program behavior.
Random numbers are fun. They let computer games introduce uncertainty, like how an enemy character moves. They let us shuffle a deck of cards. But how do you get the computer to hand you a random number, instead of just the number you tell it?
This lesson explores random numbers, so you can build simple games, as well as selecting a random item out of a list of items. We'll also introduce import statements, since we need to use the Random class from a different area of Java.
We're going to write a little game! It's called Guess My Number. The computer "thinks of" a random number, and then the person tries to guess it. The computer responds with oops, higher, lower, or you got it.
Practice using random numbers. Practice using loops in the context of a bigger idea. And have some fun!
You've used while loops to count. This is a common need, so there's another way to write a loop that makes it more convenient. It's called a for loop. A for loop repeats the steps inside a certain number of times and then stops automatically, without the user having to indicate that they are done.
This one is a simple practice. Ask the user for a number. Count up to it, and then count down again. Print the numbers along the way.
The user will type a number. You will print a text bar graph, that many characters wide. Once that works, you will move the logic you wrote into a method. It will take an input parameter for the width. Then you will ask the user for how wide to make a bar, and print a bar of that width, several times until the user decides to quit.
This practices for loops, methods, and iterative design.
Nested loops occur when you put one for loop or while loop inside another for loop or while loop. We will mostly focus on for loops, since those are the most common ones to nest. This is a common strategy for working with rows and columns of data. We're building the foundation you'll need for more complex data processing which you will get to shortly.
This program will print multiplication tables. Start by asking the user what size to print (up to 20), and then the code will print out the multiplication facts from 0 times 0 up through that size times that size. This demonstrates how nested loops can be used for more complex data effects.
Next, we'll do a variation on the prior assignment, with fancier layout. Make sure your prior assignment is working correctly and that you understand how it works and why.
In this challenge, we will print the multiplication tables arranged as a grid. See the requirements in the lecture for the example. Notice that column alignment matters. You need to think about where spaces occur, and how to leave enough space for all of the digits as the numbers get larger. Some people find it easier to print a dot or a dash instead of space, when they're starting out, so they can see exactly how wide each area is. Remember that you can make methods to do parts of this, such as aligning a number within a string.
Time to play a game! This set of puzzles can be solved using loops. The computer will present a sequence of colors, and you have to write the shortest code you can that matches those colors.
This is additional practice with for loops, to make sure you really understand how to use them. There is pre-existing code to download, so make sure you do that and follow the instructions carefully for how to get it working. (If you have too much difficulty getting it working on your computer, you can skip this assignment - but do try to get it working, because it's colorful and fun and good practice.)
Any program of your design! Make sure it uses some loops. Have fun!
You have a lot of coding tools now, with variables, if statements, methods, loops, and nested loops. You can build something pretty cool. This is additional practice at planning an idea, writing down a plan you can work from, and then making it exist as code that runs and works. Don't skip these freestyle assignments - they are providing really important brain skills that you will need as a professional later on.
A high school student dissatisfied with the typical school day decided to try something different, and worked with his school to set up an independent, self-directed learning program for himself. I found his approach inspirational and interesting. If you'd like to read about his experience, KQED has the article ("What a Student Learned from a Short Experiment in Self-Directed Learning").
Arrays are a powerful data structure for working with lists of things. Instead of having to declare a separate variable for every item, you can declare a whole list, and refer to each one by number. This makes them easier to use with for loops.
Write a program that calculates the average temperature per week, for each of the last two weeks. Use the daily "high" temperature from a weather website for your location. Don't worry about rounding. Also keep track of which day was the warmest for each week.
Practice using arrays. See data in a realistic context.
You've used strings a lot in the programs so far. But what is a String, really? How do computers keep track of letters? Hidden inside, computers actually use numbers for each character. The mapping from number to letter is called ASCII encoding. Let's explore what ASCII is, and what you can do with it.
Write a program that prints the ASCII chart from 32 through 255. You don't need to worry about columns or fancy layouts.
Practice with ASCII. Practice with data type logic.
Convert a hidden message from numbers to letters based on ASCII, and print the message. You may want to do this with pencil and paper before trying to write code that does it.
Write code that will convert some text from mixed-case (upper and lower) and all-uppercase. The details attached to the lecture explain what methods you will need. Remember to leave punctuation marks and spaces unchanged.
Computers are electronics. That means electrical signals have to represent all of our information. How does that work?
Settle in for a long video. You won't need to keep notes on this stuff, and some practice problems are presented along the way. Focus on concepts here rather than the fine details. We're looking deep inside a computer to see what makes it tick.
Next we're going to take a look at how to count in binary, do arithmetic in binary, and use binary digits as masks to isolate smaller pieces of information.
Again, you don't need to worry if you don't remember everything. This is for concepts, not immediate hands-on application.
You've met the binary numbers. Binary is base 2. You grew up counting in decimal numbers, also known as base 10. Next, we're going to meet the hexidecimal numbers, which are base-16.
You will not be tested on any of this. But you may find it useful to be aware of, when you encounter hex numbers again in the future.
Uncover the hidden message!
You're a detective, chasing clues about some shenanigans another group is planning. They've been passing messages in a hidden code made up only of numbers. You managed to find a copy of their code sheet in their garbage, but the numbers don't look the same.
Can you figure it out?
You can do this by hand, or you can write a program to do it. That's up to you! I do recommend that you try figuring out the first 5 letters by hand, just for the practice.
There's a useful trick you can use with BlueJ to clear the screen from code. This may not work in Eclipse or other programs, but it does work nicely in BlueJ. This lesson shows you the code that clears the screen. Once you start writing programs that ask the user for keyboard input, especially once you add menus, being able to clear the screen between parts of the code can be handy.
You have previously seen arrays with one dimension (length). They are drawn as a line of boxes. Now we're going to explore arrays that make a grid (length and width). In a past assignment you printed the multiplication tables in a grid on screen. This section will explore how you would do something similar, but keep the numbers in computer memory in arrays instead of printing them.
Your neighborhood gardener has made a chart of daily temperatures for the past week. She's going to provide more data later, but first she wants a proof of concept program that calculates average temperatures at a given time of day.
Practice using multi-dimensional arrays. See data in a realistic context.
Any program of your design that works with information and uses some logic. You should have quite a good set of programming techniques by now, and you can take on some larger challenges. Dream it and make it!
Build an interactive, two-player game of tic-tac-toe. The board and taken spaces will be shown on screen as text. Players will take turns choosing which square to place their marker in. See details attached to this lecture for examples and discussion.
This is a capstone project for procedural programming. It uses many of the techniques you've learned so far. Planning the code is a significant effort here! Some people need several days to code this assignment. Don't give up. Talk through your ideas with a friend or classmate, and plan carefully. Remember to break it down into small pieces, look for things that make sense as methods, and practice smaller pieces to build up to a solution.
Some people find it very challenging to make two players take turns. You may want to make a "Guess My Number" game where two players take turns, to practice how that works with simpler data. Then come back to Tic Tac Toe, and its code may make more sense. It's always reasonable to go code some smaller practice problem in order to better understand it, and then come back to the more complex one. Developers often use an iterative approach, where they start with a simpler version, and then gradually build up to the full one.
So far, you've focused on learning the building blocks of software programs. You provided step by step instructions for how to complete a procedure. This is called procedural programming, and it's the first step in learning to code.
As your programs get larger, organizing your code becomes more important. Being able to reuse data and behaviors become really important. Object-oriented coding is a way of matching behaviors (methods) with the data they act on (class data) so your code stays organized. It also provides ways of reusing behaviors with variations.
This is a new way to think about code. It may take you a while to get your mind around it. That's normal. This is a major shift in how you think about writing code. Everyone takes some time to adjust. The next several lectures cover aspects of this material. You may need to come back and listen to them several times.
Object-Oriented programming uses classes to organize code. You have been creating one class per each programming assignment so far in this course, but we haven't yet used the special features that classes have. Now we'll dig in, and take a look at more interesting uses for them.
Within a class, there are several places where you can create variables. Some of them are accessible across the entire class, while others are not. You can even reuse existing variable names, provided you understand the side effects of doing so. This explores variable scope (where a name is usable) and shadowing (when it is and isn't okay to reuse the same name).
When multiple classes work together as a team, it helps for them to have very clear responsibilities, so they don't step on each other's toes. Java provides some code syntax to help support that process. It helps me to do just the work that's mine, and not touch your work, and it helps me understand from your code which parts I am or am not supposed to work with. This video covers the keywords public and private, and discusses get and set methods.
In this lesson, we're going to take off the training wheels we used to get you started in Java. We previously made every method static. Now you'll get a chance to see what that means. After this lesson, we'll only use static in code when it's absolutely necessary. Most of the time you will use instance variables and instance methods on different classes, instead of using static methods and putting everything in one class.
In the last lesson, we talked about the concept of what "static" means. We explored an example using a bulbCount variable. Here, we will go deeper into the code syntax, and we will also introduce static methods and talk about how they follow the same structure.
This video will demonstrate how to work from a set of requirements to a class definition, and then how to work through the syntax of creating the class. You won't need all of the ideas we covered in the prior video. Example code is attached to this lecture for you to download. You may want it printed on paper ahead of time for easy reference.
Next we'll dig deeper into how ArrayList works, and then examine how to create our checkout register class. You'll be referring to the same example code as in the previous lecture.
BlueJ comes with some tools meant specifically for helping new learners understand object-oriented concepts. This video will show you those tools and give you some code to experiment with, hands-on. These techniques are very useful when debugging your code.
When you start working with classes, you'll see a new type of error pop up, called an Exception. What does this mean, and what do we do about it? How do we find the code where it came from?
This video explores error reporting and error handling, especially the most common type of error you'll see, which is a Null Pointer Exception.
You'll be building a micro-blogging app, where users can post short updates to a private social media site. We won't worry about the user interface yet; first we are working on the data structure.
This practice exercise is in two parts so that you can fully build out and understand the data layer before you add in the interactions with the user. This helps you break down a complex problem into smaller problems, so you aren't overwhelmed when you're trying to code it. Refer to the instructions attached to the lecture for details.
When programmers work together, they end up sharing code. That's easier to do if we are consistent about how we name things. Java has a set of standard naming rules which exist to help us all keep our sanity when reading another person's code. Let's learn about these, so you can apply them to your microblog coding assignment, as well as future code you do.
Object-oriented programming is about using several Java classes as a team, to accomplish a goal. Each class should have only one job within that team - it should have only one responsibility. This keeps your code simpler to write and simpler to debug. It makes it easier to change the code later without having unexpected side effects. It makes your code easier to read and understand. It will help you keep your sanity when you're trying to deal with larger programs.
This video will show you how to use relationships between classes to make data available from another class, without cluttering up the class you're working in. You will need this information to complete the second part of the microblog assignment.
As you begin to plan larger programs, you'll need to coordinate the behavior of multiple classes, to collaborate as a team. How do you figure out each of their responsibilities? How do you decide what goes in one class versus another?
This lesson will explore ways to think about code structure, to help with your planning.
In this exercise, you will add user interaction (with menus) to your microblog program. You must have completed part 1 successfully before starting on part 2.
Be patient with this assignment; everyone struggles with it. This is your first big program. It will take hard work and lots of planning and time to work out the details. When you complete it, you will have a more solid understanding of object-oriented programming, separation of responsibilities between classes, and how to build an application with user interface code and data code. You will also practice naming conventions and capitalization along the way.
Just like naming standards, packages are a way to better communicate with other developers. A package is a folder of related Java classes, with a name for the set. This lesson will explore how to organize your code into packages.
This lesson explains how to read the Java documentation you'll find on the web. This is the primary source of information about the Java language, and it comes with Java. It's really important to spend the time to get familiar with it, because you'll be using it for your entire career in Java. It helps you find all the extra behaviors that make your software interesting, such as working with files, working with images and sounds, providing an application window and menus, and so on.
This is mostly a playground app, as in, it's your technical playground to explore some new technical ideas. It's very common to have a scratchpad area where you mess around when you're learning a new API. You're not really trying to do anything fancy with it, at first, just exploring the method calls and checking that you understand the results. This will be that kind of program.
See the docs attached to the lecture for details. You'll be writing methods that meet certain criteria.
We've been using the Scanner API for a long time, to get input from the keyboard, but I have not explained what it's really doing. You now have sufficient background to understand it, so let's take a look.
This lesson will explore the String API and Character API, with a focus on which methods are the most useful for basic operations. We'll also pick up several new vocabulary words that you will see frequently in API docs.
For this program, you'll be using the java.lang.String class. Pull up its Javadocs (API docs) in your web browser. http://docs.oracle.com/javase/8/docs/api/
You're going to create a merge letter to thank some donors to a charity. The letter has already been provided, as has the list of donors. This is a warm-up exercise; it's a way to get some hands-on time with using method calls. You'll get a more challenging problem in the next set.
You're going to write a method that changes a book title from all lowercase to the proper title case, including special rules for skip words such as "a", "an", "the", "of", and so on. Download the existing code attached to this lecture, to get started.
You've seen API docs for some of Java's built-in classes. Did you know that you can also write Javadoc for your own classes? You'll write the information directly in your code. Let's learn how.
Add javadocs to your classes, methods, and member variables from your blog post prior assignment. View the documentation in "Documentation View" occasionally as you work. Keep an eye out for anything you missed, and make sure it gets filled in. This gives you hands-on practice with writing Javadocs for your code.
Create a program that has you writing at least 2 classes and implements an idea of your choosing. Your idea can be anything you want.
Further explore using classes. Apply your learning to your own ideas. Start thinking about how to design a class to solve a problem.
The upcoming lessons on formal class structure get fairly academic and abstract. Be patient with your learning process. We're trying to tackle many tightly related topics all at once. You may need to revisit some of the earlier lessons in this section after you get context from later lessons in the section. We're picking up a toolkit of techniques now. Later, we'll build complex and interesting applications using these approaches, and we'll look at cool new code structures that it enables, and the powerful problems that lets us solve.
But, for now, we're just trying to get through all the pieces individually, which admittedly can be a bit of a boring process. If you find yourself lagging, try writing some freestyle code for fun using what you've learned so far. That can deepen your learning, provide a fun break, and make you more ready to do the next lesson. You can freestyle at any time.
This lesson investigates variable scope, which describes where a variable's name and value are accessible. It considers variable lifetime - how long does it exist. And it discusses variable name shadowing, which is when reusing a name works but hides another copy of it. We also discuss the kinds of compiler errors you'll see when you have a problem with variable scope.
This lesson explores the naming conventions and requirements for using a particular type of Java class, called a Bean. You will use these kinds of classes a lot as you move into data processing and more professional development.
When we create code to share with other developers, we need ways to guide their usage so the code works correctly. One common approach is to protect member variables by providing methods for get and set that include error checking along the way. In this lesson, you'll learn how to use get/set methods to improve the quality of data in your class.
In this exercise, you will add in methods to turn a sample code class into a Java bean. You'll work through naming get/set methods and practice consistency in naming in beans.
This lesson will be a bit different from what you've done so far. We're going to take a larger code example and explore it, touring the code, and learning about it. The example code is in the resources download section of this lecture. There's a set of Java files for BlueJ, and also a PDF with the source code in a more easily printed form. Print the code before you start the videos.
We will explore the provided code, describe its parts, and practice taking notes on the parts you don't understand. You will often need to understand someone else's code, when you're working on the job, and this gives you a chance to start building those investigation skills.
Building on part 1, this lesson will explore the details of the code you've just seen. If you've taken good notes on your questions in the first part, you may find that part 2 answers some of those questions. Others may wait until your learning advances a bit further. This continues the process of asking good questions about and investigating code that is new to you.
This lesson will explore the toString() method we found in the Link class, where it comes from, and why it's awesome and helpful. You can create your own toString() method for your own class, to improve printing of complex objects. This is great for debugging.
Java provides some very useful classes for working with dates and times, including the ability to do math with them, such as "What is the date that is 3 days after today?" The APIs are fairly large, and can be confusing to work with for the first time, so this lesson will explore the most common usage patterns and show you some recipes for how to work with them. It's heavily focused on example code.
Java provides classes to make it easier to format numbers in a way that is pleasing and easy to read. It also provides the same for dates and times. In this lesson, we'll explore how to print numbers and dates with pretty formatting, and also how to read a String that uses that format, and convert it back to a number or date.
In this practice, you will have a user enter some dates, and you will calculate the different in days between two dates, determine the weekdays, and print a list of dates using some given criteria (for instance every Friday in the year). You'll use the formatting classes to parse dates and to format them nicely for printing. Some of the logic gets a bit complex, so take your time with this one and plan carefully.
When we create code for others to reuse, it helps to be able to guide them to use it properly. Your javadoc comments can help with that, but another helper is if you can mark the code itself so it's less likely to be used improperly.
This lesson will explore the modifiers you can put on methods to prevent some methods from being used, which guides a person towards the others instead. Equally important, you can make the other developer use methods to access your data fields, so you can check the values before using them.
This is a deeper look at a topic we introduced briefly in a prior lesson.
Static methods and variables work at the class level rather than at the instance level. This lets you share information across multiple instances of objects. For example, you could count how many times the constructor was invoked, to know how many objects were created.
As you work with code with several Java classes that collaborate, you will need to make choices about how to organize your code. One of the tools for code reuse and collaboration is inheritance. Another approach is composition. This lesson will explore what each of those mean and what should guide your decision towards one or the other.
Moonlight Tapestries is planning a custom line of industrial size automatic embroidery machines. They've approached your team to start building a simulator for some stitching patterns. They're not ready to build the full product yet, but they want to run some experiments to see how well the computer can model stitch shapes on screen, and how it will cope with problems. This will help them plan out the rest of the requirements.
In this exercise, you will use methods, classes, and inheritance to solve a theme-and-variations behavior for machine automation.
There are two new modifiers to learn here: abstract and final. Abstract means "incomplete". Final means "complete and cannot be changed." At the class level, they're opposites, but on a more fine-grained level, they can be combined.
This lesson explores how abstract and final may be used, and what kinds of abstraction they're good for.
Java provides the "instanceof" operator to let you check whether the object in a variable is a subclass of a given type. For example, a String is an instance of an Object. Of course, in Java everything is an instance of an Object, so you will only actually care about class hierarchies that are more interesting than that.
Java provides this() and super() to make it easier to work with superclasses and the current class. This lesson will give you more tools for using the class hierarchy without repeating code you've already written.
When you're creating a subclass, it would be a pain to have to re-document all of the parent class's methods, or even the methods that you override from the parent. Thankfully, Java has a shortcut. You can inherit more than just code from a parent class - you can also inherit the Javadoc documentation. This lesson explores how.
Use inheritance somewhere in your project, in the way inheritance is meant to be used. This means that some of the behavior should be in a parent class, and some behavior should differ in at least two child classes.
You can use ideas borrowed from prior work, examples, the Web Scraper, or any other ideas you have.
This is a substantial piece of work, so take your time and plan out your ideas on paper before you code.
How does code respond when something unexpected goes wrong? What if the disk is full when you try to write a file? What if the wifi gets disconnected while you're in the middle of using the net? How does your program get the message, and what can it do to notify the user? Exceptions are a tool for recognizing and dealing with unexpected errors and assumptions that may no longer be valid.
In the last lesson, we explored what an exception is, and the difference between checked and unchecked exceptions. In this lesson, we'll go into more detail on how your code can intercept and handle an exception when it occurs, and how to make your code ready to handle multiple different kinds of exceptions that might occur.
Create some code that lets you practice throwing and catching both checked and unchecked exceptions. This is a syntax practice exercise, and leaves you some space to be creative with it.
Now that you know a bit about exceptions, we're going to dive into a fun topic - saving information to a file, and reading it back. A while back you created a blog post program, to practice object-oriented programming. Users could type in new posts, but the posts did not stick around the next time you ran the program. In this lesson, you'll learn the basic skills you need to save data in a file, so that it can be re-read the next time you run the program.
Pat is a teacher, and needs to keep track of student attendance. At the beginner of the year, the list of student names should be recorded, so it may be used for roll call later in the year. You will be writing a program to record the list of student names and save it to a file.
Practice using the java.io.* classes. Read information into Java, do things with it, and write it back out to disk. Prepare your understanding for the next assignment using more formal data structures.
Pat is a teacher, and needs to keep track of student attendance. In the prior exercise, you saved a list of student names in a file. This program will use a file similar to that (but not exactly the same) as the list of students, and will take attendance for class on a given day.
Works with data as a set of individual fields structured in a class.
When you're building larger applications, sometimes it is helpful to be able to create your own kinds of exceptions. This lets you have special error handling depending on what's happening in your program.
This lesson teaches you what you need to know to create your own custom exceptions for special cases.
In Java 7, Java 8, and later versions, there is an improvement in the try-catch syntax to help you not have to write duplicate error handling code. You can catch multiple exception types with the same catch block. This is a short-cut that you won't see in older Java code, but you will see in newer code and examples on the net.
Now that you can read and write text files, we're going to look at various data file formats that are in common use across the internet. We'll discuss what kind of file makes sense, depending on the kind of data you want to save. We'll learn about CSV, tab-delimited, and more.
You will write code that parses an attached data file, and calculates some counts and data exceptions along the way. The upcoming set of lessons goes into more detail on data processing, but for this challenge, you'll stick to fairly simple approaches. (So if something seems complicated, look for a simpler approach.)
Practice reading and writing files. Explore realistic data from a public data source. Start to think about data aggregation, which we'll explore in more depth in the upcoming section.
Complete freestyle! If you want to explore free sources of data, the data.gov website includes a variety of public domain data sources provided freely by the U.S. government. You may also consider creating your own data files if that's more interesting. Or, you might explore using exceptions and how throwing, catching, and reporting works. It's up to you!
I am a professional software engineer, with 22 years experience, with much of that on Java web application development.
I am also a mentor for an in-person women's coding group. I help women of all ages get started in technical careers, and many of them double or triple their income in the process! Working face-to-face with students for 3 years has helped me fine-tune my course materials to be easier for beginners to understand. This makes the course far more enjoyable, and less frustrating!
I have loved coding since I was a young girl. Although they did not have much money, my parents so valued education that they prioritized a computer for educational software over having hot running water. So I was 4 when I started coding, and 5 when I decided I wanted this as a career. It's been fun all along, so I never looked back. It was also my ticket to escaping poverty.
Now, I've taken the best parts of how I learned to code and turned them into a course using current technologies, making it more approachable and practical than many other courses. I especially make sure that no steps are skipped, so you won't get lost from lesson to lesson.
A clear, step-by-step course helps students start out successful, and then build the skills to stay successful, as they take on bigger challenges, without any impossible leaps. I focus on hands-on practice, so you spend most of your time actually coding, not just listening to lectures.
My courses are set up to allow and encourage collaboration. Talking about software helps us understand it. Some assignments in the course will invite you to demo your software to a friend. This is a chance to deepen your learning, and practice using the right words to talk about it, so you will do better in interviews one day! Professional coding is teamwork, so communication matters.
Freestyle assignments encourage you to build your own ideas immediately, using what you've just learned. The creativity is fun! And it helps you remember the material better. If you learn enough from my course to continue on your own without me, then we've both been very successful!
Coding is creative, practical, pays well, and is tremendously fun. Being able to listen to someone's problem and then build software to solve it is empowering and rewarding. As technology takes over the world, it's also valuable to understand what's happening inside the tech. It's a fantastic career path with far more jobs than people to fill them, and it lets you make a real difference in the world.
So I invite and welcome you to join me in the world of software development, where your own creativity, curiosity, and ideas can come out to play.
The best learning is engaging, meaningful, personal, and fun. Join us, and be part of this learning community!