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

Best pattern to track actions inside a presenter

I have a MVP implementation, inside my presenter i have a lot of public methods like onSendMessage() for example. I need to track some of that methods, meaning track just call a ...
1
vote
1answer
49 views

Knowledge base UI pattern

In our database backed (C# WPF / Entity Framework) application, we want to build a system to enter, store, display and search arbitrary content linked to our main entity. The challenge here is to find ...
0
votes
0answers
37 views

Viability of custom framework to serve RESTful API

Context For my end-of-year project at school I had to create a framework to serve a RESTful JSON API. I wasn't authorized to use a project like Ruby on Rails for instance, Sinatra is allowed since it ...
0
votes
1answer
78 views

What are the consequences of eliminating the ORM/ODM in a NoSQL based system?

In Martin Fowler's article OrmHate, he states the following: If you have an application problem that maps well to a NoSQL data model - such as aggregates or graphs - then you can avoid the ...
0
votes
1answer
54 views

Where do I create/instantiate repositories in DDD that are used my Domain Services

From what I understand a DomainService should be implemented against a RepositoryInterface, so we could change with easy the repository (which its a part of the Infrastructure layer) So, if I have: ...
0
votes
0answers
24 views

Place of a threading module in a MVP design pattern in Python

I am working on a GUI that displays images, 1 image or many (a video). Some processing is needed before displaying an image. Hence, I would like to do some threading in order to keep the GUI ...
5
votes
5answers
265 views

Do you generally send objects or their member variables into functions?

Which is generally accepted practice between these two cases: function insertIntoDatabase(Account account, Otherthing thing) { database.insertMethod(account.getId(), thing.getId(), ...
2
votes
1answer
106 views

What functionality to expose in a database abstraction layer?

I'm trying to design a simple way of abstracting away data persistence behind an interface, but I'm having a hard time figuring out how much fine grained control should be exposed to higher layers. ...
0
votes
0answers
65 views

Best architecture for customising the character

I want to customize the game character before starting the level, for example, select what kind of weapon, armor, clothes, etc. There are several components and each component consist of several ...
2
votes
2answers
121 views

Placing preconditions in the right place

I am trying to figure out the best way to define the responsibility of checking preconditions. Let's consider the following case: we have an Event class representing a sports event and a Matchup ...
2
votes
1answer
69 views

What's the difference between an implementation detail and a technical concern

I just wanted to make sure that I understand and can properly articulate the difference between these two concepts. I've always thought of an implementation detail as being the internal workings of ...
13
votes
2answers
1k views

How to go about testing un-injectable code?

So I have the following piece of code in use all over my system. We're currently writing unit tests retrospectively (better late than never was my argument), but I don't see how this would be ...
3
votes
1answer
88 views

Is there a good way to use the front controller pattern for command line applications?

I am a PHP developer and I used to build web applications with one PHP file per page for a very long time. This resulted in duplicated logic and messy code (even though I didn't know it at the time). ...
-1
votes
0answers
27 views

RSS feed topic categorization

I'm trying to make my own news feed from CNN's RSS feed (among a dozen other news sources). However, I've come across a problem that is actually quite complex, at least that's what I think. One of ...
5
votes
3answers
136 views

Breaking large class into smaller classes when they need a common state?

I am writing a parser for a fairly complicated language in C++. The Parser class is given a list of tokens and it builds the AST. Though only a part of the parser is completed, the Parser.cpp file is ...
0
votes
0answers
35 views

Lost in Presenter and other design pattern

I have an entity called Contact , that defines relationships with other entities and fields types (I use Eloquent). For different info non-fields, like getFullName, I use a Presenters like this: new ...
1
vote
1answer
100 views

Is using __import__('module_name') an antipattern in Python?

I'm currently refactoring a Python 2 project which includes the ability to add or remove plugins, which are Python modules implementing a given API. The main app accesses add/remove/update hooks in ...
1
vote
1answer
213 views

Name for this design pattern?

Background Working as a software engineer in the field of electronics, I often find that none of the existing design patterns i.e. GoF typically fit the bill for what I need to do. One of the ...
2
votes
4answers
262 views

Is it strange for a Builder object to have getter methods?

I have a fairly complex immutable data type that I'm using a builder object to instantiate. Currently, I have a setup where I parse a file, setting various fields in my builder, and then build the ...
1
vote
2answers
121 views

How should I represent mutable boolean state?

When I have some object with boolean state that can be changed (like a checkbox's checkedness), there are several ways I can expose it. Getter property, Setter method bool IsChecked { get { ... } } ...
5
votes
2answers
121 views

Recreating complex aggregates from a persistance source

I'm building a web application with C#, and I have an aggregate root which has several entities and value objects. Then I have a repository object which persists the aggregate to the database (I'm ...
4
votes
3answers
204 views

Enums and single responsibility principle (SRP)

I have been experimenting lately with enums, and I found out that in Java they can do much more than simply representing a fixed set of constants. Now, I am thinking about creating a new enum for my ...
0
votes
1answer
65 views

Is it bad practice to simplify constructor dependencies using a simple container when the class represents the entry point for a sub system?

I have a System which depends on Transactions, and a few other things. This list can become very long. Transactions can be (and will be) implemented in two ways or more, so every transaction is an ...
2
votes
0answers
77 views

Architecture design for Web API with single endpoint

Scenario: I have a situation where I need to refactor a Web service with a single API endpoint that uses complex logic to insert, update and fetch data from a database. The clients use one call, and ...
46
votes
10answers
6k views

Should we avoid custom objects as parameters?

Suppose I have a custom object, Student: public class Student{ public int _id; public String name; public int age; public float score; } And a class, Window, that is used to show ...
4
votes
2answers
152 views

What are the advantages of using multi-tenant architecture with separate db schemas per customer?

I have a client that wants me to build a SaaS application with a multi-tenant architecture, where different clients will go in a separate schema on the same db server. I have seen this architecture ...
0
votes
1answer
77 views

Design to link two model classes with different multiplicity

It is usually well known how to deal with model classes that have a 1:N relationship: classical examples are order->items or client->orders. Every layer of the software has its appropriate and ...
6
votes
2answers
215 views

Is the command design pattern a good way to reduce the number of dependencies in my class?

I recently realized that I have way too many dependencies in many of my classes. Now I am trying to solve that for the most important class. I think I have an idea how but I'm not sure if it is the ...
13
votes
4answers
2k views

Pattern for algorithm that outputs an explanation of how it gets to a solution when needed

The following scenario happened to me several times. I programmed a algorithm that solves a certain problem. It works fine and finds the correct solutions. Now, I want to have an option to tell the ...
3
votes
1answer
82 views

Is it bad to pass a reference to the behavior's owner object to the behavior?

Is it bad to pass a reference to the behavior's owner object to the behavior? For example, if I have a Duck and DuckBehavior class. DuckBehavior is a part of the Duck Class. But what if I need to ...
5
votes
4answers
183 views

Idiomatic pattern matching equivalent in Java

I'm building a simulator which parses some events from STDIN and "runs" them. My background is mostly functional programming these days, so it seemed natural to do something like this: datatype Event ...
5
votes
1answer
367 views

Software design: too many static objects?

About the subject I hesitated for a while between using singletons objects or plain static ones. After having read a lot of different opinions, I made mine: If you don't need to prevent ...
0
votes
0answers
62 views

Repository Pattern: How to structure repositories with nested tables?

I'm working on an API and I always seem to run into this thought debate. When designing the code structure that interacts with the database (repositories, data providers ect..) how do I structure the ...
7
votes
3answers
216 views

Using Interfaces for Loosely Coupled Code

Background I have a project that depends on the usage of a certain type of hardware device, while it doesn't really matter who makes that hardware device as long as it does what I need it to do. With ...
6
votes
5answers
180 views

Modular Objects with conflicting implementations

I am working on a game framework that would allow users to use multiple mods/plugins to add additional features to the game. For the remainder of the post, I'll use the following definitions: mod: ...
19
votes
5answers
1k views

Why would a type be coupled with its builder?

I've recently deleted a java answer of mine on Code Review, that started like this: private Person(PersonBuilder builder) { Stop. Red flag. A PersonBuilder would build a Person; it knows about ...
4
votes
2answers
165 views

Ubiquitous language and maturity level in REST API?

According to Richardson Maturity Model there are several levels of maturity in REST approach. http://martinfowler.com/articles/richardsonMaturityModel.html Since DDD uses ubiquitous language, I am ...
1
vote
1answer
95 views

Sharing POJO between different handlers

I am trying to automate Business Process which can be characterized as a pipeline with distinct stages. Pipeline can be perceived as A->B->C, where A,B,C are distinct Business Steps that ...
4
votes
2answers
174 views

How far should encapsulation in JavaScript go?

I have a variable which I want to use in only one function. I can write my code like this: var theAnswerToLife = 42 var multiplyIt = function(x) { return ++theAnswerToLife * x } I have some ...
1
vote
1answer
44 views

How to use fields from an object after an exception is thrown and the object can't be fully created

The issue that I have is that I need information from an object that a method returns when it throws an exception. It is a little hard to describe so I have this java pseudo code example. I have a ...
1
vote
2answers
85 views

Is it a good idea having default static variables for new instances?

OK let's say I have something like this: public class MyObject { public static int DefaultValue = 9 private int _value = DefaultValue; public int Value { get { return _value; } set { ...
1
vote
0answers
99 views

How to authentication user in REST API (domain driven design)

I am using REST API as a presentation layer of a DDD project. In order to secure API calls I am using token based security. ...
2
votes
3answers
134 views

Command Pattern - Correct usage?

I have a scenario wherein I need to do certain specific steps in a specific order. For clarity lets take a simple example. Let's say I have a Student and some Student Properties which I encapsulate ...
-2
votes
0answers
36 views

Classified auto removal system

I am building an online classified website. You need to have an account to post. People can post their object and post pictures of it. I don't want to have to confirm each post before they go live. ...
2
votes
3answers
92 views

How to clearly define boundaries of a bounded context

After a month or so of reading and researching DDD, I decided to start my own project and created DDD with these bounded contexts> Clients Products Orders Billing Each bounded context has rest API ...
0
votes
1answer
94 views

Is pubsub pattern suitable for my case?

I'm planning to use pubsub pattern with azure service bus in my logistics application.but I'm confused whether pubsub pattern is suitable for my case. My scenarios: users will subscribe set of ...
2
votes
1answer
145 views

Checking preconditions the proper way

I have a class with around 1300 lines and it has many CRUD-like methods that need parameters to be checked, for some of them it's more than just a few rules. For clarity purposes, I am going to use ...
4
votes
3answers
141 views

Who is responsible for checking object properties such as Visible/Enabled?

Say we have a user interface with Forms, Buttons and such. Each item has some properties (such as Visible, Enabled, etc.). Who should check on these properties and decide whenever to render the item ...
3
votes
1answer
217 views

How to pass data to OOP objects?

I'm new to this whole thing, so please tell me if I'm doing this wrong of if there's a better spot for my question. I'm making a game with basic systems for projectiles, npcs and items. This game ...
7
votes
2answers
141 views

How to best design a job queue with constraints?

Consider the following situation: You have a program which creates numerous 'jobs' that need to be processed and places them into a queue. You have other worker programs which grab the next 'job' in ...