We have a system at my work that is basically a message-driven state machine. It takes in a variety of types of messages, looks up some context/state based on the message, then decides what to do, based on the message and the current state. Normally the result is a message being sent out of the system.
Are there any good open-source f...
Should a collection of objects also be responsible for creating new objects?
Let me explain. I have two classes, PhoneCall and PhoneCallList. PhoneCallList is a collection of PhoneCall objects. Our architect and I are at odds on how to go about creating new PhoneCall objects. Currently the PhoneCall object has a method called Crea...
This question is specifically regarding C#, but I am also interested in answers for C++ and Java (or even other languages if they've got something cool).
I am replacing switch statements with polymorphism in a "C using C# syntax" code I've inherited. I've been puzzling over the best way to create these objects. I have two fall-back meth...
Are staging tables an anti-pattern that is used when rpc (such as Java RMI or some kind of Web Service call) or messaging queue (such as JMS) would be a better solution, or are there problems better served by staging tables?
To clarify:
By staging tables I mean those cases where records are appended to a table or tables by a process wh...
Here is an implementation example of the algorigthm in the base absctract class from http://sourcemaking.com/design_patterns/template_method/php
public final function showBookTitleInfo($book_in) {
$title = $book_in->getTitle();
$author = $book_in->getAuthor();
$processedTitle = $this->processTitle($title);
$processedAuth...
In my application, I have the following recurring pattern where I get the feeling that this is an incomplete or warped version of some common pattern that I'm not aware of. In my implementation, I can't seem to find a good way to implement a particular operation, as described below.
A collection of objects, let's call them "sources", pr...
In C++, say you want to declare a global variable to be used by many. How do you do it?
I commonly use declare and define in cpp file, and then use extern in other cpp file (and not headers).
I don't like this approach, and I am considering something along these lines:
In a header file:
some_file.h
Class MYGlobalClass
{
};
MyGl...
I have a customer hierarchy like so:
abstract class Customer {
public virtual string Name { get; set; }
}
class HighValueCustomer : Customer {
public virtual int MaxSpending { get; set; }
}
class SpecialCustomer : Customer {
public virtual string Award { get; set; }
}
When I retrieve a Customer, I would like to show on ...
Scenario
You have an Assembly for Data Transfer Objects containing 10 classes that exactly represent 10 tables in your database.
You generate / build a DAL layer that has methods like -
DTOForTable1[] GetDataFromTable1();
DTOForTable2[] GetDataFromTable2();
and so on....
Question
How do I make a method that hides the numerous...
I've come across a design pattern that's been referred to as a "Handler Pattern," but I can't find any real references to this pattern anywhere. It's basically just a one-method interface that allows you to easily extend the functionality on the back-end without making clients recompile. Might be useful for a web-service that has to ha...
I was studying the Oxite project on Codeplex. It has repository interfaces, and an implementation using LINQ to SQL. The LINQ to SQL results are projected to POCO objects in the repository implementations. It looks something like:
public IQueryable<Post> GetPosts()
{
return projectPosts(excludeNotYetPublished(getPostsQuery(siteID)))...
Does anyone know of some good downloadable visual studio solution files that explain all the GOF design-patterns (and their variants if possible) in .NET (C# preferred)?
...
We are currently designing a business application that has two primary requirements for it's UI:
1) run on the Desktop (WPF) for enterprise users to provide a rich user interface, interoperate with other applications, access the filesystem, work offline, work with special local hardware, etc.
2) run on ASP.NET/Ajax to provide several c...
When the user select an item from a dropdownlist and presses a button, my application shows a list of data manually binded and filtered according the selected value. If the user presses the Refresh button of the browser, it asks for confirmation whether the user is sure they want to submmit the query again.
I don't want the browser asks...
I'm trying to figure out the cleanest way to do this.
Currently I have a customer object:
public class Customer
{
public int Id {get;set;}
public string name {get;set;}
public List<Email> emailCollection {get;set}
public Customer(int id)
{
this.emailCollection = getEmails(id);
}
}
Then my Email object ...
Where can I find a discussion of the Binding in a way similar to GoF?
...
It looks like the more Mediators in a design, the less quality the design has. Because it means more is done in procedural scripts inside Mediators, and less in OOP.. How do you think?
It reminds mi Transaction Script vs Domain Model contrast from Martin Flower books.
I just catched myself on writing a Mediator object that connects 4 o...
Hi Everyone,
I work at a company with a large SAP investment, and we also have dozens of large .Net systems (mostly internally for engineering systems), and Java platforms (mostly for external web applications). As such, we have large development shops on ABAP, C#, and JEE.
We have over 20 major facilities distributed over very large d...
I'm having a right barney getting my head around how everything fits together using the MVVM pattern. It all seems quite simple in practice but trying to implement it I seem to be breaking various other rules that I try to code by.
Just as a side note, I'm trying to implement the pattern using Flex, not Silverlight or WPF, so if anyone...
I have two models: releases have many elements, and elements belong to releases.
The action I wish to define imports all elements (making copies of them all) from one release into another release.
How do I determine if this action belongs as a member action on the releases controller, or a collection action on the elements controller?...