I’m John C Bland II

Husband, Father, Tech Author, Deacon.
Founder of Katapult Media, and full-stack polyglot developer.
Political Free Agents Podcast Host.

I create. I launch.

YouTube Channel

I post regular fun on YouTube like me playing the bass and anything else I find fun. 

Get Something Built

All project work goes through Katapult Media. Business is open. Let’s chat.

I’m contemplating an approach to this IM/Chat application I’m about to build and the “Command Pattern”:https://www.johncblandii.com/2007/09/desert-code-camp-day-1.html came into mind. Here are my thoughts…please respond and let me know what you think of the approach.

Ok, so the app will integrate with a Jabber server which uses xml sockets. So, I’m seeing a few commands here.

# Send Message
# Request Add to Buddy List
# Remove from Buddy List
# Send Group Chat Request

etc….

So, these commands would be used in a CommandButton class (uses composition; accepts a target DisplayObject [bare minimum; could be a button, etc] and a command). When the “button” is clicked the command is executed. Undo wouldn’t be needed for these but the pattern seems to fit.

My struggle comes with what the command would consist of. The execute command would have to send the XML Socket request. This goes against every developer bone in my body. Constructing the data to send is one thing but handling the send is another.

That led me to another thought. If I create an XMLSocketCommandBase.as that holds all of the XML Socket sending code then I could keep all of the send code there, have the individual commands extend it, and enjoy a single place for XML Socket code. My only gripe here is having multiple instances of the XML Socket code and not just 1.

Anyways…this is my developer rant/thought for the day. I go through this all the time mentally but should probably start spec’ing out the apps instead of just mentally thinking over it. 😀

Let me know what you think.