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

learn more… | top users | synonyms (1)

1
vote
0answers
157 views

Which are the best ways to organize view hierarchies in GUI interfaces?

I'm currently trying to figure out the best techniques for organizing GUI view hierarchies, that is dividing a window into several panels which are in turn divided into other components. I've given a ...
6
votes
4answers
512 views

Rails: Law of Demeter Confusion

I am reading a book called Rails AntiPatterns and they talk about using delegation to to avoid breaking the Law of Demeter. Here is their prime example: They believe that calling something like this ...
2
votes
5answers
486 views

Web programming, standard way to deal with a response that takes time to complete

With normal form submission I use the pattern Post / Redirect / Get, when processing the forms. I have a database application built with Django. I want to allow the users to select a number of items ...
0
votes
1answer
83 views

How are the forwarding of requests normally managed in the Chain of Responsibilty pattern? [closed]

I was just experimenting with the Chain of responsibility pattern, implementing my own version. I'm currently reading Design Patterns, but I'm not really sure whether DP tells to stop your ...
10
votes
4answers
872 views

When to use repository pattern

I have read recently that it is not good practice to use the repository pattern in conjunction with an ORM. From my understanding this is because the abstraction they provide over the SQL database is ...
1
vote
1answer
345 views

Should Uncle Bob's example be refactored to an AbstractFactory or a SimpleFactory?

