Browsing All Posts filed under »Design patterns«

Design Patterns: Refactoring an If/Then/Else State Handler using the State Pattern

August 1, 2011

0

Lets consider you wrote this code to save files either locally or over a network connection (the values in capitals are Constants used in your code instead of hard coded values): class MyFile() { // Set our starting position var dataState=DATA_STATE_UNCHANGED; var fileSaveState=FILE_SAVESTATE_UNSAVED; // Store our data binaryData:BinaryData=new BinaryData();  public method saveFile() {    if(dataState==DATA_STATE_UNCHANGED) […]

Design Patterns: Using Maps to cancel out Switch statements

July 30, 2011

0

Cancelling out Switch statements [Removed from other post – requires editing] If you take the code example from “Design Patterns for Dummies”, “Design Patterns” or “C# Design Patterns” and many other resources you will find by default a Switch statement like this: // The default Switch Statement you find in a lot of code (examples) […]

Design Patterns: Getting things done (1) Managing processes with the Mediator and State Pattern

July 30, 2011

0

In this post and the next series of posts we will look at 6 patterns to get thing done. The Mediator and State Pattern This post will focus on the Mediator and State Pattern and provides you a brief overview of the similarities and differences in use and approach. To improve some of the shortcomings […]

Design patterns: an introduction

July 30, 2011

0

It has taken me a while to wrap my head around design patterns. I read four books recently, including “Design patterns” by the Gang of Four (referred to as “Design Patterns”, “Design Patterns for Dummies” by Steve Holzner, “C# Design Patterns” by Judith Bisshop and “ActionScript 3.0 Design Patterns” by William Sanders and Chandima Camarantunge. […]

Self-managing objects – To support Agile development processes

July 8, 2011

0

The main issue: avoiding entanglement of dependencies When you build software, at a certain point you will start building (managed) lists of objects. You might even have one or more managers taking care of this. For instance: Person – Is a Value Object (VO) containing a person. PeopleManager – Is a manager containing a List […]

Breaking Object Dependencies via String References, static variables and Dictionaries

April 14, 2011

0

When you run a project with many objects clustering and cross-referring, the trick is to keep it simple, to avoid a complex mess of objects and object references. Here is the base-list of what I started doing for just such a project in Flex in the past year: Define the main identifiers – Preferably as […]

The poetry of Database Programming

January 5, 2011

1

Building a database is very much like poetry. In the wee hours I am working on a new project involving database design for a site that should be able to handle thousands of concurrent user sessions per hour. It has been a while since I have been doing something more than the mundane database designs, […]