Tagged Questions

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

learn more… | top users | synonyms (1)

1
vote
1answer
31 views

Patterns for subclass constructors that vary the parent class constructor slightly

So, my problem is in the context of an MVC-style approach. The code here is PHP, but I'm hoping this is a design issue independent of it. abstract class Controller { private $domain; private ...
4
votes
6answers
667 views

What should an object be called that contains only setters and getters? [on hold]

Suppose there's an object that contains only setters and getters: class Config { public void setName(String name) { this.name = name; } public String getName() { ...
12
votes
8answers
2k views

Name/Fix for Production Code Whose Sole Purpose is to Facilitate Testing?

I recently did a code review on a block of code that looked something like this: public class MyClass { private ISomething mySomething; // ...Other variables omitted for brevity public ...
0
votes
3answers
96 views

Communicating between unrelated components/objects

Imagine that I have a game, with Monsters, Missions, Vehicles, and of course their controllers and such, so a Monster class, Mission Controller class, Vehicle Controller class and so on. Suppose that ...
0
votes
1answer
54 views

Using entityManager/repository Class/session factory directly in controller

I wonder what is your approach on following subject: let's say we have MVC structure with entities, repositories, controllers and service layer. My approach to use above was pretty clear for me: ...
1
vote
0answers
56 views

Need to refactor file downloader and post processing utility [duplicate]

Not sure whether this is the right forum to ask this but here goes. Using this solution - http://stackoverflow.com/questions/26571351/replacing-if-else-logic-with-state-strategy-pattern I was able to ...
7
votes
1answer
150 views

Null Object Pattern and Input validation - copy real implementation or silently accept everything?

I have a WifiComponent in my Camera in my client application. It's responsible for handling the Wifi-related functionality of the Camera. The Camera represents a real world camera. This WifiComponent ...
1
vote
1answer
141 views

Should we use data object (or the data transfer object) for sharing data between these three classes?

I found an article by Martin Fowler that has made me doubt my design choices, particularly about data objects. Martin Fowler has written an article about what he thinks is a code smell. In this ...
0
votes
1answer
47 views

Control (avoid) changing fields with side-effects

I have been thinking about a design problem and possible solutions in my own. I am pretty sure I am not the first one to have noticed it, but I cannot google for it since I do not know the standard ...
0
votes
0answers
49 views

Generalization of phase based systems for card and board games

In an exercise of futility I'm trying to abstract and generalize a framework where to build any turn/rule based system. I've had a head start but after decompiling HearthStone I'm second-guessing that ...
-5
votes
0answers
57 views

MVVM dilemma - keep it simple, stupid VS it breaks MVVM! [closed]

The MVVM pattern taken as a whole can be quite complicated. Sometimes it appears that there is more work involved following the "best practices" than it's worth. How can you tell when to adhere to the ...
0
votes
3answers
61 views

Client vs Creator in Factory Method and Abstract Factory patterns

This page descibes one important difference between Factory Method and Abstract Factory: http://architects.dzone.com/articles/factory-method-vs-abstract The difference, according to this page, is ...
21
votes
4answers
1k views

Why do code-bases in n-tier development have an equal amount of, if not more, JavaScript code now?

I've been doing web programming for a long time now, and somewhere, I lost track of why we are doing what we are doing today (or how did we come to do things this way)? I started out with basic ASP ...
1
vote
1answer
198 views

How do you keep control in a large software project? [duplicate]

I've a large-ish software project that I'm the sole developer for (~80KLOCS and counting - I know there are much larger projects out there, but it's an order of magnitude larger than I've ever had to ...
1
vote
1answer
41 views

Duplicate method in spring services, how to refactor?

ServiceOne.java private void doStuff(){} ServiceTwo.java private void doStuff() Where to put common code ? Shall I create a new service, but then what interface will it implement ? Or shall I ...
-5
votes
1answer
48 views

How best to design a SQL Parser in java, any prevailing design pattern comes to mind? [closed]

What software pattern is most useful for building a SQL Parser? I would like some ideas on how to even get started on something like this.
3
votes
1answer
65 views

Designing a better performing total permissions setup for multiple permission levels

We've got a global system that we are attempting to solve a permissions issue around. Currently, our system serves a number of different applications out to our clients and each client has their own ...
0
votes
0answers
37 views

Choosing a pattern for domain logic on top of ORM model

I am using Python and ORM, particular SQLAlchmey. I have an ORM model which implements data mapper pattern. The model has a field state, which can take one of several states, let's say NEW, CANCELLED, ...
1
vote
0answers
127 views

C# structure needed for dynamic behaviour

I am using Unity to build a visualisation of a serious game. I am using the C# programming language. My problem is that I receive data from a JSON and I parse it and I end up with a list of different ...
1
vote
0answers
96 views

Program Architecture: How to manage objects that are interdependent

Consider the following case, image I making a simple chat program; I want it to be extensible such that it would be fair easy to add add different scripting and user interfaces. I want the core ...
3
votes
2answers
187 views

How and Why should class modifiers enforce or prevent inheritance and the ability to override

This isn't really related to anything I am working on currently, its more of a question I really couldn't find an answer for. Class modifiers like MustInherit or NotOverridable to me, seem like they ...
0
votes
1answer
164 views

Is factory pattern a right pattern for the situation described here?

Is factory pattern a right pattern when we want to consolidate the related objects? Problem - In the Set-top box, I have a user-io, basically the interface to control the settop box - The user-io can ...
2
votes
1answer
123 views

Is the application architecture of Facebook Flux a new idea?

Facebook announced that it's using the architecture they call Flux to develop their projects. It consists of a single direction dataflow, and concepts like a Dispatcher, Stores and Actions (well ...
0
votes
1answer
30 views

Communication between Multiple Presenters in MVP

I'm designing an application using the MVP pattern, but a few of the edge cases for the system rely on communication between multiple presenters. View 1 calls Presenter 1 which does Operation A ...
0
votes
0answers
15 views

Determining proximity of entities based on multiple measures

I have a database table set up like so: Table: entities name - varchar score - int category - varchar value - int value2 - int depth - float ... etc. Example: name ...
0
votes
0answers
96 views

Good design pattern for linq to sql

I currently have a linq to sql project that was used for one project and not much work was put into it, only the generated context and entities were used. Since then the project has started to become ...
0
votes
2answers
174 views

Is performance the only reason not to use SignalR (websockets) entirely in lieu of a traditional REST API?

I have used SignalR to achieve real-time messaging functionality in several of my projects. It seems to work reliably and is very easy to learn to use. The temptation, at least for me, is to abandon ...
-1
votes
1answer
195 views

Is this a well known design pattern? [closed]

We have: class Entity { // ... }; There are many sub-classes of Entity - direct and indirect. Some of the sub-classes of Entity, such as Edge, Face, CoordinateSystem, Part, and Assembly, need ...
0
votes
0answers
19 views

passing different models to view based on razor theme engine

I'm using a pattern similar to the one here to implement a Themed View Engine. Basically instead of having a View folder, I have a Theme folder and inside different themes: default, red, blue, green, ...
0
votes
2answers
199 views

Why use Creational patterns in Java?

How are Creational patterns useful? Most of the material I came across explains the use case to "solve common problems associated with object creation, improve flexibility". I can think of just two ...
0
votes
1answer
42 views

Software to access GSM Terminal, sending and receiving AT commands, validating results

I am currently implementing a software that uses a GSM terminal to perform actions. Actions can be sending messages, checking balance, receiving status report messages, setting the pin, ... The ...
5
votes
3answers
293 views

What is a good design pattern for multi-mode software?

I will explain my question by way of example, but I'd love a general solution. I am writing a JavaScript application that needs to function differently depending on its run-time context. To handle ...
0
votes
1answer
68 views

How to compute data for charting?

I'm building a charting component that displays data directly from the raw data records. It should be able to filter data (subset) and then perform some rudimentry maths on the data (sum, avg, etc). ...
0
votes
0answers
21 views

Should you register other services in ViewModelLocator in MVVM light?

I'm new to MVVM Light and SimpleIoC. My question is, should all the registration of view models and other services be done in the ViewModelLocator class? Or should ViewModelLocator be used only for ...
0
votes
0answers
37 views

How to clean composition root from anything other than object construction?

I'm doing poor man's DI (manual injection) in my application. My (pseudo-) composition root looks something like this: var connectionSettings = new Settings(SqlParameters) var dataLoader = new ...
3
votes
2answers
232 views

How do you apply Single Responsibility principle to a repository

I am trying to apply "SOLID" whenever I can and try to use common sense and avoid a pattern when I see that a pattern is creating more problems than it's trying to solve. I don't want to apply a ...
11
votes
4answers
464 views

Proper Model-View-_____ design

I've been reading up about Model View Controller, Model View Presenter, Model View ViewModel, and so on, and generally, the underlying concept seems pretty simple to understand: keep the pretty ...
0
votes
0answers
25 views

What is the best way to initialize a child's reference to its parent? [duplicate]

I'm developing an object model that has lots of different parent/child classes. Each child object has a reference to its parent object. I can think of (and have tried) several ways to initialize the ...
-4
votes
1answer
89 views

Creating n tier application [closed]

I am new to design patterns. I want to learn constructing 3 tier architecture. I have searched but confused at some points. In this article ...
0
votes
1answer
101 views

IOC Between Presentation and Infrastructure Layer

Question: I would like to set forth dependency mapping from a *.config file from a project that has no reference to the project that contains the concrete class. Scenario: I'll be using terms from ...
0
votes
1answer
120 views

Object in Business layer same as DTO with logic?

Let's say I have a Spring MVC project, in which I'm using DTO to get data from a database and to pass data to the UI. Let's suppose that I have a UserDTO and in my business layer I have to do ...
1
vote
7answers
358 views

What is the simplest way to broadcast data from application to other applications in .Net

I want to send information from one .Net application to multiple other .Net applications. I want the applications to be loosely coupled. The number of applications receiving the information could ...
3
votes
3answers
211 views

Interface to enumerate over files

I'm trying to design a generic interface for enumerating over a list files. Each iteration will open a file, allow the consuming code to access the file to perform some task, and then close the file. ...
1
vote
0answers
80 views

Callback pattern handling exceptions - Best practices in .NET 3.5

I am looking to implement the callback pattern with error handling such that error is caught and pass to the callback code with the response. Since I am using .NET 3.5, I cant use Task (TAP) pattern ...
0
votes
1answer
83 views

How does the consumer-producer solution work?

I'm only a beginner, and my book doesn't cover this subject. I have researched my problem and found that an implementation of the consumer-producer pattern is the ideal solution, and have Googled it, ...
1
vote
1answer
201 views

Should I couple these classes?

I am programming in Python. I have several complicated/hard-to-understand XML files that describe the structure of an election. I am trying to write a python wrapper that makes it easy to access this ...
3
votes
3answers
214 views

Should service layer catch all dao exceptions and wrap them as service exceptions?

I have three layer Spring web app: dao, service and controllers. A controller never calls directly the dao, it does it through the service layer. Right now, most of the time if there is dao exception ...
1
vote
3answers
219 views

Implements > extends, but what about variables?

It's preferable to write programs that depend on interfaces rather than on superclasses, but what when you want a class to have certain variables? Sometimes you want a class to implement a certain ...
0
votes
2answers
129 views

Should I have an object as attribute or primitive id? [duplicate]

I am wondering which principle should I use. Here is my situation. I have a class named TravelOffer. This class looks like this: public class TravelOffer { private final long id; private ...
3
votes
2answers
101 views

At what granularity are events recorded in Event Sourcing?

I'm growing my understanding of event sourcing. My understanding is that it provides a means of recording events as they happen so that given a common beginning state and an audit log of recorded ...