design-patterns

Is the provider model using the factory pattern?

Hi, Is the provider model really just the factory pattern? ...

"Brokered definition set" design pattern -- well-known under another name?

In a project that I've been involved with for many years, I've gradually evolved a design pattern that's proven to be extremely useful for me. I sometimes feel I should get a bit evangelical with it, but I'd be a bit embarrassed if I tried and found out that it was just my version of somebody's old hat. I've dug through Design Patterns...

Is copy-and-paste coding ever acceptable?

It's generally accepted that copy and paste programming is a bad idea, but what is the best way to handle a situation where you have two functions or blocks of code that really do need to be different in just a few ways make generalizing them extremely messy? What if the code is substantially the same, except for a few minor variation...

Rules With Most Significant Exceptions

Every programmer is taught a basic set of rules for writing good, maintainable code early in their career. These include not using gotos, avoiding copying and pasting, avoiding globals, etc. However, sometimes rules that are only intended to be guidelines or rules of thumb get applied religiously by the more anal-retentive types, to th...

Design Patterns - Architecture Astronaut

First, feel free to close this if it's not appropriate, as this is my first time on Stack Overflow. Perhaps my question is similar in nature to this one: Do you use design patterns? The programs that I write are small 50-75 K line programs mostly using Windows Forms and ASP.NET. These programs are GUI intensive allowing the design an...

What is the most common design patterns for any windows forms application?

I am asking about that as I am going to develop a client side application using c# to display stock data and make some user-interaction, so give me links for best tutorials you read before ...

Connecting a form to a Javascript Object (and other best practice advice)

Hi guys, I've been using javascript to do lightweight functionality on sites for years - DOM manipulation etc - but just now im beginning to investigate using it to do a lot more of the heavy lifting (in combo with PHP). I've only just started getting into OO JS, and im still trying to get my head around the best-practices and design pa...

Does One Persist XML/CSV/Other Through Repositories/Services/Other

I have an application that imports information from a CSV file or from a database and exports it to XML. This XML is currently being persisted to a file. However due to project needs I have decided it may be better to persist this XML to a database. Currently I have CSV, XML and SQL repositories that deal with importing/exporting data. ...

Patterns and more for clean and easy gui code

Hey, every time i code a gui (in my case with GWT, never touched gui programming before), i notice that my code becomes a big mess, when the applications becomes more complex. It's really frustrating to look over my code and get a headache of all these setters in object constructors and this messy throwing together of these. I am usin...

What the best pratices to place ads in a website?

I want place ads in my website, but I'm unsure about the commom pratices to place thes ads. By example, some cool asp.net articles sites shows ads in the middle of the article! So you read 2-3 paragraphs, read some ad, then finish the article reading... Another worry is about sabotage. One of mine customers get their Google adsense acco...

Is this the decorator pattern?

I'm using the built-in system class for sending emails in .NET. It's in System.Mail namespace or something like that. I need to add an interface to this class so I can swap it out for testing or another implementation. To do this, I just define a class that wraps this built-in class? Is this an example of the decorator pattern? I'm ju...

asp.net observer pattern

I'm working on a project where a central class (the subject), will contain alot of data. There will be an aspx page that displays this data, using .net ajax. When the subject is updated from any page, I want all the open pages to update. I will be using the observer pattern for this. THe question is, do I make the actual aspx page the ob...

Patterns to implement SOLID principles

I'm doing a presentation of Solid design principles and I'm trying to connect the single responsibility principle and the open and closed principle to design patterns. Currently I have, SRP- proxy, fascade OCP- strategy, command Are there any other basic patterns I should include? ...

Why the name "Decorator" for the Decorator design pattern?

Can anybody explain why the name "Decorator" was chosen for the functionality conveyed by the Decorator design pattern? I've always found that name fairly misleading, because decorator and marking interface sound very similar to me in their purpose. However, whereas a marker does not really "do anything", decorators certainly do. But t...

What is MVC, in relation to the Zend framework?

I'm learning the Zend Framework and it uses a MVC model. I still have not got my head around what MVC Model, View, Controller is. What are the three different areas for and what would the program flow look like? ...

Is there a simple way to emulate Objective-C Categories in C#?

I have a weird design situation that I've never encountered before... If I were using Objective-C, I would solve it with categories, but I have to use C# 2.0. First, some background. I have two abstraction layers in this class library. The bottom layer implements a plug-in architecture for components that scan content (sorry, can't be m...

When should I create a new controller class in ASP.NET MVC?

I'm learning MVC and am having trouble deciding when I should create a new controller versus just adding an action and view associated with an existing controller. On the one hand, Single Responsibility would seem to say a controller should be limited to a few actions. When I try this, though, the number of classes grows exponentially ...

How do you use Intefaces with the Factory Pattern in Domain-Driven Design?

Does it make sense to use interfaces for your domain object factories by default, or should interfaces be reserved for the factory classes only when you need them? public IUserFactory { User CreateNewUser(); } public UserFactory : IUserFactory { public User CreateNewUser() { return new User(); } } ...

What is the best definition of MVC?

I have been using Zend Framework in a MVC configuration, read about ruby on rails and plan de check other MVC frameworks in Python(Django?)... i really like the way it isolates some parts of the logic, security and validation. But after just 1 year using it i read an answer here saying almost everyone have wrong definition of MVC and tha...

Is MVC the best way to code asp.net applications?

update: I know there is no one best way to do everything. Sorry for not saying that right off. In the context of the data-access tutorials, if you had to do the project he did in that tutorial, would you do what he did or would use use MVC, if you had to choose one of them? Thanks. update: Is MVC the more approriate way to program a...