A design pattern is a general reusable solution to a commonly occurring problem in software design.

learn more… | top users | synonyms (1)

2
votes
1answer
197 views

what is the correct/best way to populate a secondary property of an MVC Model and how do I unit test it?

I'm building an web application is ASP.NET MVC 3 (.NET 4) and trying to unit test as much as possible. I have a controller action Details(int customerId) which should display a view who's model is a ...
5
votes
6answers
641 views

Is this considered repeating code?

C#/ASP.net: /// <summary> /// Is a group in the basket already? /// </summary> public static bool isItemInBasket(List<BasketItem> BasketItems, int GroupID) { return ...
17
votes
5answers
4k views

When would polling for events be better than using observer pattern?

Are there scenarios where polling for events would be better than using the observer pattern? I have a fear of using polling and would only start using it if someone gave me a good scenario. All I can ...
3
votes
3answers
846 views

New Silverlight app. MVVM. RIA Services vs CSLA

Another 2 days of reading and watching demos and here we go. For my enterprise LoB Silverlight app I'm going to use: Prism for UI aspects and modularity. MVVM pattern (using Prism) ??? to bring ...
3
votes
1answer
187 views

How to prevent hardcoding addresses in a web project?

In a fairly complicated web application, there are almost hundreds of redirecting to another page, or linking to another page, etc. Imagine that you have a page called ...
3
votes
2answers
377 views

Implementing Lazy Registration

I'm interested in setting up Lazy Registration on my website. Ideally, I'd like people to be able to fill out a record that might include their name, email, address, etc. and then record it to a user ...
11
votes
8answers
601 views

What is a good code practice of when to make a function/method for small repetitive code segments?

Many times throughout writing larger programs I have questioned after how many copy and pastes does it make sense to put the code into a function or method and what is a good rule of thumb? I have ...
4
votes
6answers
1k views

How can I improve upon this “pattern”?

