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

learn more… | top users | synonyms (1)

0
votes
2answers
101 views

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

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
96 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
275 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
1answer
126 views

How a real MVC is different from todays MVC used in the web? [on hold]

ive heard that MVC used now in days could be called webMVC because they dont implement it like the actual MVC is, so it makes me wonder if there is a guide where i can find the real MVC architecture ...
0
votes
2answers
68 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
67 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
50 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
0answers
43 views

Abstract factory for web crawler [closed]

Here is my design for an abstract factory for web crawler. I have few web site that i want to crawl. Each site have different page version in each version of page , they will have the same product ...
0
votes
4answers
305 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
59 views

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

To clearify my question: Is there a way to pass Events between Systems in a multi-threaded Entity-Component-System? Original Post: I've read a german article about the Entity-Component-System ...
-3
votes
0answers
72 views

What do you think about code reuse? [closed]

I never do/did everything from scratch. When I'm starting a project, I'm always summarizing the problems and searching for other's people solutions. Do you want a authorization, authentication? ...
1
vote
2answers
118 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
259 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
2answers
270 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 ...
0
votes
0answers
62 views

The finer points of HMVC

I'm new to HMVC and whilst tutorials are great about dealing with the overall details of keeping modules separate and only letting controllers communicate, they aren't so great at explaining the ...
1
vote
1answer
113 views

Are CRUD operations intended to be used with collections?

CRUD operations, by definition are... interfaces that permit users to create, remove, modify or retrieve data Implementations of CRUD interfaces can come in various shapes and sometimes they are ...
7
votes
1answer
217 views

Is this a valid design pattern for a Haskell main function?

After developing several Haskell applications I've found myself rigorously segregating impure code and failable (partial) functions from their pure & total counterparts. These efforts have ...
0
votes
0answers
33 views

Efficiently extracting data from pdf with a template system?

basically allow a user to label specific text in a pdf file. Use the label information to create a template, which a script uses to extract text from specific pdf. What would be a good pattern to use ...
3
votes
2answers
126 views

To subclass or to wrap for “default” implementation?

I'm creating a toolset in Java consisting of many Natural Language Processing (NLP) tools, such as Tokenizer, POS tagger, Lemmatizer, Sentence parsing, etc. I want to put all good and publicly ...
2
votes
1answer
86 views

Should this interpretation happen in the Controller or the Model?

Imagine an application where the user is allowed to create his/her own musical scales. The user selects notes from a list, arranges them to a group and presses a button to create the scale. In an MVC ...
2
votes
2answers
99 views

What is a good design pattern to implement REST services on mobile?

It is easy to implement calls to API endpoints, then to parse JSON and handle the data - but what is a good design pattern for this? Here are some ways I have tried but I feel like there should be a ...
2
votes
1answer
41 views

Questions about UML in relation to the command pattern

http://www.oodesign.com/command-pattern.html In reading through a tutorial about the command pattern, I came across a UML diagram that seems to omit some relationships. For the following diagram, the ...
0
votes
1answer
107 views

Design pattern for modifying state and notifying the other modifiers without a loop

The idea is that I have a set of properties that represent possible options in the app. These options can be modified through a variety of different ways, such as from the UI, remotely, third party, ...
4
votes
2answers
264 views

dealing with a very large state machine in a class

I am currently implementing a class for a network protocol. The protocol uses a quite complex and extensive finite state machine. A pair of an event plus a state is mapped to a function, which does ...
1
vote
1answer
124 views

Should the Presenter depend on the View or the vice versa?

So far, I have used the MVP architecture pattern a few times. Every now and then, I wonder whether my Presenter should depend on my View or vice versa, that is the View depends on my Presenter. NOTE ...
1
vote
0answers
158 views

Client side web application architecture - best practice & patterns [duplicate]

I'm inheriting some code that takes a rather different approach to architecture than I'd have chosen myself. It consists of a HTML page, some javascript library imports and a single DIV tag. This ...
0
votes
5answers
342 views

Liskov Substitution and SRP Principle violation - how best to structure this scenario?

While learning SRP and LSP, I'm trying to improve the design of my code to comply best with both of these principles. I have an employee class that has a calculatePay method on it. Firstly, I believe ...
3
votes
2answers
186 views

What is the difference between a function and a component?

I just listened to Software engineering Radio podcast on components. Their description of components were very vague, they made them sound like lower level versions of functions. I am trying to figure ...
0
votes
0answers
50 views

ZeroMQ and Majordomo protocol

I am learning ZeroMQ and came across the Majordomo Protocol. I am wondering if I'm understanding this correctly, is the use case the same as.. for example.. the Microsoft Azure AppFabric service? ...
2
votes
1answer
112 views

Using the command pattern for a sequence of tasks

