Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Best Practices

Reply
 
Thread Tools Rate Thread Display Modes
Old 08-24-2007, 10:46 PM   #1
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
Default Command Pattern vs. Adapter Pattern

This these patterns seems quite similar to me.

The Command Pattern lets the clients to talk to the receiver through the use of a interpreter that knows how to speak with them both

The Adapter Patterns defines an interface for the client to use and that interface calls the appropriate methods methods on the receiver.

These 2 Patterns seem so similar. What am I missing?
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman
Flash Gordon is offline   Reply With Quote
Old 08-25-2007, 05:02 AM   #2
Assertnfailure
as[org].addListener(this)
 
Assertnfailure's Avatar
 
Join Date: Dec 2005
Location: LA, California
Posts: 838
Default

There are a lot of patterns that have subtle differences, but one big differentiator is the problem that they aim to solve.

A command is specifically used to consolidate an execution of a specific action.

An adapter is used in situations where pre-existing code needs to support a newer abstraction.
Assertnfailure is offline   Reply With Quote
Old 08-25-2007, 07:21 AM   #3
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
Default

Thanks for the reply

That's about what I got from my readings, too. So the main determining factor here (and with all OOP, maybe?) is the aim of what they are trying to do?
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman

Last edited by Flash Gordon; 08-25-2007 at 07:45 AM..
Flash Gordon is offline   Reply With Quote
Old 08-25-2007, 07:51 AM   #4
Assertnfailure
as[org].addListener(this)
 
Assertnfailure's Avatar
 
Join Date: Dec 2005
Location: LA, California
Posts: 838
Default

Pretty much. The point is to get an idea of the conventional solutions to common problems. This way you're not reinventing the wheel, and also you can communicate your solutions to other people.

In reality, a project won't just be a collection of patterns. A project should just be a collection of classes that are built with the mentality of solving in patterns....if that makes any sense.
Assertnfailure is offline   Reply With Quote
Old 08-25-2007, 09:39 AM   #5
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
Default

I'm glad to hear you say "In reality, a project won't just be a collection of patterns". I like that a lot and it make sense....in a which came first the chicken or the egg way.
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman
Flash Gordon is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling movie clip with pattern blu3 ActionScript 2.0 3 09-25-2006 08:24 AM
Quality pattern fill needed jsebrech ActionScript 2.0 2 08-16-2005 04:25 PM
gradient fill limitations, pattern fills jsebrech ActionScript 2.0 2 07-27-2005 12:23 PM
Conceptual: Making neighbour-aware mcs in a grid pattern? lowBoy ActionScript 2.0 0 02-18-2005 10:14 AM
Center Projector (how to use pattern in caption?) BadBadNeil Projectors and CDs 2 11-17-2004 01:00 AM


All times are GMT. The time now is 09:40 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.