Memento Design Pattern Tutorial

Memento Design Pattern TutorialWelcome to my Memento Design Pattern Tutorial! The Memento design pattern provides a way to store previous states of an Object easily.

It has 3 main classes. Memento: The basic object that is stored in different states. Originator: Sets and Gets values from the currently targeted Memento. Creates new Mementos and assigns current values to them. Caretaker: Holds an ArrayList that contains all previous versions of the Memento. It can store and retrieve stored Mementos. All of the code is down below to help you learn.

Continue reading Memento Design Pattern Tutorial

Mediator Design Pattern Tutorial

Mediator Design Pattern TutorialWelcome to my Mediator Design Pattern Tutorial! The Mediator design pattern is used to handle communication between related objects (Colleagues). All communication is handled by a Mediator Object and the Colleagues don’t need to know anything about each other to work together.

The Gang of Four description: Allows loose coupling by encapsulating the way disparate sets of objects interact and communicate with each other.  Allows for the actions of each object set to vary independently of one another.

Continue reading Mediator Design Pattern Tutorial

Make Java Executable

Make Java ExecutableI’ve been asked many times to show how to make a java program executable. It is actually very easy to make Java executable on any computer.

The main tool you’ll use on a PC is the Command Line or DOS Prompt. To find it click Start and in the box at the bottom type cmd.exe. If you’re on a MAC, just search for terminal in the search box.

I walk through everything in the tutorial video below. If you need any other help, everything follows in text format after the video.

Continue reading Make Java Executable

Interpreter Design Pattern Tutorial

Interpreter Design Pattern TutorialWelcome to my Interpreter Design Pattern Tutorial! The Interpreter design pattern is ignored by most, but in this tutorial I’ll show you how to do some cool things with it.

In top of that, I’ll also answer all of the recent questions I’ve received about both Java Reflection and String manipulation. I found you can do pretty great things if you combine reflection with the interpreter design pattern.

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

Continue reading Interpreter Design Pattern Tutorial

Mac Game Controller

Best Mac Game ControllerI’ve been asked my opinion on the Best Mac Game Controller recently many times, so this weekend I tried a bunch of Mac game controllers out. Even though you may have heard otherwise, the XBox 360 controllers and the off brand versions don’t work consistently.

After trying 5 Mac game controllers, the best for the Mac is the PS3 Dualshock 3 Wireless. It connects effortlessly with the help of the Gamepad Companion 2.4, which you can download here for free. The only other thing you need is a USB 2.0 A to Mini-B Cable for charging you controller. Everything else you need to do is covered in the video below.

Continue reading Mac Game Controller

Chain of Responsibility Design Pattern Tutorial

Chain of Responsibility Design Pattern TutorialWelcome to my Chain of Responsibility Design Pattern Tutorial! Wow, that was a mouthful!

This pattern has a group of objects that are expected to between them be able to solve a problem. If the first Object can’t solve it, it passes the data to the next Object in the chain. In this tutorial, I’ll use it to make the right calculations based off of a String request. While that is pretty simple the capabilities of this pattern are endless.

The code follows the video to help you learn.

Continue reading Chain of Responsibility Design Pattern Tutorial

Proxy Design Pattern Tutorial

Proxy Design Pattern TutorialWelcome to my Proxy Design Pattern Tutorial! The Proxy design pattern limits access to just the methods you want made accessible in another class.

It can be used for security reasons, because an Object is intensive to create, or is accessed from a remote location. You can think of it as a gate keeper that blocks access to another Object. I demonstrate how the proxy pattern works using some code used in my State Design Pattern Tutorial. You may want to check that tutorial out before proceeding.

Continue reading Proxy Design Pattern Tutorial

State Design Pattern Tutorial

State Design Pattern TutorialWelcome to my State Design Pattern Tutorial! I explain how the state pattern is used by using it to simulate an ATM machine.

I explain how you come to decide on the different states. I then show you how to design the interface that each state will use. We think about the methods that are needed for every class that implements the interface then.

