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

learn more… | top users | synonyms (1)

0
votes
1answer
60 views

What is the better way of getting different outputs for two very simmilar related workflows

I have a very concrete scenario but I think it would be quite frequent. I'm trying to come up with a solution that it's "better" by better meaning more scalable, reusable and not smelly. I'm working ...
4
votes
1answer
56 views

named arguments replaces the builder pattern

When using a language that supports named and optional arguments, does the builder pattern no longer have a practical use? Builder: new Builder(requiredA, ...
0
votes
0answers
29 views

React and simple UI state

I'm starting to playing around with React and have a basic question regarding state. I understand that in React state should only contain data which may change and cannot be computed from elsewhere, ...
1
vote
1answer
371 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 ...
0
votes
4answers
341 views

Is it better to find issues myself or let the computer figure it out?

I'm about to start the process of migrating a program from one component to another. Most of the core functionality will be the same but I'll need to change database calls, etc. I'm sure there will ...
0
votes
0answers
317 views

Which interface allows you to use a design pattern that is characteristically changed with the instantiation of objects?

I can't find my answer to this question: Which interface allows you to use a design pattern that is characteristically changed with the instantiation of objects? I found something related to ...
9
votes
5answers
18k views

Best way to load application settings

A simple way to keep the settings of a Java application is represented by a text file with ".properties" extension containing the identifier of each setting associated with a specific value (this ...
0
votes
0answers
53 views

How to deliver messages from a communication interface to a core?

I want to develop an application in near future, where I will receive data via a communication interface. So there exists a Java class, that is responsible for getting the data. After the application ...
3
votes
4answers
151 views

Architecture: Are form default values considered business logic and where should the logic to calculate them be placed?

An example of default form values on a search form might be: Start Date - Today End Date - The last day of the next month Obviously, these are fairly simple examples, but default values can get a ...
1
vote
1answer
269 views

Methods for structuring JavaScript SDKs

I've built a REST API and have been using Backbone models throughout a couple different applications to communicate to it. I would really like to build a single JS SDK that can be used in any ...
1
vote
1answer
233 views

What is better repository design?

I have tables that I insert, delete and update, but I read from views. At times, I may read from the tables as well. What is a better generic interface for a Repository: public interface ...
4
votes
2answers
106 views

Asking about learning experience while working for outsourcing company [on hold]

i come up with this question because i feel frustrated to learn new things. When i learn new technologies i can remember it for a short time then if i can't apply to the work i almost forget it. For ...
4
votes
3answers
682 views

How to show someone of the power of model-view-controller design pattern?

I've been working with a friend on a project that we've taken over, and I've realized that we have a big problem implementing the model-view-controller design pattern due to the way that the project ...
-1
votes
0answers
19 views

I should expose Cursor object to the view object to use it? [on hold]

I developed from the Web to Android Development is doing a App, the need to use SQLite and AdapterView. I wanted to write a DAO class to do all the work associated with the database query and populate ...
0
votes
1answer
628 views

What pattern to use for this 'constructor'? Decorator vs Factory?

I'm developing a program to generate LARP characters in java and I've hit a snag. Initially I had planned to use a decorator to iterate through the potential 'roles' (effectively classes), and then ...
1
vote
2answers
47 views

How to maintain atomicity with a service like pattern

Imagine a route in an MVC web project which handles editing a user of your product. You can do things like change their name, their email, their group, their roles and so forth. This data is put in a ...
0
votes
1answer
60 views

How do you name the Visitor implementation? [closed]

I was reading about Visitor pattern and was a little wondering about naming of the methods. Assume we have the implementation of the pattern as follows: public interface Entity{ public void ...
7
votes
3answers
4k 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
103 views

Builder design patterns: passing parameters from client to the builder

Does the builder design pattern allow passing parameters? If yes, what is right way to achieve it? Overview The builder pattern is about hiding the details of object constructon, it places two ...
0
votes
1answer
77 views

DI container with multiple instances of same object

I'm looking for idea to make a DI container that can store multiple instances of the same object. Usually, a DI container should store either a single instance of the object, or create new object each ...
3
votes
3answers
321 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 ...
1
vote
0answers
53 views

Partially Fulfilled Specification Pattern

We have a model (IPayableModel) with a boolean property indicating that a user may or may not pay for the item. A set of specifications defining criteria that would disqualify the model from payment ...
0
votes
1answer
244 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
0answers
99 views

How to to log clicks for a Pay-Per-Click software?

Let say you have a Website with advertising, and each time a user clicks on it, you want to charge an advertiser the amount he bids (basically, a pay-per-click system, like Adswords, with a different ...
0
votes
1answer
136 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 ...
0
votes
2answers
168 views

Design pattern for multiple companies in AngularJS

We are on the verge of launching v3 of our in-house product. v2 was written completely in AngularJS and V3 will be the same, but written completely in Typescript. We have a few customers that have ...
0
votes
1answer
182 views

Dealing with several custom getters

I have a data structure with data units containing different types of data. I've wrapped the data in "Field" objects so that each field is able to independently parse user input in a desired way. ...
0
votes
1answer
263 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
169 views

Design pattern where decorated object may ask for things like “status updates” from the decorator to perform it's role?

Here's an situation that has haunted one of my open-source projects for quite some time. Imagine if you could represent every front-end input form with a single backend object? An object that ...
0
votes
1answer
494 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 ...
0
votes
0answers
61 views

When should i sync my data from parse.com to my android app [closed]

I'm making an android application whith parse.com. Here is the situation : I have an offline part on my android app and i'm using LDS (LocalData Storage) to stock my data and send them to parse.com. ...
5
votes
1answer
119 views

Role-based REST API?

I'm building a REST API for which several users with different roles will have access to the resources it contains. To keep the scope simple let's take the "student/teacher/class" domain: GET ...
1
vote
1answer
213 views

mySQL / PHP design pattern - one function multiple queries

So here's the gist of it. I'm looking for a design pattern where I can have one function, say queryHandler that gets the query and the parameters from a number of different functions and returns the ...
0
votes
1answer
87 views

Design Pattern for Filtering [closed]

I have a requirement where I get a list of objects say List. Now I have filter Criteria which I need to apply to filter out the objects in the list. Currently I am thinking of using chain of ...
1
vote
3answers
264 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 ...
0
votes
2answers
62 views

Client-Server Application Object with child Objects

Actually I'm going to build an Client Server Application, at the Login I recive the User Object from the Server. An user has a List of tasks, but I don't want to load them at the Login. So what would ...
14
votes
4answers
3k views

Does anyone have a specific example of using the Flyweight Pattern?

I have been studying design patterns and came accross the fly weight pattern. I have been trying to see opportunities to use the pattern in my applications but I am having trouble seeing how to use ...
1
vote
3answers
172 views

C# Subject Observer Architecture question

I'm making a C# application using the Subject Observer design pattern in a slightly different way. I am passing the Provider Class, implementing IObservable (this has the OnNext() method that ...
2
votes
1answer
93 views

Is it OK to deprecate methods that need to be public due to the packaging model but are not to be used outside the codebase in Java?

I am currently working on a semi-large project that has several packages. There are 3 main packages, a "client" package, a "server" package and a "common" package. There are two jars, one for the ...
120
votes
11answers
22k views

How accurate is “Business logic should be in a service, not in a model”?

Situation Earlier this evening I gave an answer to a question on StackOverflow. The question: Editing of an existing object should be done in repository layer or in service? For example ...
0
votes
0answers
330 views

Online stores service design [duplicate]

I am designing an online store service app with rails. Everyone who wants to make his/her own store can do it with this app by just signing up and choosing a domain. I want to make it as SaaS as it ...
3
votes
1answer
132 views

Recursively parse without resorting to ugly design patterns

I'm currently building a crochet pattern parser in Java, and I've hit upon some trouble. I'll call the language used for input Crochet Pattern Code (CPC). I have a rather large writeup on the ...
9
votes
7answers
13k views

Is there any design pattern except MVC for web?

I want to know are there any design patterns for web besides MVC? I know there are design patterns as: Registry, Observer, Factory, ActiveRecord ,... and MVC a set of other design patterns and folder ...
1
vote
1answer
211 views

How to avoid big class complexity while keeping encapsulation?

I'm developing a PHP library to work with big numbers (at this moment only with a "Decimal" class, but I want to add new classes, to handle Integers, Rationals, and Complex numbers). In any case, the ...
5
votes
2answers
373 views

Why should ViewModel route actions to Controller when using the MVCVM pattern?

When reading examples across the Internet (including the MSDN reference) I have found that code examples are all doing the following type of thing: public class FooViewModel : BaseViewModel { ...
0
votes
0answers
93 views

Is this MEAN stack design-pattern suitable at the 1,000-10,000 user scale?

Let's say that when a user logs into a webapp, he sees a list of information. Let's say that list of information is served by one of two dynos (via heroku), but that the list of information ...
0
votes
1answer
94 views

Possible way to make java class builder more abstract by using interface required keys

I'm looking for a more abstract pattern for builders that handles required fields without the need of writing a validator that checks if all requried fields are set. I like this builder. But is ...
32
votes
1answer
11k views

Communication between nested directives

There seem to be quite a few ways of communicating between directives. Say you have nested directives, where the inner directives must communicate something to the outer (e.g. it's been chosen by the ...
2
votes
1answer
98 views

Scheme/Design Pattern for allowing a certain outside class to set properties

I came up with a solution (in PHP) to a problem and am wondering if it is a named Design Pattern, and if it is good practice. I have a collection class and an item class. The collection class is the ...
0
votes
4answers
199 views

Fixing class Hierarchy design mistakes due to incorrect inheritance

I have a code like this. My derived class man, may not properly have a member function declared pure virtual higher up the hierarchy. eg. WagTail here class mammal{ public: virtual void WagTail() ...