design-patterns

Code is not working when i use abstract keyword in middle class

i have got below code which is working fine: public abstract class Beverage { public string description = "Unknown beverage"; public virtual string getDescription() { return description; } public abstract double cost(); } public abstract class condimentDecorator : Beverage { // public abstract string g...

C# Observer pattern: Still tightly connected?

ok, so I am stuck at the observer pattern here, almost all tutorials I read tell the subject class to subscribe the observer(s). But with encapsulation in mind, how is this not tighlty coupled? They still depend on each other know, don't they? What I mean to say is that the subject Class must know the observer object to add him to the ...

What is the difference between the Observer and Subject-Observer patterns

While watching some videos on Channel 9 about the Reactive Extensions for .NET, someone asked whether the Reactive Extensions library is an implementation of the Observer pattern. The presenter then went on to answer by saying that the library is an implementation of the Subject Observer pattern. This leads me to believe that there is po...

MapMaker Design Pattern ?

I was impressed by google's MapMaker design.I would like to know what is the name of the pattern that is used here ? ( What i think is it's somewhat like decorator pattern but in which we don't have to wrap the object in other object to extend the functionality,but I can't figure out exactly what sort of pattern it is. ) MapMaker Objec...

Patterns and Practices. Service layer??

Hi all, Should I be doing my automapping in my service layer or at my controller? I like the Idea of Repository - Raw data IQueryable type stuff with full domain(type) objects. Service layer - Paged, Ordered, Filtered, Automapped View model to return Controller - Push the view with the correct model But having seen some nice stuff wi...

object oriented design question for gui application

Hello, guys, I am programming a GUI for an application, a cd container to insert cd, and currently I am not very clear and I think I need some help to clarify my understanding about object oriented design. so, first, I use observer pattern to build abstract Model and View classes and also the concrete models(cd container) and concrete ...

DOFactory Design patterns. Anyone bought it ??? IS it any good

anyone bought the dofactory Design Patterns Framework ??? Did you find it to be any good??? http://www.dofactory.com/Framework/Framework.aspx thanks Niall ...

Useful design patterns for unit testing/TDD?

Reading this question has helped me solidify some of the problems I've always had with unit-testing, TDD, et al. Since coming across the TDD approach to development I knew that it was the right path to follow. Reading various tutorials helped me understand how to make a start, but they have always been very simplistic - not really somet...

"Facade" terminology question

I have terminology/modeling question about representing components in a service. Consider.. Scenario A: ICatalogService --exposes--> PublishingManager.Publish ICatalogService --exposes--> RetrievalManager.Retrieve Scenario B: ICatalogService --exposes--> CatalogManager.Publish ICatalogService --exposes--> CatalogManager.Retrieve D...

Can someone cite a good reference for programming with exceptions?

I prefer to have the "rc" error-code return style of error management. I agree that this presents challenges that are better served by throw-catch, however, I still feel that I am not designing and implementing in a style that is clean and maintainable. So, I am looking for a good book that discusses the pattern and is not simply a ref...

Could I use the Factory Pattern in this scenario?

Hi folks, I was wondering if I could - and how - I could use the Factory Pattern in this scenario? I have a the following classes... public interface IStub<T> where T : class { IEnumerable<T> CreateStubs(); } public FooStub : IStub<Foo> { public IEnumerable<Foo> CreateStubs() { ... } } public BarStub : IStub<Bar> { publ...

Design patterns in PHP

Hello, What are design patterns? And How do we implement them in PHP ? ...

objective-c delegates and events design (I don't get it)

Hi I'm pretty new to the objective-c language (less than three month) but is something that i really need to understand. Suppose a controller (in a iOS environment) that manage a table view for input data from the user. The table must have a editable cells and some features for make the value selection easier, for example a button that...

How can I create factory? Client can set data for methods which are not in defined in interface?(Design Problem)

Hello, I am having little design problem: I have one factory which will create object of with one type or another type. But my client requirement is to give(feed) the data(via setter methods) from outside world to the concrete class of type-1 not for type-2. If I place these setter methods in interface, those need to be implemented for...

Function pointers and their called parameters

This may be the wrong approach, but as I dig deeper into developing my game engine I have ran into a timing issue. So lets say I have a set of statements like: for(int i = 0; i < 400; i++) { engine->get2DObject("bullet")->Move(1, 0); } The bullet will move, however, on the screen there won't be any animation. It will basically "...

NHibernate - Many To One - NHibernate.LazyInitializationException - Could not initialize proxy

I am getting this exception when I attempt to access an object that is stored in a property of my domain object. I have done some research and still do not understand why I am getting this error. I have a very basic repository in which I am creating a session and then using a ICriteria query to fetch the first record from the list of r...

How to simulate multiple inheritance without interfaces?

How can I simulate multiple inheritance in C# without using interfaces. I do believe, interfaces abilityes are not intended for this task. I'm looking for more 'design pattern' oriented way. ...

Example implementation of 'TryParse' or 'TryGetValue'

Can you give me an example of implementation of .NET 'try' pattern? Edit: I don't mean a "try-catch" statement, I mean a try patterns, like those used in TryParse(), and TryGetObjectByKey() methods. Most specifically what to do with raised exceptions in custom 'try' pattern methods. Should I log it, should I ignore It. Does' anybody ...

Why not use object literals to create beautiful DSL in Javascript?

Coming from Ruby to Javascript, creating DSL now seems not as fun as in Ruby where it was very beautiful and elegant. Ruby Rake: task :hello do # do stuff end task :hello => [:dep1, :dep2] do # do stuff end Javascript Jake: task("hello", function() { // do stuff }); task("hello", ["deep1", "deep2"], function() { // do ...

Should all Front Classes use singleton?

Consider Martin Fowler's Patterns Of Enterprise Application Architecture, and the pattern of Front Controller: http://martinfowler.com/eaaCatalog/frontController.html Apparently, it uses the singleton pattern. Well, I have a package of classes in php application that work together (like Zend's Controller Package) and there is one class t...