Tag Archives: Java Video Tutorial

Composite Design Pattern Tutorial

Composite Design Pattern TutorialWelcome to my Composite Design Pattern Tutorial! The Composite design pattern is used to structure data into its individual parts as well as represent the inner workings of every part of a larger object.

The composite pattern also allows you to treat both groups of parts in the same way as you treat the parts polymorphically. This allows your objects to maximize complexity while also remaining dynamic.

All of the code follows the video to help you learn. It is heavily commented.

Continue reading Composite Design Pattern Tutorial

Facade Design Pattern Tutorial

Facade Design Pattern TutorialWelcome to may Facade Design Pattern Tutorial! The Facade pattern is extremely easy to understand. Chances are you have used it already and just didn’t know it.

The Facade pattern basically says that you should simplify your methods so that much of what is done is in the background. In technical terms you should decouple the client from the sub components needed to perform an operation.

All of the code that follows the video will fill you in on anything you don’t catch in the video.

Continue reading Facade Design Pattern Tutorial

Adapter Design Pattern Tutorial

Adapter Design Pattern TutorialWelcome to my Adapter Design Pattern Tutorial! This is a very easy design pattern to grasp and put into use.

This pattern is used when you want to translate one interface of a class into another interface. Now, it makes sense that these 2 interfaces are compatible otherwise the pattern may not make sense. To accomplish this, all you need to do is bridge the differences using our old friend composition again.

Watch the video and look at the code below and you’ll get it.

Continue reading Adapter Design Pattern Tutorial

Command Design Pattern Tutorial

Command Design Pattern TutorialWelcome to my Command Design Pattern Tutorial! The Command design pattern allows you to store a list of commands for later use. With it you can store multiple commands in a class to use over and over.

I cover the basic pattern in numerous ways including descriptions, diagrams and code. We look into executing commands on numerous objects. We also explore how to undo commands.

All of the code follows the video. Between it and the video you should be an expert on the Command Pattern.

Continue reading Command Design Pattern Tutorial

Decorator Design Pattern Tutorial

Decorator Design Pattern TutorialWelcome to my Decorator Design Pattern Tutorial. The Decorator allows you to modify an object dynamically. You would use it when you want the capabilities of inheritance with subclasses, but you need to add functionality at run time.

It is more flexible than inheritance. The Decorator Design Pattern simplifies code because you add functionality using many simple classes. Also, rather than rewrite old code you can extend it with new code and that is always good.

Continue reading Decorator Design Pattern Tutorial

Java Reflection Video Tutorial

Java Reflection Video TutorialWelcome to my Java Reflection Video Tutorial! I’ve been asked many times to cover Java Reflection lately and in this tutorial I’ll show you pretty much everything you can do with Java Refelection.

Many people are confused by reflection because they think it is a concept or technique. Java Reflection is an API and as soon as you know that it becomes easy. The Java Reflection API is used to manipulate classes and everything in a class including fields, methods, constructors, private data, etc. And, in this tutorial you’ll learn it all!

Continue reading Java Reflection Video Tutorial

Prototype Design Pattern Tutorial

Prototype Design Pattern TutorialWelcome to my Prototype Design Pattern Tutorial. The Prototype design pattern is used for creating new objects (instances) by cloning (copying) other objects.

It allows for the adding of any subclass instance of a known super class at run time. It is used when there are numerous potential classes that you want to only use if needed at runtime. The major benefit of using the Prototype pattern is that it reduces the need for creating potentially unneeded subclasses.

All of the code follows the video to help you learn.

Continue reading Prototype Design Pattern Tutorial

Builder Design Pattern Tutorial

Builder Design Pattern TutorialWelcome to my Builder design pattern tutorial. You use the builder design pattern when you want to have many classes help in the creation of an object. By having different classes build the object you can then easily create many different types of objects without being forced to rewrite code.

The Builder pattern provides a different way to make complex objects like you’d make using the Abstract Factory design pattern. All of the code follows the video to help you learn.

Continue reading Builder Design Pattern Tutorial

Singleton Design Pattern Tutorial

Singleton Design Pattern TutorialWelcome to my Singleton Design Pattern Tutorial. The Singleton pattern is both easy to understand as well as useful. I’ll demonstrate first how to implement the Singleton pattern. Then I’ll provide and example of its usefulness with a Scrabble example.

Threads can sometimes play havoc with this pattern, so I’ll show you how to avoid those problems. I’ll also review how to use threads, LinkedLists and more.

Continue reading Singleton Design Pattern Tutorial

Java Video Tutorial

Java Video TutorialA long time ago I started my Java Video tutorial. When I started this I wanted to completely cover the Java language. So, far I’ve recorded over 64 videos that are over 14 hours in total length.

