I recently started digging into design patterns. Generally speaking, I thought the design issues that most of the design patterns solve do not generally occur in Ruby. Most of the design issues were because of datatypes (No dynamic typing and arrays can hold objects belonging to same class at a time etc. and many more.). Being a ruby and...
I'm trying to use an IOC container to create the initial object graph within my application.
I have a MainForm. This form depends on a MenuStrip, which depends on multiple MenuStripItems. Some MenuStripItems depend on the MainForm.
At the moment I setup all dependencies for constructor injection. Obviously, resolving the MainForm now r...
i try to learn design pattern, but it's really really hard to understand main idea of OOD. i have created my software with classic method. On the other hand i want to learn OOD. why i need singleton and others? i coded some simple program: one of them clasical(my style), the other is singleton pattern.Please teach me why do i need single...
I have been finding myself using the Chain of Responsibility pattern often (3 times is often for me) in my current project and I'm wondering if I have become a little over-enthusiastic about the solution. Specifically, I have been using the Apache Commons chain project. So, far I have been quite impressed by how it has simplified a numbe...
When is it ok to break "the law of demeter"? Any examples??
...
I'm maintaining a web application that utilizes the provider pattern as described below, for configuration purposes.
http://msdn.microsoft.com/en-us/library/ms972319.aspx
http://msdn.microsoft.com/en-us/library/ms972370.aspx
Everything has been working fine, but as we add functionality to our application, we are finding that our prov...
What is your threshold to use factory instead of a constructor to create an object?
You always use factory.
You use factories only if you have invariant checks other than checking for nulls.
You always use constructors
You rarely use factories... what are those cases??
pros and cons
Update: I am applying factory pattern from Domain ...
We had a debate - cons and pros of having a factory per dto in order to test some service.
The idea is that the service is being invoked with primitive types parameters (username, password, etc), but the service dependency should be leveraged using those primitives. The only way to test it was to inject into service an additional depende...
Steve Yegge describes the Properties Pattern in a blog post of his.
For someone using a static language like C# or Java, what are the advantages and disadvantages of this approach? In what kind of projects would you want to use the Properties Pattern, and when would you want to avoid it?
...
Hi,
I would like you learn more about Design Patterns for .NET (especially C#).
Which book(s) would you recommend?
...
I could use some advice/help on a piece of software I've developed.
The application is a wizard style app where users fill out fields on each form before choosing to go to the next form or back to the previous. Fairly simple.
Right now the menu calls frmWiz1(InitialData) and when frmWiz1 returns with DialogResult.OK the menu will call...
I'm really struggling to wrap my head around some of this stuff. Let me give an example of where I'm struggling.
I'm using Linq-2-Sql as the DAL for my app and the IRepository pattern used in the MVC Storefront sample app from Rob Conery.
In my domain I have a Customer Model which has a collection of Address Models. In my UI there is a...
I'm new to DDD and trying hard to understand some of the concepts. How do you determine in your domain what objects are Entity objects and which ones are Value objects, and how exactly are they treated differently?
...
I've designed an MVC (in .NET) where the View has no link to the Model. It only knows about the Controller. The traditional MVC pattern has all parts communicating with each other. In my case, the Controller is basically a mediator. This keeps any exceptions or logic out of the View. It has zero dependency on the Model. Is this no ...
Are there any design patterns/methods/ways to remove nested if then else conditions/switch statements?
I remember coming across some methods used by the Google folks listed in a Google code blog post. Can’t seem to find it now though
...
I've been using this pattern when I need to control how long various async operations take. I don't mean specifically for WebRequest (I know you can set the timeout property), I just used this as an example for the pattern.
var request = WebRequest.Create(someUri);
WebResponse response = null;
request.BeginGetRe...
I'm writing a GUI for an application using Swing, and in the interests of code maintenance and readability, I want to follow a consistent pattern throughout the whole system.
Most of the articles and books (or at least book sections) that I've read appear to provide plenty of examples on how to create and arrange various components, but...
If, in future, you were only able to use a single one of the canonical patterns defined in the Gang of Four book, which one would you choose and for what reason?
...
What are some of the things to watch for (pitfalls) while using IOC container?
...
In Steve Yegge's review of Design Patterns, he calls the Interpreter Pattern an "in-joke". He goes on to talk about how the perception of compilers have changed, yet how interpreted languages are still s*** on, although I can't see how this ties into the pattern.
Anyone want to enlighten this ignorant student?
...