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

learn more… | top users | synonyms (1)

0
votes
0answers
9 views

I recently read about unit of work and repository design patterns; working with EF wondering if this is a good design pattern

I found myself creating child records that require a master record to exist, first, so that they can reference it by the master record's primary key (if that's the right term). To accomplish this ...
0
votes
1answer
30 views

Modeling Associations

I am working on the design phase of a paper folding project. I have a few queries in this. Part of the problem statement says " A web can contain one or more ribbons in it. It can also contain a ...
-4
votes
0answers
29 views

Chain of Responsibility Design Pattern [on hold]

I want to get an intuitive feeling for Chain of Responsibility pattern. I guess a good way to get that would be to learn about some real world examples. Can you guys share such examples? One of the ...
7
votes
4answers
885 views

css - use universal '*' selector vs. html or body selector?

Applying styles to the body tag will be applied to the whole page, so body { font-family: Verdana } will be applied to the whole page. This could also be done with * {font-family: Verdana} ...
5
votes
2answers
588 views

Acceptable placement of the composition root using dependency injection and inversion of control containers

I've read in several sources including Mark Seemann's 'Ploeh' blog about how the appropriate placement of the composition root of an IoC container is as close as possible to the entry point of an ...
3
votes
1answer
212 views

Good practice for returns in Python

I was recently working on some prototype code in Python. The code worked great, then I realized that I needed a little more feedback from one of my functions so I changed the return statement from ...
1
vote
1answer
176 views

When to use the whiteboard pattern versus direct calling

I'm creating the architecture for a new embedded project. The system has some inputs that go to wildly different outputs. The whiteboard pattern is very useful for this (see Listeners Considered ...
3
votes
3answers
5k views

Should angularjs directive directly interact with services or is it considered an anti-pattern?