I have a 'sequence of tasks' to undertake on a zip file. It can be simplified into these steps: Validate that the file is a ZIP file and is valid Unzip the file Validate the contents are as ...
1
vote
0answers
99 views

How can I put multiple hierarchical forms in a single web page and avoid making it a mess?

We are a group of developers working on a web application that accepts forms filled and sent by our users and present it in an overall view. Our main form view looks like this: There are multiple ...
8
votes
2answers
421 views

What is a good design pattern for generating an Excel (xlsx) file in code?

See my Update at the bottom for more. I occasionally have projects where I have to output some data as an Excel file (xlsx format). The process is usually: User clicks some buttons in my ...
1
vote
1answer
137 views

In MVC design, do I use a base class over an interface?

In web MVC most designs I've seen, (just choosing model layer as an example) the domain problem class, say students, always inherits the superclass "Model." The name is irrelevant, but why do they ...
0
votes
2answers
73 views

Possible design patterns for base function with possible additions

I have various interfaces i have to implement. Let's assume ITypeA, ITypeB. They have following methods: ITypeA Connect Disconnect GetData SetData ClearData ITypeB Connect Disconnect ...
1
vote
2answers
137 views

How to let the outside world decorate my private field?

Imagine a simple Controller (as in process control) interface. I have some concrete classes, say PIDController, that implement it. I also have some decorator classes that extend these classes ...
3
votes
1answer
178 views

Redundancy caused by polymorphism

I have two chat rooms, one has administration behaviour, and one doesn't. I have factored out all of the common code into a base chat room, but the AdministerChatroom behaviour I have pulled out into ...
3
votes
2answers
350 views

What are the disadvantages of a “simple factory”?

I am reading the book »Head First Design Patterns« from O'Reilly. Before explaining the Factory Method Pattern, they introduce a Simple Factory first. They are using the example of a pizzeria. In a ...
0
votes
1answer
298 views

Does this function do one thing only?

Is the following method considered to be doing one thing only? I'm wondering about that since it takes an optional argument. public function findErrors($name = null) { if ($name) { ...
0
votes
0answers
29 views

Pitfalls of combining dependant traits and exceptions in same file as interface in php

What are the potential pitfalls of combining related class like objects (interfaces, traits, custom exceptions) in the same source file? For code reuse and only loading what I need I always separate ...
1
vote
2answers
92 views

Are there any downsides to replacing js confirm boxes with “mark record as deleted”?

I believe in the user experience of always having a confirm pop-up for deletions. However (though we're very used to it), a separate small pop-up window is not ideal and for users on different ...
0
votes
1answer
73 views

The ViewController design in iOS vs MVC in tradiational web apps design

As I came from the background of webapps and move to iOS programming, I am wondering why we can't just apply the MVC design approach to native apps, i.e. in iOS, the view and controller are tightly ...
1
vote
0answers
107 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 { ...
4
votes
5answers
386 views

Questioning one of the arguments for dependency injection: Why is creating an object graph hard?

Dependency injection frameworks like Google Guice give the following motivation for their usage (source): To construct an object, you first build its dependencies. But to build each dependency, ...
3
votes
1answer
90 views

Augmenting functionality of subclasses without code duplication in C++

I have to add common functionality to some classes that share the same superclass, preferably without bloating the superclass. The simplified inheritance chain looks like this: Element -> ...
2
votes
1answer
86 views

Finding a way to simplify complex queries on legacy application

I am working with an existing application built on Rails 3.1/MySql with much of the work taking place in a JavaScript interface, although the actual platforms are not tremendously relevant here, ...
2
votes
1answer
108 views

Is there a pattern or best practice for passing a reference type to multiple classes vs a static class?

My .NET application creates HTML files, and as such, the structure looks like variable myData BuildHomePage() variable graph = new BuildGraphPage(myData) variable table = BuildTablePage(myData) ...
3
votes
1answer
153 views

Project structure: where to put business logic

First of all, I'm not asking where does business logic belong. This has been asked before and most answers I've read agree in that it belongs in the model: Where to put business logic in MVC design? ...
6
votes
2answers
187 views

Is this a valid implementation of the repository pattern?

I've been reading up about the repository pattern, with a view to implementing it in my own application. Almost all examples I've found on the internet use some kind of existing framework rather than ...
0
votes
3answers
140 views

How to change the state of a singleton in runtime

Consider I am going to write a simple file based logger AppLogger to be used in my apps, ideally it should be a singleton so I can call it via public class AppLogger { public static String file = ...
0
votes
1answer
150 views

Should I limit my type name suffix vocabulary when using OOP?

My co-workers tend to think that it is better to limit non-domain type suffixes to a small fixed set of OOP-pattern inspired words, e.g.: *Service *Repository *Factory *Manager *Provider I believe ...