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

learn more… | top users | synonyms (1)

2
votes
2answers
72 views

What is the most efficient way to find a set of locations within a radius of a certain point?

Imagine a dataset of all the restaurants in the US (similar to Yelp, etc), how would you return a set of restaurants within a certain range of a particular zip code. (Assuming you have already a ...
1
vote
2answers
78 views

How can I have objects interacting and communicating with each other without forcing a hierarchy?

I hope these ramblings will make my question clear — I'd totally understand if they wont, though, so let me know if that's the case, and I'll try making myself clearer. Meet BoxPong, a very ...
3
votes
2answers
110 views

Design patterns for implementing optionally supported features

Here's the original problem. There are two classes: Protocol and, say, ProtocolUser (which actully uses the Protocol class instance). Now, I need to support multiple protocols, whose feature sets only ...
0
votes
0answers
72 views

Design pattern for ensuring the “signature” of generic lists is equal

I have an interface, Attribute, that is going to be implemented in various ways, class AttributeA implements Attribute{\\..} class AttributeB implements Attribute{\\..} Then I'm planning to have ...
0
votes
0answers
39 views

Android, access 1 activity from 2 cases, what design pattern is this?

I'm developing an Android app, encounter this case. There are 2 ways we can enter an activity (named activityB): either from activityA or from notification. 1st case: ActivityA -> activityB 2nd ...
28
votes
5answers
941 views

Amateur question about corrupt software [on hold]

I was hoping someone here could help a non-coder with just a few questions to give some realism to a no-budget film. I am currently writing a screenplay in which the main character's analytic ...
1
vote
2answers
97 views

Are the Repository Pattern and Active Record pattern compatible?

Currently I am developing a webapp where I have defined models implementing the Active Record pattern. Each model also is defined by an interface that specifies the Entity properties and makes it easy ...
1
vote
2answers
118 views

Designing Message class in Java

I'm writing a class for Message. Message comes with Header and Payload. Header has following fields: Version Type For Type "XYZ", the following Payloads are allowed. Configuration Metafile ...
3
votes
3answers
97 views

Would implementing a “Throwable Event System” be abusive?

I have been thinking for a couple years now about using Throwable events and implementing a sort of event system that uses throw to dispatch an event, or let a different method handle it with throws. ...
1
vote
2answers
81 views

In javascript, should object properties be declared on top of the function?

I learned that it's good practice to declare variables before they are used. For example: function myFunction() { var i; var j; } Does the same thing go for object properties, and is there a ...
1
vote
1answer
47 views

File validation rules

I have an application that can accept CSV files to run some operations. The files look like: CREATE USER:username,last_name,first_name,age user1,Smith,John,23 user2,Poppins,Mary,257 There are a ...
-1
votes
0answers
35 views

Which patterns to apply for “User Manager” [on hold]

I developing a social application and I neeed to create a User Manager that is responsible for managing certain types of user. A user who enters in to the system will be a new user or an existing ...
8
votes
4answers
409 views

Is Visitor Pattern valid in this scenario?

The goal of my task is to design a small system which can run scheduled recurring tasks. A recurring task is something like "send an email to administrator every hour from 8:00 am to 5:00 pm, Monday ...
1
vote
1answer
113 views

Differences in design/thought process for OO in Java and JavaScript [duplicate]

Despite sharing a similar name and syntax, Java and JavaScript are quite different. However, they both have Object Oriented features. As a JavaScript novice, the main differences that I can see ...
3
votes
1answer
64 views

Encapsulating mutable objects with special structure in Python

I am writing a library for working with special types of trees, called Foo trees. A Foo tree has very special structure. There some operations, called bar and baz, which only make sense on Foo trees. ...
0
votes
0answers
49 views

GIS Design Patterns

I am looking to implement a GIS based application for climatological purposes. I have looked at these two papers as a template for structuring my data objects - ...
-1
votes
2answers
200 views

which one is recommended object-oriented design? [closed]

I made simple object-oriented prgram, and think about design. I wonder which one of belows is recommended object-oriented design. Most left side class is "Main" class. Black arrow means they are "Has ...
0
votes
1answer
57 views

how can the presenter or view interact with the model in the MVP pattern?

I'm learning the MV* patterns. MVP in this case. I'm trying to refactor an old android application into the MVP pattern to make things less tightly coupled, but I'm struggling one one concept. I know ...
3
votes
3answers
156 views

Design suggestions for converters in Java

I'm trying a set of converters which will convert an object to some older form. And there are different objects which are converted. By older form I mean changing the values of some fields and in case ...
1
vote
2answers
46 views

Module based project vs Normal project [closed]

I am writing code on top an established Enterprise application. I see that the application has 4 modules as shown below. -Srk -SrkEJB -SrkUtils -SrkWeb I have gone through the code and I see that ...
2
votes
1answer
43 views

What layer would an Audio Player Service fall under in a an MVP system?

I'm trying to completely overhaul an app I wrote a while back that plays audio, and I'm learning how the MVP pattern of organization works, but I'm not sure how/where an audio playback service would ...
0
votes
1answer
143 views

Memento pattern: saving memento [closed]

There is one problem about this pattern that troubles me. In a situation when we have to save a state into a file, is it class Memento that should be responsible for handling this process? (for ...
2
votes
2answers
251 views

Refactoring long methods with a lot of cyclomatic complexity

I'm attempting to refactor what is becoming a very large method -- currently 350 or so lines -- that contains a high degree of cyclomatic complexity. I understand and ascribe to the theories that ...
0
votes
0answers
53 views

Tornado Framework's Design Pattern [closed]

I'm working on a article about design patterns for web applications that demand high load and performance. I'm basically trying to compare an event-based web aplication to it's correspondent ...
1
vote
1answer
48 views

Generic PHP web interface for handling concurrent updates optimistically

I'm looking in to writing a new PHP based CMS which handles concurrent edits optimistically like source version control rather than pessimistic locking like Wordpress. I want to be able to write some ...
-2
votes
0answers
61 views

OOP vs ADM Comparisom

This is the ADM equivilant to the example code given in Correct placement of Methods in OOP In this example we have resolved the Method placement question by moving ALL methods away from the data, ...
3
votes
1answer
261 views

Correct placement of Methods in OOP

Which Class should contain a method which has dependencies on multiple classes? I've coded up a specific example to avoid generalizations. In this example we have an initial requirement : ...
0
votes
1answer
90 views

AST processing and usefulness of visitor pattern

I know the visitor pattern is typically used to traverse a hierarchy of heterogeneous objects (inheriting a same abstract object) and dissociate the processing of these objects from the data within ...
2
votes
1answer
63 views

MVVM in Photoshop-like application: What object has the responsibility for composing the document?

I'm wondering how an application like Adobe Photoshop, could be architectured to conform to the C+M+V+VM design-pattern, specifically how do you handle the canvas? There would be a Model system which ...
2
votes
1answer
256 views

Should all functions be fully self-contained (is it bad practice to share a variable between functions)?

There are two ways to do the same thing (pseudo code) Define databaseHandle in the parent function, and use it as a global in this scope: function API() { function openDatabase() { ...
1
vote
1answer
44 views

Polymorphism on repository interface for local and remote operations

I'm in the process of designing a facade ApiClient class that would abstract some CRUD operations between a local database and a remote one (through a REST web app). Said ApiClient class depends on 2 ...
2
votes
1answer
88 views

Should I use the State Design pattern for only two states? Also, what if one object's state is affected by another state?

If you only have two states for an object, is it worth it to still use the State Design pattern? The context is a multi-player, turn-based game environment where there are Game "Tables" that a player ...
0
votes
1answer
65 views

Strategy pattern can use this pointer?

I want to use strategy pattern, but I wander if it is correct to use "this pointer" with the strategy pattern interface. This is required in order to get internal information which is required for ...
5
votes
2answers
72 views

Difference between class scope and object scope design patterns

Apparently design patterns have a ton of classifications. One I am struggling with is whether or not the pattern is a class scoped pattern or an object scoped pattern. Of course no documentation ...
4
votes
0answers
165 views

Design patterns for navigation between pages on mobile platforms

I'd like to ask you about the best way of handling navigation between pages/activities on mobile platforms. To be more specific - about handling state in more complex apps, about handling 'Back' ...
1
vote
3answers
121 views

Software pattern for combining properties [closed]

I have two classes that read distinct files. As an examples, two classes, sourceA or Client, and sourceB or Resources: public class Client() { public string ClientName {get; set;} public int ...
1
vote
1answer
79 views

What is a context object in relation to a web application?

I've seen the term "context" used in a few web application frameworks but I'm not sure what it's actually about. It seems pretty important and seems to be related to holding session information, but ...
9
votes
4answers
812 views

Class Duplication Pattern?

I'm currently working as a solo developer on my current project. I inherited the project from another developer, who has since left the company. It's a model-view-controller style web application in ...
-1
votes
2answers
53 views

Appropriate Design Patterns [closed]

I have a list of objects which represent log entries like below. List<LogEntry> Entries; //Log Entries Read By A Log Reader The Log Entry Class contains following properties. public class ...
-2
votes
1answer
36 views

ClickHandler for button = strategy pattern? [closed]

If you provide a implementation of a ClickHandler interface to a button (defining some behaviour), is this the strategy design pattern?
2
votes
1answer
87 views

In MVC, who is in charge of handling observers?

(I'm writing a large MATLAB GUI that makes significant use of MVC, so my example is written in MATLAB. However, I believe this question is language-agnostic. Please correct me if I'm wrong.) I have a ...
1
vote
2answers
140 views

Is MVC controller an use case controller?

In GRASP (http://en.wikipedia.org/wiki/GRASP_(object-oriented_design) ), a controller (use case controller) is defined as: A use case controller should be used to deal with all system events of ...
5
votes
2answers
132 views

Top-down vs Bottom-up approach when designing a class library

I am designing a class library to represent western equal temperament music theory concepts for the purpose of composing notated music with code (I realize there are other libraries and programs for ...
1
vote
1answer
140 views

How much trouble can the use of Singleton class as Model cause?

In my latest WPF applications I've been using a Singleton class, that I call Model, to contain all my application's logic, such as file reading, information handling, etc.. In the WPF Views or ...
1
vote
1answer
46 views

Pattern to add custom attributes to Forms control classes, without having same code everywhere?

I am creating custom winforms designer. I use label, textbox, combobox, listbox, button and checkbox on the designer. I don't want to show all their properties on PropertyGrid, so I created a custom ...
5
votes
1answer
354 views

Where we should not use MVC? [duplicate]

I have a software engineering course project that we should design a web application, so I've decided to read about software architecture patterns. I've read a lot about what is MVC and its ...
2
votes
1answer
57 views

Where to keep persistent services in MVVM architecture?

In an MVVM application I need to use some services that are persistent, e.g. network services like P2P and WCF where the main "engine" or server endpoint must remain up and running during the lifetime ...
2
votes
2answers
73 views

Sharing info objects between objects?

I'm making a game and I have several cards that are created during the game. Each card needs some info, which is shared between cards of the same type. So I have a class CardInfo, which holds a name ...
-1
votes
0answers
21 views

Best way to populate Entity from posted ViewModel in ASPNET MVC?

In form post, I am used to accept a viewmodel in post action method. One way or another, I have to go through each property to assign it to the entity object that the repository module is expecting. ...
11
votes
3answers
383 views

named arguments replaces the builder pattern

When using a language that supports named and optional arguments, does the builder pattern no longer have a practical use? Builder: new Builder(requiredA, ...