A design pattern is a general reusable solution to a commonly occurring problem in software design.
0
votes
1answer
19 views
Store Arbitrary values related to mysql record
I have created an app that manages a Data cleansing workflow. Each row imported needs to store an arbitrary number of key value pairs in addition to our standard mysql schema. The key values need to ...
2
votes
3answers
402 views
Functional programming strategies in imperative languages
I've been convinced for awhile now that some strategies in functional programming are better suited to a number of computations (i.e immutability of data structures). However, due to the popularity of ...
0
votes
1answer
61 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 ...
-2
votes
0answers
57 views
What are three contrasting examples of DIP and OCP in Javascript? [on hold]
What are three contrasting examples of DIP & OCP in Javascript?
As a web developer, I'm struggling to fully grasp the Dependency Inversion Principle & the Open/Closed Principle as it applies ...
1
vote
1answer
113 views
Design Patterns for creating tasks
I am developing software where each action in my entities need create tasks that will be execute in my infrastructure. When I create a task it is only records in the database. Afterwards, a windows ...
-1
votes
0answers
52 views
Effective screen designing with attractive UI? [closed]
I would like to design a screen effectively. What books or tutorial and tips should I follow up in a future for a better screen designs? Please can anyone give me some suggestion?
This is my screen ...
0
votes
2answers
137 views
Good architecture for passing data to multiple APIs
I have a hypothetical scenario where I need to pass data to APIs from multiple different providers, depending on the 'vendor identity' provided by one of the pieces of data.
If I have the data as ...
0
votes
1answer
65 views
Implement RPC via SIP
Look at the following use case.
I have a client (Java) application, which wants to get/set the state of another, remote application (C). The communication between them is done via SIP, which is run ...
0
votes
0answers
22 views
API providing function to be run in a thread vs. thread that runs this function
I'm writing a Python library which exposes a certain event listener interface. The user can register callbacks to handle different types of events. There is also a function which handles the actual ...
3
votes
2answers
224 views
Is the Java Integer cache a realization of the object pool pattern?
One of the best-known examples of a full-fledged object pool is the JDBC connection pool. Main reasons:
objects in the pool are expensive to create and relate with external resources
each object in ...
0
votes
0answers
27 views
update methods in simple factories
I have simple factory class with differently named methods which create the same object but differently. These created objects are persisted to db. These are then retrieved from the db elsewhere and ...
-1
votes
1answer
130 views
All programming functions always return to the If or If/Else statement? [closed]
After learning, coding, and coding even more than ever now, I have noticed a trend in a lot of programming which I do. The trend is that the majority of my functions are if{} or if{} else{} statements ...
3
votes
0answers
34 views
Pattern to use to relate multiple data sources to different user data widgets
I have an client x server intranet application the basically gets data from the server, format it and send that data to the client for display. At the server we are using ASP.NET C# running on IIS ...
2
votes
1answer
145 views
Working with a large, messy object [duplicate]
I have been handed a very cluttered, "One Ring" object (one object to rule them all). The OR class has 40 fields. These fields map to 16 different objects (the OR has all the fields from the 16 ...
2
votes
2answers
242 views
Reduce number of if statements through design pattern
I had a loop through object Process, each process instance can be of a different type, derived from Process base class (e.g.: Process1, Process2,...). Each derived type of Process has different ...
-2
votes
4answers
219 views
What is the name of this design pattern? [closed]
I have been using this "design pattern" (may or may not be an "official" design pattern) for a while and I wanted to know if it had a name (so that I could name my classes after it).
Example in PHP ...
0
votes
1answer
130 views
Why is the “app” folder now a (more) common pattern in web projects?
It might be related to the Yeoman project, or they might have adopted this from somewhere else, but it seems to be the default for all of their generators. Aside from Yeoman generators I've also ...
1
vote
1answer
50 views
PHP - Repository matrix pattern?
I'm trying really hard to refactor some of my legacy code in the project using best practices and design patterns + DDD so I'd love some feedback on an issue I'm currently having.
Let's assume that I ...
1
vote
0answers
30 views
How do I differentiate between old and new data in backbone collections?
A common pattern I come across is a backbone collection which is initially seeded from a database.
However, the user can also add to the collection. When the user does add to the collection, these ...
33
votes
10answers
4k views
Are error variables an anti-pattern or good design?
In order to handle several possible errors that shouldn't halt execution, I have an error variable that clients can check and use to throw exceptions. Is this an Anti-Pattern? Is there a better way to ...
0
votes
2answers
131 views
Expected error handling
Let's say I have a social media website. On this website, users can upload several pieces of information about themselves, including their phone number. To implement this, I have a class called ...
1
vote
1answer
70 views
Should state machine with synonym states be shown explicitly?
I am new to state machine modeling and while trying to model a system, I have a question.
An example will explain it better:
Considering a system that does calling (probably a customized cell phone ...
0
votes
1answer
137 views
Technical example of modeling a domain with OOD?
Considering favoring composition over inheritance and looking at various design patterns there are multiple approaches to modeling a domain.
Say you have some Entities which are very similar in some ...
1
vote
1answer
62 views
Need to provide an interface (for plugins) for taking input Type A, and returning output Type B
public interface IMyInputProviderPlugin
{
IMyOutput Provide(IMyInput data);
}
This is an interface I need to provide so that I can dynamically load the dlls and not have them bound to my ...
0
votes
0answers
46 views
How to cleanly write a multi step process with user feedback and multiple callback
When you have some process that has several steps and you multiple entry points the code gets ugly pretty fast.
I encountered this with Facebook integration in my mobile app:
User wants to share ...
0
votes
1answer
60 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 ...
2
votes
1answer
79 views
Testing complex compositions
I have a rather large collection of classes which check and mutate a given data structure. They can be composed via the composition pattern into arbitrarily complex tree-like structures. The final ...
0
votes
0answers
42 views
Android From Local DB (DAO) to Server sync (JSON) - Design issue
I sync data between my local DB and a Server.
I'm looking for the cleanest way to modelise all of this.
I have a com.something.db package
That contains a Data Helper and couple of DAO classes that ...
0
votes
0answers
36 views
What should a domain object's validation cover?
I'm trying to figure out how to do validation of domain objects that need external resources, such as data mappers/dao
Firstly here's my code
class User
{
const INVALID_ID = 1;
const ...
4
votes
0answers
170 views
Why using Fragments?
I have read the documentation and some other questions' threads about this topic and I don't really feel convinced; I don't see clearly the limits of use of this technique.
Fragments are now seen as ...
2
votes
1answer
56 views
How do you show the exception handler in a class diagram?
I have one exception handler class. I want to show this class in the uml -- class diagram. But, I do not know how to represent relationship between class <X> and exception handler class. How can ...
0
votes
0answers
58 views
does class reference itself static anti pattern in prism
I have an application and my desing approach look like this:
class Manager
{
public int State;
static Manager _instance = null;
public static Manager Instance
{
get { return ...
3
votes
3answers
201 views
is it valid that a state machine can have more than one possible state for some transition?
I have a requirement for a workflow which I am trying to model as a state machine, I see that there is more than one outcome of a given transition(or activity).
Is it valid for a state machine to ...
0
votes
2answers
87 views
How to present a stable data model in a public API that allows internal data structures to be changed without breaking the public view of the data?
I am in the process of developing an application that allows users to write C# scripts. These scripts allow users to call selected methods and to access and manipulate data in a document. This works ...
2
votes
1answer
166 views
Is there a Design Pattern for preventing dangling references?
I was thinking about a design for custom handles. The thought is to prevent clients from copying around large objects. Now a regular handle class would probably suffice for that, but it doesn't solve ...
0
votes
0answers
120 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 ...
2
votes
4answers
202 views
Callbacks: when to return value, and when to modify parameter?
When writing a callback, when is best to have the callback return a value, and when is it best to have the callback modify a parameter? Is there a difference?
For example, if we wanted to grab a list ...
1
vote
0answers
72 views
Processing a list of atomic operations, allowing for interruptions
I'm looking for a design pattern that addresses the following situation:
There exists a list of tasks that must be processed.
Tasks may be added at any time.
Each task is wholly independent from all ...
39
votes
2answers
3k views
What is the “Free Monad + Interpreter” pattern?
I've seen people talking about Free Monad with Interpreter, particularly in the context of data-access. What is this pattern? When might I want to use it? How does it work, and how would I implement ...
1
vote
1answer
43 views
Handling Types for Real and Complex Matrices in a BLAS Wrapper
I come from a C background and I'm now learning OOP with C++. As an exercise (so please don't just say "this already exists"), I want to implement a wrapper for BLAS that will let the user write ...
0
votes
1answer
92 views
Does my use of the strategy pattern violate the fundamental MVC pattern in iOS?
I'm about to use the 'strategy' pattern in my iOS app, but feel like my approach violates the somehow fundamental MVC pattern.
My app is displaying visual "stories", and a Story consists (i.e. has ...
4
votes
5answers
127 views
Preferred way for dealing with customer-defined data in enterprise application
Let's say that we have a small enterprise web (intranet) application for managing data for car dealers. It has screens for managing customers, inventory, orders, warranties and workshops.
This ...
-1
votes
2answers
168 views
Help with MVC design pattern? [closed]
I am trying to build a java program for user login but I am not sure if my MVC design is accurate. I have the following classes:
LoginControl - servlet
LoginBean - data holder java class with ...
0
votes
2answers
199 views
How to design console application with good seperation of UI from Logic
Is it considered an overkill for console application to be design like MVC , MVP or N tier architecture? If not which is more common and if you can link me to simple example of it.
I want to ...
5
votes
3answers
197 views
How to refactor my design, if it seems to require multiple inheritance?
Recently I made a question about Java classes implementing methods from two sources (kinda like multiple inheritance). However, it was pointed out that this sort of need may be a sign of a design ...
1
vote
1answer
196 views
Confused about implementing Single Responsibility Principle
Please bear with me if the question looks not well structured.
To put you in the context of my issue:
I am building an application that invoices vehicles stay duration in a parking. In addition to ...
0
votes
2answers
105 views
What are the benefits of using a 'decorator factory' that decorates objects?
In a project I decided to implement the Decorator pattern.
I have a class Thing with methodA(), and a class AbstractDecorator that inherits from Thing and that all decorators inherit from: ...
19
votes
4answers
2k views
Builder Pattern: When to fail?
When implementing the Builder Pattern, I often find myself confused with when to let building fail and I even manage to take different stands on the matter every few days.
First some explanation:
...
1
vote
2answers
121 views
Flags with deferred use
Let's say I have a system. In this system I have a number of operations I can do, but all of these operations have to happen as a batch at a certain time, while calls to activate and deactivate these ...
9
votes
2answers
215 views
Using packages (gems, eggs, etc.) to create decoupled architectures
The main issue
Seeing the good support most modern programming platforms have for package management (think gem, npm, pip, etc), does it make sense to design an application or system be composed of ...