All the steps are looked at from many directions and the code below will fill in the gaps.

Continue reading State Design Pattern Tutorial

Easy Veggie Burger Recipe

Easy Veggie Burger RecipePreviously I showed you my black bean veggie burger recipe and this time I’ll show you my easy veggie burger recipe. I actually prefer the taste of this recipe and it is much cheaper. It costs about 50 cents a burger!

I started experimenting with veggie burger recipes a while back because they were so expensive. Most recipes you find online also take forever, or fall apart. Not this one!

It comes in at just 136 cal. 3 g fat, 12 g protein and 4 g sugar. The recipe follows the video.

Continue reading Easy Veggie Burger Recipe

Flyweight Design Pattern Tutorial

Flyweight Design Pattern TutorialWelcome to my Flyweight Design Pattern Tutorial! The flyweight design pattern is used to dramatically increase the speed of your code when you are using many similar objects.

To reduce memory usage the flyweight design pattern shares Objects that are the same rather than creating new ones. In this tutorial, I’ll create 100,000 rectangles and show you the difference in speed versus creating unique rectangle objects versus the flyweight design. The code follows to help you learn.

Continue reading Flyweight Design Pattern 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

Iterator Design Pattern Tutorial

Iterator Design Pattern TutorialWelcome to my Iterator Design Pattern Tutorial! The iterator design pattern allows you to access objects that are stored in many different collection types.

You do this by creating a common interface that these classes share. Then you have them provide you with an iterator that allows you to traverse the objects they contain.

Because they all share a common interface you can treat them polymorphically and eliminate a lot of duplicate code. The example video will explain how and the code that follows will reenforce the concepts.

Continue reading Iterator Design Pattern Tutorial

Healthy Pork Chop

Healthy Pork ChopToday I’ll show you how to make a healthy pork chop! A normal pork chop is: 286 Calories, 18 G of Fat and 93 mg of Cholesterol. Mine in comparison is only 120 Calories, .5 G of Fat and 0 Cholesterol.

Just like I did in the past, I’ll make this breaded pork chop with a meat alternative called Seitan. This video also could be called how to make seitan. Seitan is a meat alternative that has the same texture as meat and if prepared right it will taste just like a pork chop in this situation. The recipe follows the video.

Continue reading Healthy Pork Chop

Template Method Design Pattern Tutorial

Template Method Design Pattern TutorialWelcome to my Template Method Design Pattern Tutorial. It is an extremely easy design pattern to understand and use.

With this pattern, you define a method (algorithm) in an abstract class. It contains both abstract methods and non-abstract methods. The subclasses that extend this abstract class then override those methods that don’t make sense for them to use in the default way.

It may sound complicated, but it definitely isn’t. It is also extremely useful. Look at the code after the video to get a complete understanding quickly.

Continue reading Template Method Design Pattern Tutorial

Healthy Sausage

Healthy SausageToday I do the impossible! I show you how to make Healthy Sausage! Now by healthy sausage, I mean it tastes like sausage and it has the same texture as sausage. It is however made from Textured Vegetable Protein instead of pork and the other random things you find in unhealthy sausage.

My healthy sausage patties are 158 calories each. They have 9 Grams of Fiber (50% requirements), 14 Grams of Protein (30% requirements) and only 3 Grams of Fat (.05% requirements). Your average unhealthy sausage patty is 230 Calories with 198 of those Calories coming from Fat! My sausages are even healthier than normal veggie patties!!!

Continue reading Healthy Sausage

Bridge Design Pattern Tutorial

Bridge Design Pattern TutorialWelcome to my Bridge Design Pattern tutorial. If you ever wanted to build a group of classes that slowly added functionality from one class to the next, this is the design pattern for you.

There seems to be a lot of confusion in regards to what constitutes a bridge design pattern in both books as well as online. In this tutorial I will show you how it was explained to me and the ways in which I have found it is useful.

The code after the video goes into greater detail if you’d like to check that out.

Continue reading Bridge Design Pattern Tutorial