design-patterns

MVP vs MVC

Duplicate: What are MVP and MVC and what is the difference? In a nutshell, what's the diff? When would I choose one over the other? ...

Accessing a template base classes function pointer type

I have a class that I've been provided that I really don't want to change, but I do want to extend. I'm a pattern and template newbie experimenting with a Decorator pattern applied to a template class. Template class contains a pointer-to-member (if I understand the semantics correctly) in yet another class. The pointer-to-member is t...

Example of an Abstract Factory in .NET

Are there any good examples of the "Abstract Factory" in the .NET BCL? ...

What are some Common 3D Game Patterns?

What are some of the more common design patterns used when developing 3D games? Are there any high-level architectural design patterns that are commonly used? What about general software patterns within the architecture? ...

What is the alternative to excessive use of the dot operator in Obj-C?

See what you think of this line of code: if ([pickerViewController.picker.bvc.currentResolve.name isEqualToString:message]) ... Would you consider this to be excessive use of the dot operator? If not, I can leave it as-is. But if so, what's the preferred alternative? ...

Is it good idea to use Factory method design pattern for managing different class versions in C#?

The code bellow is the small starting point for a new way ( for me ) of writing and managing code. Before I loose several weeks and probably state at the end that yes it was stupid idea I thought it would be better to "stress test it" here first. So here is the idea. Each time there are dependencies of the type when Client ( Envoker) c...

Entity Attribute Value Database vs. strict Relational Model Ecommerce question

It is safe to say that the EAV/CR database model is bad. That said, Question: What database model, technique, or pattern should be used to deal with "classes" of attributes describing e-commerce products which can be changed at run time? In a good E-commerce database, you will store classes of options (like TV resolution then have ...

Returning data to the user (Good API Design)

So right now I've developed an application that I'm trying to write an API for. The application will ideally return strings back to the user. The API can not "return" the data in the normal programmatically sense because there may be an unknown amount of strings being sent from the application. On Unix systems is it a bad idea to pass th...

Is it wrong to have static and non-static methods in the same class?

Is it wrong to have static and non-static methods in the same class? ...

Policy based design and best practices - C++

struct InkPen { void Write() { this->WriteImplementation(); } void WriteImplementation() { std::cout << "Writing using a inkpen" << std::endl; } }; struct BoldPen { void Write() { std::cout << "Writing using a boldpen" << std::endl; } }; template<class PenType> class Writer : public PenType { public: v...

ASP.net MVC : IS this pattern reasonable or conceptually incorrect?

My controllers turn over the request to the appropriate service. The Service then makes calls to various Repositories. Repositories use Linq to Sql Entities purely for DataAccess and then map and return as Domain Objects. The service then decides what the Controller will present and replaces the DO with Presentation objects which are ret...

Presentation Layer Objects

Should a Presentation Layer be split into presenting and receiving objects Or single objects that handle data in both directions? ...

Emailer in Java using Strategy Pattern

UPDATED: Added one more question (Question #4). Hi all, I'm building myself a custom emailing utility. Now, to obey Single Responsibility Principle, I want to have the following classes: MailerSender, MailProvider and EmailObject. The MailSender is more of a delegate, check it out below: public class MailSender { private IMailPr...

What does design patterns mainly to do with?

Most of people say that design patterns only relate with software engineering. Patterns makes us to focus on reusing of existing modules or freeing us from onerous work caused by changing in the future. Does patterns makes the program run more efficiently? ...

Staying consequent when working with large scale projects.

Hi there folks. Probably a bit off topic question, but it's something I'm really interested in getting to know from other people with different experience and backgrounds. How do you keep track of your huge projects? Do you use subversion? EER-models? Do you write notes? Does all your faith lie in phpdoc? Which framework do you use, and...

Refactoring PHP code that outputs csv with formulas

I have some PHP code that is designed to make a spreadsheet with formulas already in it to sum some columns. It seems there should be a much more elegant way to do this than the code below. What are some refactorings or design patterns that could accomplish something like the code below better? <? echo ",Current Milestone,Total Hours,Mi...

My ASP.NET MVC application is Anemic.

I read Fowlers description of Anemic Domain and I believe I have those symptoms. I have several objects doing nothing but passing data around in different packages. I also have several Services that pretty much handle all the behavior (executive functioning). I am starting to lose track of why and what i did and where to find certain tas...

What design pattern is suggested here?

I have 2 tables, for now as an example, ClientOrder and Products Table. Using Linq, I have been able to write all the queries that I want to run 1. Search by Client order 2. Search by Client name 3. Search by Product name 4. Search by Product ID I want to create methods for each of the above queries. The ? is, what pattern is appropriat...

Mediator pattern or too much responsibility

In my application, I have several components that have to know about each other, such as a menu bar and a tool bar that both need to know about the table to add or remove jobs and also to find out which job is selected. So, I created a object called guiMediator that I pass to every object and they register themselves with it so that the...

What are C++ non-template members as used in the Barton-Nackman trick?

From wikipedia: // A class template to express an equality comparison interface. template<typename T> class equal_comparable { friend bool operator==(T const &a, T const &b) { return a.equal_to(b); } friend bool operator!=(T const &a, T const &b) { return !a.equal_to(b); } }; class value_type // Class value_type wants to have ...