In the book "Clean Code" Robert Martin makes a statement regarding the following code: public Money calculatePay(Employee e) throws InvalidEmployeeType { switch (e.type) { case COMMISSIONED: ...
7
votes
3answers
4k views

What the best way to wire up Entity Framework database context (model) to ViewModel in MVVM WPF?

As in the question above: What the best way to wire up Entity Framework database model (context) to viewModel in MVVM (WPF)? I am learning MVVM pattern in WPF, alot of examples shows how to implement ...
3
votes
7answers
619 views

Is it a bad idea to create a class which will only have one instance?

Is it bad coding practice/design to make a class which will only be instantiated once? I have some variables and functions that can be grouped together under a class to "look good" (for a lack of a ...
7
votes
2answers
3k views

.NET MVC project architecture / layering

When planning the architecture for a mid-large scale MVC web application how do you implement the layers to be as decoupled as possible and easy to test? (basically follow best practices) Let's say ...
0
votes
1answer
132 views

Properly structure an existing project into the MVC architecture

I'm taking a legacy classic asp project up to more modern technology (I've been working with ASP.NET MVC lately so using this concept is stuck in my mind), but I'm trying to think of how to structure ...
8
votes
3answers
764 views

What's is the point of PImpl pattern while we can use interface for same purpose in C++?

I see a lot of source code which using PIMPL idiom in C++. I assume Its purposes are hidden the private data/type/implementation, so it can resolve dependence, and then reduce compile time and header ...
-1
votes
2answers
221 views

Generics vs IoC [closed]

One of the "Service Locator" pattern drawbacks is that a caller can be misleaded about dependencies of a callee. Ok, but what if I put dependencies as generic parameters at a class level: class ...
1
vote
2answers
285 views

Client-server application design issue

I have a collection of clients on server's side. And there are some objects that need to work with that collection - adding and removing clients, sending message to them, updating connection settings ...
2
votes
1answer
291 views

Design Issue: Service layer/ trying to maintain RESTful architecture

I'm trying to design a web-application - and after doing a lot of reading on REST + design patterns, I'm at a loss on how to handle my requirements. I think I may be getting caught-up in all the ...
1
vote
0answers
138 views

How should Object Model wrapper classes behave when underlying objects are deleted?

I'm currently building an object model library for use in a project. It wraps our internal concepts - Servers, Folders, Items - in an object hierarchy (IFolder, IItem, etc), and we have several ...
0
votes
1answer
117 views

Datastructure for a factory pattern in practice

I'm implementing what's basically an event log system for a larger system. I used Single-table inheritance to build out the table. The problem I'm having is figuring out how to build out the classes ...
1
vote
1answer
93 views

Discovering functionality from parallel class hierarchy

I have an abstract syntax tree which I want to compile down to different representations. I am now struggling to arrange the classes in a way that new representations can be added easily. The easiest ...
3
votes
2answers
486 views

Validation and data persistence in a domain model

My (first and current) workplace (a .NET shop) suffers from an over-abundance of anemic domain models, to the extent that I don't really know how validation and data persistence should be handled in a ...
2
votes
3answers
167 views

Is it good practice to not filter values according to nullability?

Sometimes when I create an API that should enable getting a single value or all values I use the following pattern (passing NULL to the API, means get all rows): @Usernames - comma separeted list of ...
1
vote
1answer
188 views

Task Consumer/Processor architecture

PROBLEM We have various tasks in our system which can take up to 20 minutes. These tasks are generally started from the web interface and run on a new thread. This is obviously a terrible solution ...
1
vote
2answers
287 views

Loadbalancing and failover in code

I have HTTPS based webservices (not REST, rather old code). I am generating Java client stubs using Axis & using that to call the webservices. There are around 20 different APIs on the webservice. ...
2
votes
1answer
237 views

Best practices for refactoring parameter file structure in multiple environments

Background info and what I've tried Within each of two mostly distinct environments, say 'Research' and 'Production', there is a need for a structured parameter file. The file contains things like ...
16
votes
8answers
1k views

Is Dependency Injection worth it outside of UnitTesting

Given a constructor that will never, ever, have to use any different implementations of several objects that it initializes, is it still practical to use DI? After all, we might still want to unit ...
1
vote
2answers
184 views

Pattern / methodology for representing large database records as objects

A bit of background information: We have an old database application written in Access that lets users monitor their workload, and the code is... 'procedural' might be too kind. The vast majority of ...
2
votes
1answer
261 views

Optimized Special Character Escaper vs Matcher/Pattern

I need to escape special characters which are sent to apache lucent. Since the code will run on a production server I want the code to be the fastest possible. I've seen multiple ways to do it: ...
1
vote
2answers
329 views

A better alternative to incompatible implementations for the same interface?

I am working on a piece of code which performs a set task in several parallel environments where the behaviour of the different components in the task are similar but quite different. This means that ...
3
votes
1answer
170 views

Naming a sending/receiving module. Does the pattern have a name? [closed]

I'm working on a simple piece of functionality (actually a ruby gem, but that is beside the point) which can be used to receive and persist incoming messages send and persist outgoing messages ...
0
votes
0answers
77 views

Recaching calculations

I'm working on a webapp which has an existing framework to cache values from the database. I have a requirement which needs multiple values from the database and the values have to be ...
0
votes
1answer
269 views

Design pattern for locking asynchronous operations in Objective-C

I'm writing my first Objective-C Class. It's responsible for interaction with an HTTP SSO authentication service. The process requires multiple HTTP transactions in order to complete. The Class acts ...
1
vote
1answer
2k views

Is the Entity Component System architecture object oriented by definition?

Is the Entity Component System architecture object oriented, by definition? It seems more procedural or functional to me. My opinion is that it doesn't prevent you from implementing it in an OO ...
-2
votes
1answer
284 views

DDD/SOA Using .NET Message pattern(s) / Request Response with File Saving [closed]

I've done some research on this but I can't find more specific examples to help me with this. I'm new to SOA/Patterns in general please take it easy... :) Can you display an example of using the ...
1
vote
1answer
112 views

how to model a connection to a resource, with rudimentary event processing

For my simple MUD client I'm using Apache Telnet (no, not ssh). A mud client is a strange beast: Generally, a MUD client is a very basic telnet client that lacks VT100 terminal emulation and the ...
16
votes
4answers
2k views

Is it ever a good idea to use the design pattern name in the implementing classes?

Recently I came across a moderately large python codebase with lots of MyClassAbstractFactory, MyClassManager, MyClassProxy, MyClassAdapter etc. classes. While on the one hand those names pointed me ...
0
votes
2answers
352 views

Refactorable God v.s. too many classe [duplicate]

So I have this problem: in order to structure my code hierarchically, for every new tiny thing, I create a separate sub-folder, file, class ... and in it one 10-line function. It is an anti-pattern. ...
4
votes
1answer
438 views

Factory method vs Factory design pattern

I know about Simple Factory Idiom, Factory Method and Abstract Factory Design patterns. But I have two situations that I'm not sure how to call (PHP code example) : class User { public static ...
4
votes
1answer
540 views

Design patterns for multi-threaded messaging server

I'm designing an instant messaging server as a personal exercise to improve my understanding and application of multi-threading and design patterns in Java. I'm still designing, there's no code yet. ...
0
votes
3answers
315 views

How do I create a simple yet complex business layer?

I'm working with a fairly complex web application. It's split up into the following layers: Presentation - HTML Service layer - A REST and SOAP API communicating with the business layer Business ...
0
votes
0answers
63 views

What are the pros and cons of running multiple instances of an app per marketplace?

One app to rule them all, and in the darkness, bind them. I'm speccing out a client app at the moment. The same service is to be delivered to two separate counties and the the content within: users, ...
0
votes
1answer
47 views

raw aql query in framework with Active Record pattern based ORM

I use yii framework that implements Active Record pattern as ORM base. It has CActiveRecord class that is a table wrapper class with attributes reflecting table columns. So each object of this class ...
3
votes
1answer
207 views

Mutual observer pattern in Java

I want to improve my multi-threading and design pattern skills. As such I'm designing an Instant Messaging server. I'm writing the Server first. My plan so far is to have Client "Proxy" Classes to ...
4
votes
2answers
695 views

How does MVC work with the principle “Tell, Don't ask”?

Procedural code gets information then makes decisions. Object-oriented code tells objects to do things. — Alec Sharp So, when a view wants to display some information that is suppose to be ...
2
votes
1answer
132 views

State pattern long state class names

I am using state pattern on 28 states in my application. The states are for membership cards that has 7 major states, there are 4 boolean attributes for the membership card that actually affects the ...
1
vote
1answer
290 views

a lot of small objects - OO pasta [closed]

In the code I am working on, there are a lot of really small objects like: class HasFieldLameSetter { public: HasFieldLameSetter(field& p_):m(_p){} void set(bool p2) ...
3
votes
1answer
289 views

What is the pattern called when getters take responsibility for the setting?

I've been heavily using a pattern for years now, but I don't know what it's called. It looks like this.... class xzy { public function getFoo() { if ( undefined(this.foo) ) { ...
3
votes
4answers
446 views

How to elegantly work with a lot of print functions?

I'm working on a Python project that is executed on a terminal (or console) for which I am planning to implement a GUI. I did not major in CS so I really have no idea how to effectively design a ...
1
vote
2answers
229 views

What design pattern (in python) to use for properly seperate runtime infos with core code?

I am not sure if this is a clear question. I work on a python project that is based on terminal(console), for which I am planning to implement a GUI. I am not major in CS so I really have no idea ...
0
votes
1answer
172 views

How can I organize my data flow to process a good program solution? [duplicate]

My main problem when trying to form a program is that while I have the tools at my disposal, I am too disorganized to properly use them to solve my problems. Often my process is simply trial and ...
5
votes
4answers
621 views

Refactoring jQuery spaghetti code to use DDD [closed]

Most of my client side code ends up as a long script in one file the mostly looks like this: <script> function someFunction1(){/*...*/} function someFunction2(){/*...*/} ... var ...
1
vote
1answer
330 views

Where to validate domain model rules that depend on database content?

I'm working on a system that allows Administrators to define Forms that contain Fields. The defined Forms are then used to enter data to the system. Sometimes the Forms are filled by a human via a ...
2
votes
3answers
446 views

Setting Deadlines in software development [duplicate]

I have been working on a system alone for about two years. I inherited the system from a contractor who spent about two years working on it before me (alone). The system is not particularly well ...