Hello!
If you have watched Going Deep shows of the Channel9 lately, one very frequently mentioned topic is mathematical duality in programming. TomasP has a good blog post about duality in object oriented programming.
This has been since Microsoft Research found that the observer design pattern is actually a mathematical dual of the it...
Hi, I would like to know the best practice for a designing a simple CRUD application with some screens updating various tables (like admin pages to maintain static data for an application). the simplest way would be to drag a data grid/gridview, bind it to a dataset and use a data adapter for CRUD operations. but if this application need...
Take the following classic factory pattern:
public interface IPizza
{
decimal Price { get; }
}
public class HamAndMushroomPizza : IPizza
{
decimal IPizza.Price
{
get
{
return 8.5m;
}
}
}
public abstract class PizzaFactory
{
public abstract IPizza CreatePizza(ItalianPizzaFactory...
Hi Stackoverflow,
I was thinking about implementing a logic similar to observer pattern on my website, for implementing hooks.
What I am looking for is something similar to this http://stackoverflow.com/questions/42/best-way-to-allow-plugins-for-a-php-application
However the code there is too limited, as I cant attach multiple hooks t...
Hello,
I have been given a new task from the client which is basically creating a CMS for actors/singers and the like that client will be selling out to them.
It will basically be a package and would work out-of-box pretty much similar to WordPress, you just hand over to whoever buys it but of course this is not going to be a blogging ...
I'm putting together a method which is supposed to evaluate the input and return true if all conditions are met or false if some test fails. I'd also like to have some sort of status message available to the caller if there's a failure.
Designs I've come across include returning the bool and using an out (or ref) parameter for the messa...
It seems to me that the Observer design pattern as described in GOF is really the same thing as Listeners found in various toolkits. Is there a difference between the concepts, or are Listeners and Observers really the same thing.
(I'm not looking for any specific computer language implementation, I just want to understand the differen...
I have a series of application properties which all have different types.
The types could include, booleans, dates, timestamps, or strings.
I need to be able to provide the ability for administrative users to change these properties and have the system to remember / persist them to a file.
I am looking for a best practice way to stor...
I'm looking to implement an object that is journaled, or has a persistent transaction in it. That is, the object contains data (a Map perhaps). As changes are made to the data, those changes are held separately, sandboxed if you will, so that any outside object can either reference the base state (before the changes) or can access the la...
What is a name of that pattern ? I guess, it's a factory, but i am not sure.
using System.Windows.Forms;
public class TreeNodeHelper
{
public TreeNode GetTreeNodeType1()
{
return new TreeNode("type1");
}
public TreeNode GetTreeNodeType2()
{
return new TreeNode("ty...
Hi,
I have an object can be compose by components but each components has a type and should be unique :
Class Client{
Set<IComposite> elements
}
interface IComposite{
String getType();
}
class Status implements IComposite{
String getType(){return "status"}
}
class ClientDates implements IComposite{
String getType(){return "c...
The project that I have just joined uses the command pattern quite extensively for handling calls into the business logic layers of the project.
The business logic layers are built as static handlers calling into providers. The commands then call into these static handlers.
The team want to improve test coverage, and I would like us t...
In MVC-Model View Controller design you implement the model to work seperately and contain buisness logic, pulling information down from the database.
I struggle so much with the design of implementing a good model. I know what information needs to be pulled down from the database, I just don't know the best way to implement it. I think...
We have a ASP.NET 3.5 site that has multiple search pages, customized what you're trying to search for. These search pages are similar, in that they behave the same and have the same design, but the actual search fields may be different depending on what table you're searching on.
I'm updating this to use div's and collapse/expand Java...
There is the:
put a FK to your parent method
, i.e. each records points to it's parent
Which is a hard for read actions but very easy to maintain
And then there is a directory structure key
0001.0000.0000.0000 main branch 1
0001.0001.0000.0000 child of main branch one
etc
Which is super easy to read, but hard to maintain.
Wha...
I am about to implement a class to represent a validation error. The class would definitely contain a string value called Message, which is a default message to display to a user. I also need a way to represent what the validation error is to the programmer. The idea is that there should be an easy way to determine if a particular valida...
Let's say you have a notes table. The note can be about a particular account, orderline or order.
Notes that are about the account do not apply to any specific orderline or order.
Notes that are about the orderline also apply to the parent order and the account that is attached to the order.
Notes that are on the order also apply to t...
Hi all,
Just as there is a naming convention for the Observer pattern (or rather, a naming convention for events in languages such as C#) using Event/Handler passing EventArgs and such, are there naming conventions that you use to easily highlight other patterns in your code?
edit: I originally wanted to ask about the Strategy pattern,...
Hi,
Tell me simple design flaw which you have faced(irrespective of programming language) while you code and how did you over come with that?
...
Some of my classes should be treated differently. Which solution is better:
Introduce new interface to my class hierarchy and check whether the class implements it or not, using RTTI (runtime time identification)
Add a method which returns boolean value that indicates whether this class should be treated normally or deserves special tr...