Tagged Questions

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

learn more… | top users | synonyms (1)

8
votes
3answers
174 views

Proper Model-View-_____ design

I've been reading up about Model View Controller, Model View Presenter, Model View ViewModel, and so on, and generally, the underlying concept seems pretty simple to understand: keep the pretty ...
0
votes
0answers
14 views

What is the best way to initialize a child's reference to its parent? [duplicate]

I'm developing an object model that has lots of different parent/child classes. Each child object has a reference to its parent object. I can think of (and have tried) several ways to initialize the ...
-4
votes
1answer
79 views

Creating n tier application [on hold]

I am new to design patterns. I want to learn constructing 3 tier architecture. I have searched but confused at some points. In this article ...
0
votes
1answer
77 views

IOC Between Presentation and Infrastructure Layer

Question: I would like to set forth dependency mapping from a *.config file from a project that has no reference to the project that contains the concrete class. Scenario: I'll be using terms from ...
0
votes
1answer
89 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
6answers
231 views

What is the simplest way to broadcast data from application to other applications in .Net

I want to send information from one .Net application to multiple other .Net applications. I want the applications to be loosely coupled. The number of applications receiving the information could ...
0
votes
0answers
59 views

Building an email-connector in C#

I'm currently in the process of building an email-connector in C#. It is used to receive emails via IMAP, POP3, et cetera (and storing them in my database) aswell as sending via SMTP. Now I was ...
2
votes
2answers
157 views

Interface to enumerate over files

I'm trying to design a generic interface for enumerating over a list files. Each iteration will open a file, allow the consuming code to access the file to perform some task, and then close the file. ...
1
vote
0answers
41 views

Callback pattern handling exceptions - Best practices in .NET 3.5

I am looking to implement the callback pattern with error handling such that error is caught and pass to the callback code with the response. Since I am using .NET 3.5, I cant use Task (TAP) pattern ...
0
votes
1answer
74 views

How does the consumer-producer solution work?

I'm only a beginner, and my book doesn't cover this subject. I have researched my problem and found that an implementation of the consumer-producer pattern is the ideal solution, and have Googled it, ...
1
vote
1answer
195 views

Should I couple these classes?

I am programming in Python. I have several complicated/hard-to-understand XML files that describe the structure of an election. I am trying to write a python wrapper that makes it easy to access this ...
3
votes
3answers
157 views

Should service layer catch all dao exceptions and wrap them as service exceptions?

I have three layer Spring web app: dao, service and controllers. A controller never calls directly the dao, it does it through the service layer. Right now, most of the time if there is dao exception ...
1
vote
3answers
191 views

Implements > extends, but what about variables?

It's preferable to write programs that depend on interfaces rather than on superclasses, but what when you want a class to have certain variables? Sometimes you want a class to implement a certain ...
0
votes
2answers
120 views

Should I have an object as attribute or primitive id?

I am wondering which principle should I use. Here is my situation. I have a class named TravelOffer. This class looks like this: public class TravelOffer { private final long id; private ...
3
votes
1answer
68 views

At what granularity are events recorded in Event Sourcing?

I'm growing my understanding of event sourcing. My understanding is that it provides a means of recording events as they happen so that given a common beginning state and an audit log of recorded ...
0
votes
1answer
131 views

What should be in a PIMPL?

I am kinda trying to implement a windowing library in C++, the circumstances are forcing me to implement it all myself, that's not the point of this question however. My question is: What should be ...
2
votes
2answers
108 views

Designing an API with access tokens, how to handle GET requests?

I am building an API that will utilize access tokens so that I can track usage among various departments and for access control. My plan is to utilize the HTTP verbs appropriately - GET will retrieve ...
0
votes
1answer
37 views

How to save entities relations using unit of work pattern

I use Unit of work pattern to commit all new, dirty, deleted entities to the DB (using a db_mapper). Example of entities are: Student and Class So Student->registerDirty() will add this entity to ...
3
votes
0answers
117 views

Lightweight data modeling vs traditional classes [closed]

I've heard a lot of talk about using lightweight data modeling as of late. Especially in relation to the Clojure programming language. What is it and how it differs from traditional classes regarding ...
2
votes
1answer
53 views

Design Question - System Integration

Guidance on good application architecture / design is not in short supply however most of the examples focus on some business object, like Customer and its behaviour and persistence. There is little ...
1
vote
0answers
62 views

Environment that enables variable constraint checking and

Currently I'm working on a system that enables users to add Tag's to available TagTypes on specific pages. For instance, we would have a TagType called "Installer" and the user wants his name ...
1
vote
1answer
63 views

Where to perform datatype.ParseString (MVC)

Using the MVC pattern, asume a simple situation where you want to send a number (for example the number of pages in a book) with a controller to a setter. Now, the set method looks like this public ...
1
vote
1answer
209 views

Designing classes the right way [closed]

I am trying to design my classes in the optimal way for the following scenario. A city has metro lines covering a number of stations.There are 4 lines represented by 4 colors.The user has to enter ...
1
vote
3answers
216 views

Decorator Pattern: can it solve issues arising from changes to underlying code?

I understand that decorators solve the problem of needing to mix and match behaviors, but it was suggested that I could use the decorator pattern to solve issues of brittleness that might arise due to ...
2
votes
1answer
72 views

Is there a limitation when using the Bloch's Builder Pattern with mandatory fields?

Background I have a class TextDrawable which draws text on top of a shape. There are a number of properties that can be set while creating a TextDrawable object. Mandatory Properties: Text Shape ...
1
vote
1answer
92 views

Best OOP pattern to use for creating a commandline SQL API for a proprietary json based company datastore

We need to create a SQL commandline tool for querying a proprietary json based datastore. I'll be using java. Any suggestions on the primary OOP design pattern I should use for building this API? ...
2
votes
1answer
88 views

Pattern to gain abstraction over assembly with no abstraction

I'm interacting with a large code base (in a single assembly) written by another department (let's call it BusinessAssembly). Precious few of the objects we need to use in that assembly use ...
2
votes
3answers
161 views