I have a series of method calls that all share similar qualities. The basic layout is public void CallDataBase() { Utility sqlHelper = new Utility(); StringBuilder query = new ...
2
votes
1answer
694 views

How to apply design patterns in this scenario

I want to use design patterns for the following scenario. How to? I have classes named Person, Employee and Customer and all of them have their own save, update, get and delete methods. Employee and ...
1
vote
1answer
3k views

Silverlight 5 and MVVM. Do I really need other frameworks? What is the best way for rapid development?

I've been reading and watching videos on MVVM and Silverlight.. I'm pretty new to Silverlight but not new to .NET. Interesting that I used MVVM in my WPF apps without knowing that it's MVVM. I was ...
1
vote
1answer
270 views

Is there a design pattern for managing dependencies?

I'm building a component that manages available resources (JavaScript and CSS files) for a web page. As controls are added to the page, they register and un-register their requirements with this ...
7
votes
2answers
538 views

How can I “get in the know”?

My company posted a job listing to get me a helper. A recruiter called me today and all he kept saying was "MVC this Entity Framework that..." - He sounded shocked when I said the project uses ...
6
votes
2answers
455 views

Patterns to avoid long switch block in UI?

Sometimes you have many entities which have common parts, but also should be addressed uniquely in UI. For example, in a CMS, you have many content types (like news, images, articles, pages, etc.) ...
1
vote
2answers
841 views

Whats the best book to master OO language, say C#? [closed]

I have quite some experience in software development. In the initial stages I worked on a really large project, with dozens of projects involved in it, hundreds of large files each with 10s of ...
0
votes
2answers
241 views

Name for this pattern?

I'm writing a class that will handle thread synchronisation. It would have a begin method which would increment a counter and an end method that would de-increment a counter. It'll have another ...
4
votes
6answers
9k views

Can a fresher from a college write design patterns under “area of interests ” in resume?

I have keen interest in design patterns. I have been reading a lot about them. Specially, from HEAD FIRST. Can I write about design patterns in my resume? I am a fresher. Going to sit in on-campus ...
17
votes
8answers
3k views

Is writing your own Data Access / Data Mapping Layer a “good” idea?

We're currently in a situation where we have a choice between using an out-of-the-box object-relational mapper or rolling our own We have a legacy application (ASP.NET + SQL Server) where the ...
2
votes
3answers
682 views

GUI: Setting options in two different places and having them stay in sync?

Programming in Windows with Visual Studio 2010 C++ and MFC. My question is about how best to store, update, and pass around program settings or options. I have a simple main GUI window/frame/dialog. ...
21
votes
10answers
5k views

To design pattern, or not to design pattern [duplicate]

Design patterns are good, but complex. Should we use them in small projects? Implementing design patterns needs more sophisticated developers, which in turn raises project costs. On the other hand, ...
8
votes
12answers
941 views

Were you able to implement design patterns in tight deadlines?

I am wondering, in tight deadlines, who has time to implement design patterns? It is a lot more work and programming overhead to get it right the first time and within time frame. I know that it has ...
4
votes
2answers
900 views

How do you decide to Queue/Dispatch events Sync or Async? (in Observer Pattern)

Consider the following elements in an event-driven architecture: Observable Object Event Dispatcher Observer(Listener) Now, we have two messages: From Observable Object to Event Dispatcher From ...
2
votes
3answers
3k views

Has anyone used “Design Pattern Framework (TM)”? [closed]

Has anyone purchased Design Pattern FrameworkTM? Are these samples worth investment? Are they practical? What are the pro and cons of the guidelines? Anyone used this in the real-world development?
0
votes
1answer
154 views

Proxying the multitons

I have an app which acts like a TCP server and accepts multiple connections. Each connection is made by a distinct device, with a unique ID (the ID is reported by the device in two different messages ...
1
vote
3answers
1k views

Is there a canonical book for CMS design patterns and concepts? [closed]

I've been trying to understand the fundamentals of content management systems: I've looked into APress's Pro ASP.NET 4 CMS, but it dives into implementation, dedicating a lot of time to technologies ...
3
votes
2answers
348 views

Application design question regarding saving files

I am working on an application in C# and I am having some extreme difficulty solving this design issue. Basically the application allows users to create cook books. A user can click "new book" and ...
1
vote
1answer
346 views

Design Pattern For UI Control and Provider to Call Control's Events [closed]

I have a UI control that uses a provider class to implement the actual logic of a complex task. So the control delegates to the provider to do some work. But the provider needs to work with the ...
2
votes
1answer
244 views

How should I structure our common modules to maximize reuse and reduce duplication? [duplicate]

Currently I'm working at a .NET project-based company. Our coding is not modularized, mostly we are copy/pasting old code that is needed on a new project and modify it. I was trying to standardize ...
3
votes
10answers
688 views

Does it make sense to ask, “What is the difference between Design Pattern and Algorithm?”

From Wikipedia: In mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. In software ...
1
vote
4answers
175 views

Independent Developer Pre-Coding Planning/Design/Architecture

For the independent developers, or the weeknight/weekend developers, when you are about to begin a large/enterprise project, what are you first steps to take when hashing out the pre-coding details ...
4
votes
4answers
1k views

Can the strategy pattern be overused?

Example: A file, representing a serialized version of an object, needs to be read and deserialized. It would simple to implement this if we only cared about a single serialization format, but many ...
0
votes
1answer
278 views

Designing classes containing the same objects but different amount of them

I am creating a main object, MACHINE, which will contain a diversity of several other objects -- AXIS, AMPLIFIER, ENDEFFECTOR, etc. The number of contained objects will vary depending on the MACHINE ...
0
votes
5answers
162 views

Help me in choosing appropriate pattern

From last one week i was searching for most suitable architecture for a new web application. To be honest i did web development for only 1 year (back in 2007). And from last four years i am working in ...
2
votes
2answers
705 views

Design question: Is this good case for proxy pattern, or “over done”?

Working on a major enhancement for legacy code, I have been wrestling with myself over whether this is a good case to use the Proxy pattern, and more specifically whether a good case to use the Java ...
7
votes
4answers
470 views

OOP design question

I'm working on an application written in PHP using OOP principles. The classes in my application usually represent a table in the database; for instance, 'student', 'teacher', 'class', 'schedule', ...
0
votes
3answers
1k views

Design pattern for a multi-threaded URL fetcher in java

I'm looking for hints and suggestions on a design for a multi-threaded URL fetcher in java. Specific requirements are: To fetch each one of around 1,000 URLs periodically The interval between each ...
11
votes
4answers
2k views

Create a behavior/Component based system for games

Background I do game development as a hobby, and am looking for a better way to design them. Currently, I am using a standard OOP approach (I have been doing enterprise development for 8 years so it ...
8
votes
3answers
1k views

How do you approach class design in OOPs?

When I try to design an OO solution ,I generally use the CRC modelling wherein I list the class names (nouns), what they do(verbs) and how they collaborate with other classes. This blog has the below ...
37
votes
6answers
10k views

Where are all the functional programming design patterns?

OO programming literature is full of design patterns. Most books on object oriented programming dedicate a chapter or two to design patterns like factories and decorators. So what are the equivalent ...
1
vote
6answers
523 views

What do you call this pattern/technique?

Lately I've used this technique a few times, and I'm trying to figure out if it has a name, if it's one of the patterns, etc. In complicated situations where I might normally have a number of giant ...
11
votes
3answers
4k views

Abstract Base Class with Interfaces as Behaviors?

I need to design a class hierarchy for my C# project. Basically, class' functionalities are similar to WinForms classes so let's take WinForms toolkit as an example. (However, I can't use WinForms or ...
4
votes
3answers
373 views

How do you know if you've split your domain correctly

In DDD i struggle to understand whether or not my domain is split correctly into aggregate roots and then those aggregate roots are grouped correctly into bounded contexts. is there a way - like a set ...
1
vote
2answers
602 views

What is the proper name for this design pattern in Python? [closed]

In Python, is the proper name for the PersonXXX class below PersonProxy, PersonInterface, etc? import rest class PersonXXX(object): def __init__(self,db_url): self.resource = ...
1
vote
1answer
285 views

Designing controller for modular Java architecture

We are designing a system which mimics a BPEL application with sets of functional requirements such as bulk messaging, managing SLAs, error handling and so on. One of the intentions is to modularize ...
12
votes
4answers
1k views

Is it a “pattern smell” to put getters like “FullName” or “FormattedPhoneNumber” in your model?

I'm working on an ASP.NET MVC app, and I've been getting into the habit of putting what seem like helpful and convenient getters into my model/entity classes. For example: public class Member { ...
5
votes
3answers
1k views

Design Anti-Patterns - C# - Do you call this a God object?

I am writing Portfolio module for my web site and it has 3 components. Gallery Category, Gallery, & Gallery Images. I am doing all the request handling, (creating, reading, updating, other), for ...
0
votes
3answers
166 views

What is the best practice for verify if a client has already dowloaded information from server? [closed]

I need to verify what data wasn't downloaded yet. For example, how does Twitter or Facebook verify if a specific client has already dowloaded a piece of information? When a mobile app like twitter ...
32
votes
9answers
1k views

How do I overcome paralysis by analysis when coding?

When I start a new project, I often times immediately start thinking about the details of implementation. "Where am I gonna put the DataBaseHandler? How should I use it? Should classes that want to ...
10
votes
9answers
1k views

Design Patterns: Should I learn them?

So it's kinda weird asking two questions back-to-back, but they aren't very related and I didn't want to combine them, but I'm not spamming questions, I promise! Anyway, I'm a recent college grad, ...
13
votes
2answers
2k views

Does the Decorator Pattern exist in the Java IO classes?

For an assignment, I have to find out which of the Gang of Four design pattern the classes java.io.Reader and its subclasses java.io.PushbackReader, java.io.BufferedReader and java.io.FilterReader ...
11
votes
3answers
4k views

Improvements to Joshua Bloch's Builder Design Pattern?

Back in 2007, I read an article about Joshua Blochs take on the "builder pattern" and how it could be modified to improve the overuse of constructors and setters, especially when an object has a large ...