I’m not near done with this tutorial, but I thought it would help if I combined all of these videos in just one post. Links to all of the code follows the videos. Videos on Android development, networking, design patterns and much more are still to come.

Continue reading Java Video Tutorial

Java Video Tutorial 60

Java Asteroids GameIn this video I continue my Java Asteroids game. I pretty much finish up the game in this tutorial.

I show you how to do a bunch of new things. I show you how to play sound in a JFrame. We introduce yet another way to handle collision detection. We remove items from the screen when they are destroyed. And, a whole bunch more is covered.

All of the code is available below and in this zipped archive.

Continue reading Java Video Tutorial 60

Java Video Tutorial 59

Java Asteroids Video GameIn the last part of this tutorial, I showed you how to make the PhotonTorpedo class using a UML class diagram.

In this tutorial, I show you how to make your space ship shoot the torpedos on the screen. As you’ll see, because I used good OOP design principles in the last video, adding the shooting feature will require very few changes.

All of the code follows the video. It is heavily commented to help you learn.

Continue reading Java Video Tutorial 59

Java Video Tutorial 58

Make an Asteroid Java GameAs we continue to make an asteroid Java game, I show you how to make your space ship shoot.

It sounds like a simple concept until you realize the ship is shooting while it is rotating through space at an angle that may not be equal to the direction it is moving. Don’t worry, we’ll figure it out together in this and the next tutorial.

Like always the code follows the video. I broke it up into separate pages per your requests 🙂

Continue reading Java Video Tutorial 58

Java Video Tutorial 57

Make a Java Asteroids GameIn this video I continue making a Java Asteroids game while teaching about OOP design principles. In previous videos I showed how to make a Java UML class diagram and then we turned the UML class diagram into a class.

Here I finish up the class so that you can now fly your ship in any direction. You’ll also be able to keep it on the game board and use life like velocity that accelerates.

All of the code is below and is heavily commented to help you learn.

Continue reading Java Video Tutorial 57

Java Video Tutorial 55

Java OOP Design PrinciplesIn this part of my Java video tutorial I focus on Java OOP Design Principles. We are still making the game we started in make a Java game, but now I’m creating all of the needed parts with strong use of encapsulation.

I walk you through the think process of going from features needed to a finished UML class diagram. I know this is an odd way to talk about OOP design principles, but I wanted to present it in a new fresh way.

What’s better than making a game while learning OOP?

Continue reading Java Video Tutorial 55

Java Collision Detection With Polygons

Java Collision Detection With PolygonsI’ve been asked many times to create a program that handles Java collision detection with polygons. This is a continuation of my tutorial on how to make a Java video game and if you haven’t been watching you should check it out.

It is surprisingly easy to handle collision detection with polygons. All you have to do is surround all of your polygons with rectangles and a handy dandy method named intersects handles pretty much everything else!

All the code follows the video.

Continue reading Java Collision Detection With Polygons

Java Video Tutorial 53

Rotate Polygons JavaI first started the how to make Java games series to solve a bunch of problems. Many people in the forms are posting extremely complicated ways to rotate polygons in Java for example. It is very easy to rotate polygons!

I also saw many people struggle with other calculations like: Finding the length and angle of a line between vectors / Calculate the points of a rotating polygon / Calculate the area of irregular polygons / Find the center points of an irregular polygon / Repeat keyboard clicks if the user holds down a key…

Continue reading Java Video Tutorial 53

Java Video Tutorial 52

Make a Java GameIn this part of my Java video tutorial, I create the spaceship object and a keyboard listener. I will use the keyboard listener to move the ship around the screen.

It is so easy to randomly add objects to the game we started making here Make a Java Video Game. I slowed things down a bit here, just to make sure you completely get the process.

All of the code is available under the video. Please feel free to ask questions.

Continue reading Java Video Tutorial 52

Java Video Tutorial 51

Java Animating SpritesHere I continue what I started in Make a Java Video Game. If you haven’t seen it, watch it before this video.

I’ll now create the GameBoard class that will animate all of my asteroids. I redraw the board using threads. If you are rusty on them, check out my Java Thread Video Tutorial.

The code follows the video and should be used to help you better learn this material.

Continue reading Java Video Tutorial 51

Java Video Tutorial 50

Make a Video Game JavaI wanted to make the 50th part of my Java Video Tutorial special! In this tutorial, I answer numerous questions.

I begin showing you how to design a game like Asteroids. I start teaching OOP design principles using UML. You learn how to draw polygons on the screen and how to animate them. And, to top it all off I show you how collision detection works.

Yes, there is a lot in this 14 minute video 🙂

Continue reading Java Video Tutorial 50