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

learn more… | top users | synonyms (1)

6
votes
4answers
405 views

Class Duplication Pattern?

I'm currently working as a solo developer on my current project. I inherited the project from another developer, who has since left the company. It's a model-view-controller style web application in ...
-1
votes
2answers
51 views

Appropriate Design Patterns [on hold]

I have a list of objects which represent log entries like below. List<LogEntry> Entries; //Log Entries Read By A Log Reader The Log Entry Class contains following properties. public class ...
-2
votes
1answer
30 views

ClickHandler for button = strategy pattern? [on hold]

If you provide a implementation of a ClickHandler interface to a button (defining some behaviour), is this the strategy design pattern?
2
votes
0answers
35 views

In MVC, who is in charge of handling observers?

(I'm writing a large MATLAB GUI that makes significant use of MVC, so my example is written in MATLAB. However, I believe this question is language-agnostic. Please correct me if I'm wrong.) I have a ...
1
vote
2answers
113 views

Is MVC controller an use case controller?

In GRASP (http://en.wikipedia.org/wiki/GRASP_(object-oriented_design) ), a controller (use case controller) is defined as: A use case controller should be used to deal with all system events of ...
4
votes
2answers
99 views

Top-down vs Bottom-up approach when designing a class library

I am designing a class library to represent western equal temperament music theory concepts for the purpose of composing notated music with code (I realize there are other libraries and programs for ...
1
vote
1answer
122 views

How much trouble can the use of Singleton class as Model cause?

In my latest WPF applications I've been using a Singleton class, that I call Model, to contain all my application's logic, such as file reading, information handling, etc.. In the WPF Views or ...
1
vote
1answer
42 views

Pattern to add custom attributes to Forms control classes, without having same code everywhere?

I am creating custom winforms designer. I use label, textbox, combobox, listbox, button and checkbox on the designer. I don't want to show all their properties on PropertyGrid, so I created a custom ...
5
votes
1answer
314 views

Where we should not use MVC? [duplicate]

I have a software engineering course project that we should design a web application, so I've decided to read about software architecture patterns. I've read a lot about what is MVC and its ...
2
votes
1answer
49 views

Where to keep persistent services in MVVM architecture?

In an MVVM application I need to use some services that are persistent, e.g. network services like P2P and WCF where the main "engine" or server endpoint must remain up and running during the lifetime ...
2
votes
2answers
64 views

Sharing info objects between objects?

I'm making a game and I have several cards that are created during the game. Each card needs some info, which is shared between cards of the same type. So I have a class CardInfo, which holds a name ...
-1
votes
0answers
12 views

Best way to populate Entity from posted ViewModel in ASPNET MVC?

In form post, I am used to accept a viewmodel in post action method. One way or another, I have to go through each property to assign it to the entity object that the repository module is expecting. ...
10
votes
3answers
342 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, ...
1
vote
1answer
45 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, ...
0
votes
1answer
81 views

How to deliver messages from a communication interface to a core? [closed]

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
2answers
119 views

Asking about learning experience while working for outsourcing company [closed]

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 ...
1
vote
2answers
49 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 ...
1
vote
0answers
60 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 ...
3
votes
4answers
155 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
0answers
101 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
79 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 ...
7
votes
2answers
158 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 ...
0
votes
1answer
89 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 ...
2
votes
1answer
94 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 ...
3
votes
1answer
136 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 ...
1
vote
1answer
219 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 ...
2
votes
1answer
106 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
0answers
98 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
4answers
201 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() ...
3
votes
2answers
113 views

What kind of base for Decorator: interface, abstract class, non-abstract

What should be at the top of inheritance tree of Decorator design pattern? I mean the base for both components and decorators non-abstract class: has data fields, implements methods abstract class: ...
1
vote
3answers
183 views

Pass the whole object to a method or just parts?

I have an object that has about 50 properties, but one of my methods only uses about 3 of these properties. Is it still better to pass the whole object or parts. A scenario would be were I am using ...
0
votes
1answer
167 views

What is the best way to create DTOs from entities and update entities from DTOs in a layered architecture?

Option 1: At first I would make a call to my service layer, which served as an API for my core domain, to get a domain object or a list of domain objects and then pass them into the assembler which ...
3
votes
1answer
287 views

Beginner Facade Pattern Example

I came across this article: http://didawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformatica/tdp/dp-l10a-facade2014.pdf At the end, it has a question asking: One common problem ...
0
votes
0answers
17 views

What is the best way to create DTOs from entities and update entities from DTOs in a layered architecture? [duplicate]

Option 1: At first I would make a call to my service layer, which served as an API for my core domain, to get a domain object or a list of domain objects and then pass them into the assembler which ...
1
vote
3answers
178 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 ...
1
vote
2answers
99 views

Pattern for validating rules having different signatures

I have a class in charge of responding to an input event and maybe triggering another event. To decide, it has several rules to check. I'm trying to get away from a class looking like this: public ...
0
votes
0answers
30 views

Accessing intermittently available resources with transactions and post-access cleanup in a generalized, functional, composable way

The following psuedo-code illustrates what I'd like to be able to do. Is there a way to accomplish something like this in Scala?: trait IntermittentlyAvailableResource trait ...
3
votes
3answers
146 views

Development Time: sql in UI code vs domain model with datamapper

First, sorry for my English guys. Currently this is my first programming job. I am labeled as the most incompetent programmer in my company that's because they measure the performance and ...
0
votes
2answers
111 views

Beginner Decorator Pattern Question

I came across this article: http://sourcemaking.com/design_patterns/decorator After reading it, I am having a little bit of difficulty understanding a concept. If you look in the Structure section in ...
0
votes
0answers
97 views

To KISS or not when coding? [duplicate]

I don't consider myself "ninja" but I don't think I'm bad dev either. Anyway, after many years of development I tend to keep it simple more ofthen than before. For small projects there is no need to ...
0
votes
1answer
85 views

Multiple method calls in the constructor and dependency injection

I was asked to refactor some almost ureadable spaghetti code into object-oriented architecture. I have some doubts regarding a class that I designed. Here is the class' skeleton: require_once ...
0
votes
1answer
87 views

Can you refer to the callback function as an API?

A system design is decoupled into two layers say layer A and layer B. The interaction between layer A and layer B occurs through an interface that is exposed by layer B in form of an API. This ...
0
votes
0answers
55 views

Abstracting the data in a relational database. [duplicate]

While working with data, which is in a relational database I came up with this issue. At first, I was just writing helper functions to retrieve A SPECIFIC data I needed for the current problem but it ...
0
votes
0answers
73 views

Angular Architecture

I have been developing a few prototype apps in Angular, with various backends, including firebase and php/mysql. I'm pretty sure I'm not using a good organization pattern for development because of a ...
1
vote
2answers
93 views

Rich Domain Models, Encapsulation, and the Problem of Constructor Over-Injection

I am refactoring an e-commerce web-application, currently working on the UserBasket class, which will have to handle adding or removing items, changing their quantity, getting total amount, total ...
2
votes
2answers
101 views

For a concrete SQL Repository, should I encapsulate the SQL logic inside or outside the repository methods?

If I have a concrete repository based on SQL data access, should I pass in SQL to the repository methods or encapsulate them within the methods. I feel if I pass them in, then I am coupling my ...
7
votes
1answer
196 views

Should I build undo stack in model or its wrapper?

I am building an application (Python/PyQt). The first-order item will be a tree view/model with many helper functions to add new items, move them around in the tree, etc.. Then I will have a main ...
0
votes
1answer
37 views

Tags DB structure - tags table using one join and GROUP BY, or pivot (join) table using two joins?

I'm implementing tags into my question and answer application. Users will be limited to the tags available by the app, so they can't choose their own. So maybe only 30-50 tags will be available. This ...
0
votes
1answer
119 views

How much to encapsulate when objects being dealt with are pretty similar

As I have been answering questions related to object-oriented design and how to go about reducing the amount of classes to make sure that there is not a lot of "class clutter" and code repetition I ...
1
vote
1answer
237 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 ...