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
92 views

Design Pattern to parse array of objects

What is considered a good practice to parse an array of objects returned by an API? I am creating a RESTfull web service and a client which is meant to work with this service. One of my REST ...
1
vote
1answer
65 views

is a Model exactly the same as a Business Entity?

I've been programming for a long time now, and I have always seen Model classes exactly as a business entity. For instance: sales, users, products, orders, etc... But I have come to certain source ...
2
votes
1answer
75 views

Managing types and conversions in a compiler

I am trying to determine how to manage types and conversions between types within a compiler that I am writing. The compiler is being written in C#. There are a number of different kinds of types. ...
-4
votes
0answers
39 views

Creational design Pattern Analogy [on hold]

Creational Patterns 1) Factory method 2) Abstract Factory 3) Builder 4) Prototype Can someone suggest a place to Find practical Analogies ?
-2
votes
0answers
35 views

Design pattern for Login Online and offline [on hold]

I am new to Software Design patterns, I am developing an application in which user may liggedin offline or online depending on internet connectivity... so which design pattern will be best solution ...
6
votes
2answers
250 views

How much logic can be put into a command? Or differently: What kind of logic is command pattern for?

I have been using the command pattern for quite some time but I'm never really sure how much logic I can actually put in the Execute method. My current implementation of the command pattern looks ...
0
votes
2answers
181 views

Model-View-Controller: who creates whom?

In "Pattern Oriented Software Architecture - Vol 1" (p. 131), the author said that View is responsible for creating Controller. But in "Head First Design Patterns" (p. 562) it is the Controller that ...
0
votes
2answers
59 views

Architecture for process that can be invoked to return errors as well as silently

I'm looking for some high level design/architectural input for the following. I have "some business process" I am writing in code (the importing of data from various CSVs into a database. There is ...
2
votes
1answer
113 views

Inject it or create a new instance

suppose i have an interface in some language with two simple methods interface IConverter{ String toString(Object o) Object fromString(String s) } this interface is implemented by many ...
-1
votes
1answer
91 views

Architecture for Complex Financial Application [closed]