Which one is considered better: having a directive that interacts with services directly or having a directive that exposes certain hooks to which controller may bind behaviour (involving ...
0
votes
2answers
112 views

DTO - service layer - statelessness best practices interfering with each other

I am designing a REST API coupled with a service layer that takes DTOs as input and produces them as output. This works fine for most service calls where the DTO is used to access an underlying ...
0
votes
1answer
78 views

Pattern that prevents events to trigger themselves

I am working at the client-side part of a web application, that is responsible for getting answers from users for specific questions and storing and restoring them from the database (or cookies) and I ...
3
votes
1answer
747 views

does this model-pattern have a name?

A few years back, I wrote this answer to a question from which the following idea emerged. I call these "Type Descriptors", as I have never been able to find this pattern documented or formally ...
1
vote
2answers
223 views

Is this a candidate for Singleton?

I have an external thermometer connected via USB that is controlled by my SW. Different parts of my system will use it but never at the same time (all in one thread). However, it is a single device ...
0
votes
0answers
46 views

High-level Software Architecture Patterns [on hold]

Based on Big Ball of Mud, where the Pipeline pattern is mentioned, I'd like to know what other high-level patterns/architectures are there (besides modular and layered architectures). I'm mainly ...
6
votes
2answers
222 views

Javascript MVC application design (canvas)

I'm having difficulty grasping how to structure/architect a canvas application using an MVC like approach in Javascript. UI will be fairly fluid and animated, the games fairly simplistic but with ...
0
votes
2answers
68 views

API - How to handle scope based functionality?

TLDR; Where and possibly how should I implement scope based logic in the example code? I have got a ASP.NET Web Api. The Api uses OData (on top off REST) for data endpoints and OAuth 2.0 ...
1
vote
1answer
39 views

Queue of jobs in a different states and with different services around

I need to design a 'queue' of jobs (in a a very much UI oriented application) that can be run by a user and I need some other thoughts to pick optimal approach from ground up. My jobs can be in a ...
1
vote
1answer
124 views

How to design extension mechanism for java app

I have an application where I have a set of core features. The application itself HAS to work in core only mode. I would also want to make the application extensible such that, when certain ...
0
votes
2answers
161 views

Optimization ended up in casting an object at each method call

I've been doing some optimization for the following piece of code : public void DrawLine(int x1, int y1, int x2, int y2, int color) { _bitmap.DrawLineBresenham(x1, y1, x2, y2, color); } After ...
0
votes
0answers
73 views

When to use packages or Repositories in Laravel?

I'm a Laravel (PHP) developer, and new with DI, Packages (workbench) and Repositories (Pattern). I want to know about the best concept/methodology for a more flexible design; ie. the project can grow ...
1
vote
0answers
59 views

Pattern for data types that are related yet fundamentally different in utility

Background I'm currently working on a codebase for what is to become a forthcoming website's content "engine", where it will take in different types of standardized data (implemented with XML), parse ...
1
vote
3answers
308 views

Passing data between hundreds of objects in java [on hold]

Currently, I'm working with a group on building a model. This model simulates interactions between many "agents" in a region. Agents can be any entity such as a city, a farmer, a business etc. Each ...
-3
votes
0answers
84 views

C# Implementing filtered Iterator without using yield return [migrated]

I'm trying to display elements of a list with filter and without filter. Here, I use the filter in such a way to display the elements which are divisible by 3. I'm going to use Enumerable and ...
0
votes
1answer
109 views

What is design pattern/paradigm for ASP.NET web-apps? [on hold]

I don't actually know if my question is correct, but working on a webapp porting from ASP.NET world to Java + Spring platform I came up with this question in mind. Using Spring MVC, the new version ...
0
votes
0answers
24 views

Encapsulate multiple properties into a single class to use as a custom DependencyProperty

My application is a WPF project implemented in C# .NET (4.5) using an MVVM architecture with no code-behind in the View. In order to eliminate the coupling between the View and the ViewModel I'm ...
0
votes
1answer
94 views

Observing progress of a distributed system

For a distributed system, there is a requirement of observing the progress of smaller applications on distributed computers (runtime 5 - 20 minutes). There is a web fronted, which right now only ...
0
votes
1answer
119 views

How to design a scriptable communication emulator?

Requirement: We need a tool that simulates a hardware device that communicates via RS232 or TCP/IP to allow us to test our main application which will communicate with the device. Current flow: ...
0
votes
0answers
173 views

What's the best way to expose a Model object in a ViewModel?

In a WPF MVVM application, I exposed my model object into my viewModel by creating an instance of Model class (which cause dependency) into ViewModel. Instead of creating separate VM properties, I ...
1
vote
2answers
99 views

Should an abstract class always abstract its methods to an interface?

I had learned sometime ago that abstract classes should always abstract their functions to an interface. So instead of having something like this - abstract class a{ public int i; public int ...
0
votes
2answers
206 views

Is there a design pattern for dynamically applying transformations or filters to a model?

For example, there is a model of an event with certain attributes that can be adjusted by existing processes: maybe one that looks at a geo-location stamp and determines a nearby city; another that ...
3
votes
0answers
40 views

Mapping multiple differing taxonomies to each other

At work we have a varied number of websites selling second-hand products. The bosses have noticed that there's often some overlap between the products sold on some of the websites and would like to ...
3
votes
4answers
168 views

How to identify and run the most relevant automated tests?

Suppose you have a reasonably large codebase (0.5 - 1 msloc) with a large test-suite (6-7hr single-threaded runtime; with a mix of unit-tests and integration-tests built with different tools). You ...
8
votes
1answer
800 views

Useful design patterns for working with FragmentManager on Android

When working with fragments, I have been using a class composed of static methods that define actions on fragments. For any given project, I might have a class called FragmentActions, which contains ...
2
votes
2answers
178 views

Best patterns for variable-scope disposables

I have Client which uses a disposable Connection for talking to a remote service. A Connection is somewhat expensive to set up and needs to be Dispose()d properly. I want to allow multiple methods ...
2
votes
1answer
48 views

ASP.NET MVC - Dynamic Views with many similar controls

I have a main View which has several sections and a main dropdown at the top which defines how the rest of the view looks like. All these sections have some data that is visible all the time, and some ...
3
votes
1answer
103 views

Best approach for tracking dependent state

Let's pretend I work on a project tracking application. The application is a database backed, server hosted, web application. In this application there are Projects which have many Activities which ...
31
votes
9answers
4k views

Should we avoid using design patterns in constantly changing projects?

A friend of mine is working for a small company on a project every developer would hate: he's pressured to release as quickly as possible, he's the only one who seem to care about technical debt, the ...
1
vote
2answers
299 views

Correct way to inject dependencies in Business logic service?

Currently the structure of my application is as below Web App --> WCF Service (just a facade) --> Business Logic Services --> Repository -> Entity Framework Datacontext Now each of my Business logic ...
0
votes
1answer
124 views

Onion Architecture Structure

I am looking to understand and implement the Onion Architecture and have a vague idea on how to structure everything but need help to clear up some of my confusion. Based on different examples and ...
0
votes
1answer
65 views

Where and how to reference composite MVP components?

I am learning about the MVP (Model-View-Presenter) Passive View flavour of MVC. I intend to expose events from view interfaces rather than using the observer pattern to remove explicit coupling with ...
1
vote
3answers
147 views

Relative encapsulation design

Let's say I am doing a 2D application with the following design: There is the Level object that manages the world, and there are world objects which are entities inside the Level object. A world ...
4
votes
7answers
1k views

What to do with obsolete code? [closed]

Code that we no longer use builds up. So what should one do when one doesn't need it anymore? Deleting it feels wasteful, especially large chunks, and there's always the chance the exact same thing ...
0
votes
1answer
177 views

Interface questions for using Command Pattern and Dependency Injection together

I have many projects that have essentially the same high level requirement: test all hardware on a device. Each device can have a different communication protocol, requires different test equipment to ...
2
votes
2answers
478 views

A small project but I want to use design patterns to do it right

I've got a project coming up, a very a small system, but one that needs to be extended in the future. Here's how I've designed it so far. It's 3-tier: presentation, business and data. For the ...
1
vote
2answers
127 views

Sanity check for design pattern used with an intricate calculation model

I am working on a project that generates technical brochures in batch. The 3rd party API that is being used expects POCOs with property names that match field names used in each of the brochure ...
0
votes
1answer
88 views

What design pattern should I use for import, update, export

I need to create a simple payments validator. On the following class diagram, I tried to present the model of payments. As you can see, each payment type inherits from Payments class. Now I want ...
3
votes
1answer
295 views

Is there a term for this coding practice?

One of the incidental complexities of introducing features to an existing system is that the programmer often has to touch several areas of code that are not immediately adjacent. Over the long haul ...
2
votes
4answers
140 views

Subclass only have methods without variables

Is it ok to have subclass which does not declare its own variables (instance variables) and inherits from super class or base class? It has methods and there are some common methods which it overides ...
0
votes
1answer
83 views

delegating program logic to lower-level objects

I'm writing a library for use in scientific computing and ran into a bit of a quandary. The types at work here are a class M which consists of some data and a reference to a container class C. There ...
0
votes
1answer
75 views

software design for client/server, over sockets, with JDBC [closed]

What's a reasonable architecture and design for a client/server application, over sockets, using JDBC? Right now I have the server query the database and instantiate a Queue of records. Clients may ...
2
votes
1answer
143 views

Builder pattern inside interface. Bad design decision?

I am having trouble evaluating an implementation of the builder pattern I just came up with. The context is an API library, so I am trying not to expose any implementations in order to have a stable ...