Posts Tagged ‘Design Pattern’

Design Patterns in ActionScript-Proxy

aim-128x128Have you ever use HTTP-proxy or some other proxy? When you’re in a relatively isolated environment, such as the LAN in your company, maybe you’ll need it. Actually, when I was an intern in an IT company, I always used the HTTP-proxy to login the MSN and surf on the internet. When I used MSN or surf on the net, I can’t feel the existence of the proxy. And this is the role of a proxy. And this can be express as follows.

(more…)

Design Patterns in Action Script-State

RinoCeronte-256x256 Yesterday, when I was on my way home, I suddenly met an old friend. I haven’t met him since I began to write these articles. :) We stop at a little cafe, and began to talk.

“I’ve just changed my job”, he said, “and now I join the Orange”.

“WOW, Orange, you mean the biggest MP3 manufacturer company,” I answered.

“Yeah, and I join the new product team, we want to surprise the whole world by our new product.” He said proudly.

……. (The rest of our conversation is very boring, so, let’s stop here)

(more…)

Design Patterns in ActionScript-Builder

Box-Full-128x128 Have you ever buy a computer online, maybe from dell? In dell’s website, we just need to follow its process to order the accessories you need, then you can get your own computer configuration. Of course, you can’t get the real computer until you pay it :)

Here, you direct the producer to produce your own computer through the dell website. Ok, three roles here, you, dell website and the real producer.

(more…)

Design Patterns in ActionScript-Prototype

aquarium-128x128 When I want to write the Prototype pattern, I firstly look up the ActionScript 3.0 manual. I want to find out whether there is a clone method in Object class. If so, I will use this as an example. But, unfortunately, I can’t find this method in the Object class. Then I found the prototype attribute, but the explanation confused me. So, I decide to show you this pattern in my own way without using the Object class.

Firstly, you need to know the intent of this pattern. You can read the following text.

(more…)

Design Patterns in ActionScript-Iterator

chat-japonais-256x256 There is a famous saying in computer science, “Program = Data Structure + Algorithm”. It figures out the importance of how to organize the data and how to deal with the data.

Maybe, in your applications, you care more about how to show the data, because this has much to do with the user experience. However, how to organize the data and deal with the data is also or much more important, because this has much to do with the performance.

(more…)

Design Patterns in Action Script-Template Method

cat-3-256x256 Do you like playing cards? If your had ever played, you may noticed that everyone has their own way arranging the cards. And in most cases, people will put the cards in order, maybe from the biggest one to the smallest one. Eh, this is a way of sorting.

We can write down the following code to mimic this action.

(more…)

Design Patterns in ActionScript-Observer

cocktail-128x128 In GUI programming, event-driven is an important concept. Such as, when you programming in Flex, you may put a button on the stage, then you’ll add a callback function to the button. The function will be called when there is some action play on the button, such as click. This is almost the same with the observer pattern.

(more…)

Design Patterns in ActionScript-Singleton

Single-Seater-Djinn-Chair-128x128 In our real world, many things are one and only. For example, there is only one god in our world, and only one president in the USA, eh, I mean the current president. One and only is very important to our world, and so does to our program.

(more…)