I want to know/understand what is the best architecture for designing/developing a complex financial application in Dot Net. This Application has features like : 1. Metric calculation (Formula ...
6
votes
1answer
133 views

Is the use of DSLs in a state monad a good approach to building complex stateful computations?

First, sorry if that title makes no sense. I am a little out of my depth here with the terminology. So, imagine that I'm writing a text editor in Haskell. For the purposes of this question, let's ...
0
votes
2answers
67 views

Design pattern for canceling a long task in a sub-thread

Suppose we have a file copy program. It has two threads, a UI thread displaying the progress of the copy operation and a work thread copying the file. The UI has a button for canceling the process. ...
1
vote
1answer
199 views

Is DDD any good nowadays? [closed]

This is not a rant about DDD but rather some experiences and observations I've made through the past 2 years since I first learned about it. With this post, I'd like to hear what other programmers ...
0
votes
1answer
123 views

How does the Properties Pattern work?

I'm referring to the pattern (aka Universal Design Pattern) as discussed in this blog post Universal Design pattern I guess I'm not entirely clear how to use this in practice. And how it works to ...
2
votes
2answers
112 views

Should I use a large if statement inside a view or create a different view entirely?

I'm using the MVC architecture Laravel 4.2 to create a relatively complex web application. This application consists of a website which is very heavily based on whether an event has occurred or will ...
1
vote
0answers
68 views

Concurrent directory-tree search

I am trying to get familiar with concurrent programming, and have picked up an excercise to use a fixed number of threads that search through a directory structure. This is pretty much the way it is ...
-1
votes
1answer
39 views

Know any good resources/information on architecting an iOS app? [closed]

I spent a few months working on an iOS app of mine (in Swift) before realizing it was really a bunch of MVCs (Massive View Controllers). I want to start fresh and build something modular, scalable, ...
0
votes
1answer
104 views

Implementing a NoSQL and RDBMS compatible DAO

What would be the correct way to design a DAO which implementation is first going to be targeting a MS SQL database with a STAR model, but yet, business requirements specify the application must be ...
0
votes
1answer
60 views

How can I decouple query and context in a “query object” scenario?

I'm using a query object pattern (similar to this) to manage disparate queries while avoiding bloaded facades/repositories. A query object takes a number of constructor parameters, representing query ...
13
votes
7answers
2k views

Is there a pattern for a more “natural” way of adding items to collections? [on hold]

I think the most common way of adding something to a collection is to use some kind of Add method that a collection provides: class Item {} var items = new List<Item>(); items.Add(new ...
1
vote
4answers
160 views

Options for constructing an object that is not logically initialized until all fields are set

I am working on a Pokemon game at the moment, and am running into some design concerns. The easiest example is as follows: Each Species of Pokemon has several traits that are required before it is ...
0
votes
1answer
117 views

Global state of games(or other). Example : Waiting,Betting,Battling in gambling game

So I'm making a IRC betting bot. Basically the game/bot has three states of taking-in chat. State 1 : Betting If anyone says "!bet team money" parse it and record. State 2 : Battling Take nothing ...
1
vote
4answers
146 views

What is the efficient way to eliminate duplication? Design patterns?

I have a helper class which has a method that perform some checks against a field in a model. I have two models, ModelA and ModelB, they have some similarities but not all. One of them is they both ...
2
votes
1answer
226 views

How to solve this problem of duplicate code with a design pattern [duplicate]

This is what I am doing, Creating a new Pdf document using Aspose Pdf Adding few different types pages you know introduction page, table of content pages etc... Adding some further documents to it ...
1
vote
1answer
59 views

Application components dependency and decoupling

In my client application I have two major components: Core: wrapper that handles everything about running the actual application NetworkClient: A layer that takes care of communicating ...
0
votes
1answer
93 views

Changing an object's (apparent) class at runtime

I'm looking for a design pattern to solve the following problem: An object (let's say representing a document) can change its type dynamically during its lifetime (e.g. when it is saved with a ...
0
votes
1answer
79 views

Job and workers, pattern / design

I have x number of worker classes which all implement a specific interface, i have a job descriptions Each job description States the different worker classes that should execute to complete the job ...
0
votes
1answer
121 views

What is the correct way to bind few classes with similar functionality?

I want to do this in the right way to learn I have a few classes which have only one method. For example: public class RedColorText { public void AddRedColorText(string text) { ...
-1
votes
3answers
289 views

Which Design Pattern Is Best Suited?

I have been studying Design Patterns and I am looking to implement them into my latest project. I am working on a Windows Service that regularly checks a database table for a new entry. Depending on ...
4
votes
4answers
228 views

Dependency Inversion & Decoupling

I'm wondering if someone might explain the last paragraph written in this example on Dependency Inversion & Decoupling. http://www.springbyexample.org/examples/core-concepts.html Following the ...
1
vote
1answer
79 views

Lookup pattern as a way of passing global references

I am looking at some legacy code in java that uses the Service Locator pattern as a way of passing global references as opposed to passing them over and over again through method arguments and I am ...
1
vote
2answers
86 views

Decorator design pattern in swift

Im reading "Head first design patterns" (here you can find exact example mentioned in book) While going through Decorator design pattern, everything was crisp and clear until i stumbled into this ...
0
votes
1answer
136 views

How would a modern website like Reddit divide up its website into Django apps? [closed]

Django uses apps to divide projects into manageable and reusable chunks. All examples in tutorials use polls or articles in unrelatable circumstances. In a modern example like Reddit (or even Amazon ...
4
votes
1answer
167 views

Designing interfaces to hardware

I am writing a library in C++ that is used by customers to interface with hardware. There are many different devices that I need to support. For the sake of simplicity, assume I have 2 Widgets, ...
0
votes
0answers
58 views

Service layer - fat service classes?

Let's say that I have a service for Job Offer entity in CRM app. Job offer is related to many many things, so there will be lot of methods on service layer to interact with above. What should be ...
1
vote
1answer
100 views

Repository pattern without entity framework?

Is it possible to implement the Repository pattern without using entity framework? I am working on a small dev team of 3 on a small scale (for now) ASP.NET MVC solution. I told my manager that I ...
3
votes
1answer
75 views

Software Design: Generating Documents Of Different Formats and Different Layouts

I am currently prototyping a piece software which must be able to generate different types of documents in different file formats. The document could be a letter, or a receipt, for example, requested ...
1
vote
0answers
36 views

Combining Patterns: Fluent Builder and Null Object Pattern

I am currently wrestling around with some GUI code where I have a table whose rows correspond to some object, let's say a Person object. When the table initializes, it fills the table with the Person ...
0
votes
1answer
185 views

DRYest approach to “rendering” drag-and-drop template editor results to HTML

I'm in the process of designing a browser based system that will allow non-technical users to quickly and easily change the content of certain parts of a web page via a WYSIWYG template-based ...
1
vote
1answer
109 views

Does key-value observing between model and view violate MVC?

In MVC the Controller is the go-between for the View and the Model. So the Controller should be the one that observes or receives changes from the Model and View and updates the other accordingly. I ...
3
votes
1answer
101 views

Unit testing a template class after refactoring

I am cleaning up my code by way of removing duplicates, and found two classes that were almost identical, out of 55 lines, only a single predicate in an if statement differed between them. Both ...
0
votes
1answer
61 views

Possible to refactor these methods that contain the same logical flow?

I have many methods in many repositories that have the same logical flow: Retrieve value from Cache Check value If no value, fetch from Database Update Cache Return value Is there a way to ...
-1
votes
0answers
7 views

Where discuss Software Design Patterns? [migrated]

StackExchange is for question with a clear answer. But I want to discuss Software Design Pattern. I could not find a matching discussion group. Where can I find a group/forum/mailinglist to discuss ...
0
votes
1answer
73 views

Should I use foreign keys in my database if I use laravel?

I'm creating a website with Laravel for the first time. I checked relationships documentation today and it seems that Laravel just uses simple SQL queries. class User extends Eloquent { public ...
1
vote
0answers
75 views

Ways to do callback, when and where

I've recently started to do some more complicated programming with network-related work on iOS with Swift. This introduced a lot of asynchronous code not only in networking but also some exchange of ...
0
votes
0answers
43 views

Mailbox Pattern with Variable Arguments in C++

In a game I'm developing, the GUI thread is catching user actions, and the simulation thread is responsible of handling and responding to them. To minimize complexity and delay, I predefined all ...
0
votes
2answers
119 views

Flexible and easy to use settings class

I am thinking about a way to create a flexible "settings class" in C#. The question is: How to provide a confortable way to provide default values to the settings. I want the programmer to access the ...
0
votes
3answers
111 views

where should put showSchedule method in school system

In my school management system I have this partial class diagram: 1- In one use case student want to see his schedule of classes in week. this is what i suppose to do: get student object from ...
6
votes
3answers
278 views

Design solution for communicating between multiple layers

We are developing a framework that has several layers and would be deployed in a multi-threaded environment. Each layer may have its own input/output data type. The top layer takes the input, performs ...
2
votes
3answers
87 views

Design a Queuing Solution with Clustering and Multiple Consumers

It is a Design Problem which I am listing out here. I have different set of business operations that are carried out for different business entities. Operations: Operation A Operation B Operation ...