Showing posts with label design patterns. Show all posts
Showing posts with label design patterns. Show all posts

Wednesday, May 18, 2011

PatternCraft - Builder Pattern

This PatternCraft tutorial explores the Builder Pattern in the context of building out maps in Starcraft:

Tuesday, May 17, 2011

PatternCraft - Adapter Pattern

PatternCraft is a series of video tutorials which uses Starcraft references to teach Design Patterns. This tutorial covers the Adapter Pattern by showing how to add Mario and Sonic to Starcraft.

Monday, May 16, 2011

PatternCraft - The Differences Between the Bridge, State, and Strategy Patterns

I've already covered the state pattern and the strategy pattern, but many people find it difficult to distinguish between the two. I put this tutorial together to help highlight the differences. I also included the bridge pattern because, although it's not a "behavioral pattern", it's usage is very similar and helps show how different these patterns really are.

Friday, March 18, 2011

PatternCraft - Abstract Factory Pattern - Part 1

PatternCraft is a series of video tutorials that use StarCraft references to teach Design Patterns.

Wednesday, February 09, 2011

Friday, February 04, 2011

PatternCraft - Chain of Responsibility - Part 2

PatternCraft is a series of video tutorials that use StarCraft references to teach Design Patterns.

Tuesday, February 01, 2011

Monday, December 20, 2010

PatternCraft – Decorator Pattern

PatternCraft is a series of video tutorials that use StarCraft references to teach Design Patterns.

This video is the sixth in the series and covers the Decorator Pattern.


Source is here: http://github.com/johnlindquist/johnlindquist.com/tree/master/DecoratorPatternDemo/src/

Wednesday, October 13, 2010

PatternCraft – Mediator Pattern vs. Framework Mediators

*quick note - this video compares the Mediator Pattern to using Mediators in the Robotlegs framework. I start with a simple demo and refactor to both approaches so there is A LOT of simple code being thrown around to show you how you can do the same thing in so many different ways.

Hey guys, I've been trying to catch up on sleep the past couple weeks while trying to shake this cold. Hopefully I can get back on track to releasing a video per week now that I'm feeling better.

Anyway, this Mediator Pattern video really has very little to do with Starcraft since it's all about linking up buttons and a textfield. If you'd like, you can pretend I opened Starcraft and demoed the menu system or something if that makes you feel better ;)

You can watch it in the player below or just download it here to watch however you'd like:


Other PatternCraft tutorials:
Visitor Pattern
Memento Pattern
Command Pattern
State Pattern
Strategy Pattern

Tuesday, September 21, 2010

PatternCraft – Visitor Pattern

PatternCraft is a series of video tutorials that use StarCraft references to teach Design Patterns.

This video is the fifth in the series and covers the Visitor Pattern.


Other PatternCraft tutorials:
Mediator Pattern
Memento Pattern
Command Pattern
State Pattern
Strategy Pattern

Source is here: http://github.com/johnlindquist/johnlindquist.com/tree/master/VisitorPatternDemo/src/

Sunday, September 19, 2010

PatternCraft – Memento Pattern

PatternCraft is a series of video tutorials that use StarCraft references to teach Design Patterns.

This video is the fourth in the series and covers the Memento Pattern.


Other PatternCraft tutorials:
Mediator Pattern
Visitor Pattern
Command Pattern
State Pattern
Strategy Pattern

Source is here: http://github.com/johnlindquist/johnlindquist.com/tree/master/MementoPatternDemo/src/

Thursday, September 09, 2010

PatternCraft – Command Pattern

PatternCraft is a series of video tutorials that use StarCraft references to teach Design Patterns.

This video is the third in the series and covers the Command Pattern.


Other PatternCraft tutorials:
Mediator Pattern
Visitor Pattern
Memento Pattern
State Pattern
Strategy Pattern

Source is here: http://github.com/johnlindquist/johnlindquist.com/tree/master/CommandPatternDemo/src/

Tuesday, August 31, 2010

PatternCraft - State Pattern

PatternCraft is a series of video tutorials that use StarCraft references to teach Design Patterns.

This video is the second in the series and covers the State Pattern. You can watch it in the player below or just download it here to watch however you'd like:


Other PatternCraft tutorials:
Mediator Pattern
Visitor Pattern
Memento Pattern
Command Pattern
Strategy Pattern

Source is here: http://github.com/johnlindquist/johnlindquist.com/tree/master/StatePatternDemo/src/

Wednesday, August 25, 2010

PatternCraft – Strategy Pattern

PatternCraft is a series of video tutorials that use StarCraft references to teach Design Patterns.

This video is the first in the series and covers the Strategy Pattern. You can watch it in the player below or just download it here to watch however you'd like:

Visitor Pattern
Memento Pattern
Command Pattern
State Pattern

Source is here: http://github.com/johnlindquist/johnlindquist.com/tree/master/StategyPatternDemo/src/

Tuesday, February 24, 2009

Memento Pattern - Recording State

Here's a little preview for the video I'm going to make tomorrow about the Memento Pattern.

To play with the .swf follows these steps:

1. Click the .swf to give it keyboard focus
2. Press the SPACE BAR to start your recording
3. Move the MOUSE around to change the red circle's position
4. Press the SPACE BAR again to stop the recording
5. Press the LEFT and RIGHT keys to rewind and fast forward through actions you took

Neat trick, huh? :)

source

Memento Pattern - Recording State

Here's a little preview for the video I'm going to make tomorrow about the Memento Pattern.

To play with the .swf follows these steps:

1. Click the .swf to give it keyboard focus
2. Press the SPACE BAR to start your recording
3. Move the MOUSE around to change the red circle's position
4. Press the SPACE BAR again to stop the recording
5. Press the LEFT and RIGHT keys to rewind and fast forward through actions you took

Neat trick, huh? :)

source

Monday, February 23, 2009

Command Pattern - Queuing Commands

This is a slight variation of the previous example, with a much different result. If you look at the source you'll see that only the click handlers of the buttons have changed.

Now, whenever you click a green, red, or blue button each action will queue up waiting for you to click the black button. Once you click the black button, every action queued up (meaning each circle waiting to be created) will execute all at the same time.

View Queued Commands example
source

Command Pattern - Queuing Commands

This is a slight variation of the previous example, with a much different result. If you look at the source you'll see that only the click handlers of the buttons have changed.

Now, whenever you click a green, red, or blue button each action will queue up waiting for you to click the black button. Once you click the black button, every action queued up (meaning each circle waiting to be created) will execute all at the same time.

View Queued Commands example
source

Command Pattern - Undo and Command Stack

As requested, here's a demo of the command pattern in action. This example shows how to use the Command Pattern to undo an action. Please watch the video in the previous post before browsing through this source.

Try to focus on how the commands are all added into the command stack, then you'll see how the stack can be used for undoing, redoing, logging actions, queuing actions, and all sorts of other useful stuff :)

Click on the green, red, and blue boxes to create new circles. Click on the black box to undo.

source

Command Pattern - Undo and Command Stack

As requested, here's a demo of the command pattern in action. This example shows how to use the Command Pattern to undo an action. Please watch the video in the previous post before browsing through this source.

Try to focus on how the commands are all added into the command stack, then you'll see how the stack can be used for undoing, redoing, logging actions, queuing actions, and all sorts of other useful stuff :)

Click on the green, red, and blue boxes to create new circles. Click on the black box to undo.

source