design-patterns

Defining Game Object Behaviors in XML

I'm sure that there is a design pattern solution to my problem, but I can't seem to decide what a workable approach is. I know what I want, I'm just having trouble making the connections... I'll explain: I'm working on a game. I have GameObjects. I have GameBehaviors. The properties of my GameObjects are defined in an XML file which has...

Design Patterns in Database Applications with Java (JEE / JSE)

Hello everybody, I've been reading StackOverflow for quite a while now and I'm only now building the nerve to ask a question. I'm 20 years old and currently enrolled in college in IT here in my hometown (Cluj-Napoca, Romania). Enough for introductions :D. Basically I have my little software firm that provides Book-keeping appz. They're...

Scaling singletons

After having some difficult hours mulling over some architecture issues for my server-based application, I feel I am going to have to use singletons to accomplish my goal. Purely for the following reasons (justifying my smell): I don't need to pass expensive objects deep into a call stack I can perform functions on singleton management...

C#: "is" vs "as"

Possible Duplicates: Why is vs as when casting? casting vs using the as keyword in the CLR Suppose I have a variable whose type I don't know (object) and would like to perform several different actions based on what it is. The first thing which comes to mind is something like this: object MagicVariable = GetMagicValue(); if ...

Dependency Injection simple implementation

Hi, after reading this question i wonder if someone can help me understand how to implement correctly Dependency Injection with these PHP Classes: class DBClass { private $mMysqli; function __construct(mysqli $database) { $this->mMysqli=$database; } function __destruct() { $this->mMysqli->close(...

Hyperlink vs Button

Searching for input about UI design patterns regarding the use of hyperlinks vs buttons. A screen in a web application should/could have a mix of buttons and hyperlinks on it. It seems that the 'look' is the major governing factor as to which is used, but I want something more logical than that. Does anyone know of any hard and fast ru...

Storing Factory Pattern Products

Right now, I've got a switch statement which is being used to create objects based on a string. There are three types of objects which extend an abstract generic object. I should really be using a factory pattern, which I'm figuring out right now. My issue is thus: I appreciate the flexibility of the factory pattern, but right now I'm st...

Models In Model View Presenter MVP

Would I be correct in thinking that the 'Model' represented by the M in MVP could be a domain model or a presentation/view model? ...

In the strategy pattern can the strategy take the Context as parameter

Feedback summary I will now close this thead (I think there will be no more feedback) and try to summarize what I understood using the "Context" as a parameter for my strategy introduces a tight coupling that should be avoided and also could force me to expose properties that should perhaps remain hidden in the class. To minimize co...

Idiom vs. pattern

In the context of programming, how do idioms differ from patterns? I use the terms interchangeably and normally follow the most popular way I've heard something called, or the way it was called most recently in the current conversation, e.g. "the copy-swap idiom" and "singleton pattern". The best difference I can come up with is code w...

What Design Patterns are mostly used in Web/Enterprise Applications ?

What are some of the most common Design Patterns that are used in Web/Enterprise Application and why they are used ? Note: Answer to why part should be based upon listing the problems which they tend to solve ? ...

Ideas for structure of .net GUI app

Hey all- I'm looking for a strategy on how to structure a VB.net GUI app. I have a application that is basically an interface to a database. It is comprised of a TabControl with 6 tabs, each tab has a few custom controls and performs a business operation on the database. Tab Functions: Parse an XLS into SQL inserts and commit to ...

Design Question: Which is Better practice?

Hello, I have 3 different web servers which handle user data (username/passwd/email/etc.). I have 3 different web service calls respectively, so I've created 3 different classes which calls for the same information (getUsername, setUsername, getEmail, setEmail, etc.). From the main class I instantiate each webservice-call objects and whe...

Examples of Design Patterns used in Open-Source .Net projects

I am looking for examples of open-source projects that have made use of different design-patters. One example that comes to my mind is use of Proxy Pattern in NHibernate Help me find more ...

Are there any patterns or is there any standard terminology for inheriting data/objects?

I have a class A that has a collection of objects of Class B. Class A can also 'inherit' (for lack of a better term) the collection of objects of Class B from other instances of Class A. To model this, instances of Class A point to other instances of Class A (I control for circular references). A simplified concrete example might be th...

Doubt in Singleton pattern from wikipedia

Hi , I was refering to a solution from wikipedia for Singleton Pattern: public class Singleton { // Private constructor prevents instantiation from other classes private Singleton() {} /** * SingletonHolder is loaded on the first execution of Singleton.getInstance() * or the first access to SingletonHolder.INST...

Is storing iterators inside this class unwise? How else to iterate through this sequence?

Hi, Warning this is a long question! I am implementing a Solitaire card game in C++ on Win32, and after asking this question, it's becoming clear that I may need a bit of guidance regarding actual class design rather than implementation details. I am using a model view Controller pattern to implement the game. The model is the game, c...

Logging Options with BackgroundWorker in VB.net

Hey- I have a GUI class and a database class. I do something like: Dim db as Database = getDatabaseObject(logTxtBox) db.executeNonQuery("some update command here") Within executeNonQuery I connect to the db, execute the command, disconnect and catch the exceptions. logTxtBox is the GUI txt box I want log messages written to. Curr...

C++ Exception Design Pattern

Hello all :) I'd like to encapsulate Win32 errors (those returned from GetLastError()) in some form of exception class. Rather than having a single Win32 exception, however, I'd like to be able to have a specialized exception catchable for common errors, such as ERROR_ACCESS_DENIED. For example, I'd have classes declared like this: cl...

Enterprise Architecture Anti-patterns

What are the key anti-patterns to avoid when architecting applications for the enterprise? We are using C# and SQL Server and Silverlight, btw - but I imagine some of the anti-patterns will be language neutral. ...