Disallow non-local storage of an object

I need to write a class in C++ that acquires a hardware resource and releases it again when it is destroyed. Basically that can be done in the constructor and destructor of the class. The difficulty ...
3
votes
2answers
168 views

IoC as service locator

I have been wondering for quite some time on some issues while using dependency injection: In a layered application, I normally inject repositories into the application service using constructor ...
0
votes
0answers
34 views

Controllers passing Request objects to backend logic that forward Request data: Good or Bad?

Currently working on a server-side front-end Scala Play app that does a lot of grabbing of HTML snippets and JSON from many other web apps before piecing everything together and sending it in a ...
0
votes
3answers
132 views

Developing “real” synchronization [closed]

I'm currently writing a email synchronizer application that synchronizes email to a sql server database. One direction is not a problem: Fetching folders from the server (with its messages) and ...
-2
votes
1answer
93 views

Learn how to write/design code in a “organic” way? [closed]

I'm an average programmer, I have not issue accomplish the most of daily task and figure out solution, instead my issue is how to design code. let me try to explain: I don't need to learn OO ...
1
vote
4answers
178 views

Design pattern name for an API wrapper class

I am writing a class that wraps (the parts of) an external API I am using. Let's take the Github API as an example. My imaginary Github class now has a fetchUser() and fetchRepository() method. When ...
3
votes
1answer
70 views

Difference between patterns: Specification, Guarding, Conditions, Monads, Validation,

I'm currently trying to get my head around a few patterns (especially the ones mentioned in the title above) that are made to address different problems and are being used in different parts of the ...
3
votes
4answers
462 views

How to force “program to an interface” without using a java Interface in java 1.6

In java 1.8 they have wonderful new "default interface methods". In 1.6 how close can we come? The goal: keep clients (using code) from being able to tell that a class is not a java interface. If ...
2
votes
4answers
300 views

Is this a commonly encountered situation in C++? Is there a pattern to handle it?

I am writing a game in C++, and something I have noticed is that I have many resource files which need to be loaded after a particular point in initialization. For example, OpenGL textures and VAOs ...
0
votes
1answer
106 views

Static methods vs Interface implementation

Here is my problem: I stared to create a e-commerce web sites info collector. So i created a parser for each site. The parser class is state less. got methods like: getItemPrice(WebElement page) ...
26
votes
7answers
6k views

When writing object-oriented code, should I always be following a design pattern?

Is there a conceivable design pattern for any object-oriented program? I ask this because recently I saw an implementation of a Door class with a Lock. It was part of a test and the answer said that ...
2
votes
1answer
78 views

Do I need EventAggregator here?

I'm learning MVVM pattern with C#, WPF and .NET Framework 4.5.1. I'm using MVVM Light framework to do it and now I have a doubt. Reading the book Windows 8 MVVM Patterns Revealed I see that the ...
0
votes
3answers
167 views

Is there a programming pattern, design pattern, or naming convention for moving data between related schemas? [closed]

I'm working on a web application that is publicly accessible. (Really) Long story short, we have two sets of tables in the database with relatively the same names and relatively the same data. The ...
0
votes
1answer
116 views

Does this diagram give a good representation of the MVVM pattern?

I am having a really hard time understanding the basic structure of the Model, View, View Model pattern. I have honestly been pretty ignorant of design pattern conventions until recently. My formal ...
3
votes
3answers
367 views

Separating Code into Smaller Files in C

I am in the process of cleaning up my code and making it easier to maintain. I am doing this by turning my 5000+ line file into separate smaller files. I have successfully created separate source and ...
0
votes
2answers
75 views

When should you create/destroy underlying object in a class that wraps it

(note: I used Java to make it easer to explain my question, but the actual language is irrelevant for this dilemma) TL; DR: I have a wrapper around some underlying class. At which point should I ...
0
votes
1answer
72 views

Strategy vs Publiser-subscriber pattern

Let's say I have a channel endpoint where I receive messages. Because I want to process messages in a different way depending on its Header property, rather than create a massive switch I create ...
0
votes
0answers
60 views

Am I following a good design thought process? Is the Abp framework overkill?

As I finish one project and start another, I have a small time window to come up with an architecture for the new. I am coming from the following design: Web applicationReceives domain models & ...
0
votes
4answers
344 views

which pattern is most intuitive for a calculator app?

The title says it all. I'm trying to build a calculator application (for self-learning purposes). The application is going to have a very common UI, with plus(+), minus(-), multiply(*) and a divide(/) ...
1
vote
1answer
109 views

Pass Event between Systems in a multi-threaded Entity-Component-System

Is there a way to pass Events between Systems in a multi-threaded Entity-Component-System that realizes the benefits of saving on system resources? I've read a german article about the ...
1
vote
2answers
120 views

How to deploy software automatically over SSH?

I am dealing with a distributed application which is going to mange a network of Linux-based servers spread among different places. Having the SSH credentials (as the most supported connection ...
3
votes
2answers
285 views

Best approach for multilingual Java Enum

I'm running into issues with an approach I am taking and am now wondering if I just started down the wrong path and should rethink my approach. Here is what I attempting. I would like to use an Enum ...
2
votes
4answers
480 views

When should something be a class? And are my chosen classes good OO design?

My background: I am new to programming. Python is my only programming knowledge. I program as a hobby, and I'm teaching myself by reading copious amounts of books. I understand enough about OOP to ...