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

In javascript, should object properties be declared on top of the function?

I learned that it's good practice to declare variables before they are used. For example: function myFunction() { var i; var j; } Does the same thing go for object properties, and is there a ...
0
votes
1answer
32 views

File validation rules

I have an application that can accept CSV files to run some operations. The files look like: CREATE USER:username,last_name,first_name,age user1,Smith,John,23 user2,Poppins,Mary,257 There are a ...
-1
votes
0answers
31 views

Which patterns to apply for “User Manager” [on hold]

I developing a social application and I neeed to create a User Manager that is responsible for managing certain types of user. A user who enters in to the system will be a new user or an existing ...
6
votes
4answers
268 views

Is Visitor Pattern valid in this scenario?

I am a beginner in Software Development, and recently I have a design problem which bothers me a few days. The goal of my task is to design a small system, which can run scheduled recurring task. A ...
1
vote
1answer
104 views

Differences in design/thought process for OO in Java and JavaScript [duplicate]

Despite sharing a similar name and syntax, Java and JavaScript are quite different. However, they both have Object Oriented features. As a JavaScript novice, the main differences that I can see ...
3
votes
1answer
61 views

Encapsulating mutable objects with special structure in Python

I am writing a library for working with special types of trees, called Foo trees. A Foo tree has very special structure. There some operations, called bar and baz, which only make sense on Foo trees. ...
0
votes
0answers
45 views

GIS Design Patterns

I am looking to implement a GIS based application for climatological purposes. I have looked at these two papers as a template for structuring my data objects - ...
-1
votes
2answers
198 views

which one is recommended object-oriented design? [on hold]

I made simple object-oriented prgram, and think about design. I wonder which one of belows is recommended object-oriented design. Most left side class is "Main" class. Black arrow means they are "Has ...
0
votes
1answer
52 views

how can the presenter or view interact with the model in the MVP pattern?

I'm learning the MV* patterns. MVP in this case. I'm trying to refactor an old android application into the MVP pattern to make things less tightly coupled, but I'm struggling one one concept. I know ...
3
votes
3answers
152 views

Design suggestions for converters in Java

I'm trying a set of converters which will convert an object to some older form. And there are different objects which are converted. By older form I mean changing the values of some fields and in case ...
1
vote
2answers
46 views

Module based project vs Normal project [closed]

I am writing code on top an established Enterprise application. I see that the application has 4 modules as shown below. -Srk -SrkEJB -SrkUtils -SrkWeb I have gone through the code and I see that ...
2
votes
1answer
43 views

What layer would an Audio Player Service fall under in a an MVP system?

I'm trying to completely overhaul an app I wrote a while back that plays audio, and I'm learning how the MVP pattern of organization works, but I'm not sure how/where an audio playback service would ...
-3
votes
1answer
45 views

Whats the best design to use for simple maths based problems like Towers of Honoi? [closed]

I want to solve an extended version of Honoi towers with the following set of rules: 1- The goal is moving all disks from tower 'A' to 'B' using 'C' as auxiliary 2- No larger disk can be put on ...
0
votes
1answer
143 views

Memento pattern: saving memento [closed]

There is one problem about this pattern that troubles me. In a situation when we have to save a state into a file, is it class Memento that should be responsible for handling this process? (for ...
2
votes
2answers
247 views

Refactoring long methods with a lot of cyclomatic complexity

I'm attempting to refactor what is becoming a very large method -- currently 350 or so lines -- that contains a high degree of cyclomatic complexity. I understand and ascribe to the theories that ...
1
vote
0answers
50 views

Tornado Framework's Design Pattern [closed]

I'm working on a article about design patterns for web applications that demand high load and performance. I'm basically trying to compare an event-based web aplication to it's correspondent ...
1
vote
1answer
46 views

Generic PHP web interface for handling concurrent updates optimistically

I'm looking in to writing a new PHP based CMS which handles concurrent edits optimistically like source version control rather than pessimistic locking like Wordpress. I want to be able to write some ...
-4
votes
0answers
23 views

Javascript Automatic Class Structuring Code [closed]

This is designed to make it easy to structure a large javascript project into its own independent classes/modules, then make those classes have easy access to their parent classes, all while keeping ...
-2
votes
0answers
58 views

OOP vs ADM Comparisom

This is the ADM equivilant to the example code given in Correct placement of Methods in OOP In this example we have resolved the Method placement question by moving ALL methods away from the data, ...
3
votes
1answer
256 views

Correct placement of Methods in OOP

Which Class should contain a method which has dependencies on multiple classes? I've coded up a specific example to avoid generalizations. In this example we have an initial requirement : ...
0
votes
1answer
88 views

AST processing and usefulness of visitor pattern

I know the visitor pattern is typically used to traverse a hierarchy of heterogeneous objects (inheriting a same abstract object) and dissociate the processing of these objects from the data within ...
2
votes
1answer
62 views

MVVM in Photoshop-like application: What object has the responsibility for composing the document?

I'm wondering how an application like Adobe Photoshop, could be architectured to conform to the C+M+V+VM design-pattern, specifically how do you handle the canvas? There would be a Model system which ...
2
votes
1answer
256 views

Should all functions be fully self-contained (is it bad practice to share a variable between functions)?

There are two ways to do the same thing (pseudo code) Define databaseHandle in the parent function, and use it as a global in this scope: function API() { function openDatabase() { ...
1
vote
1answer
44 views

Polymorphism on repository interface for local and remote operations

I'm in the process of designing a facade ApiClient class that would abstract some CRUD operations between a local database and a remote one (through a REST web app). Said ApiClient class depends on 2 ...
2
votes
1answer
85 views

Should I use the State Design pattern for only two states? Also, what if one object's state is affected by another state?

If you only have two states for an object, is it worth it to still use the State Design pattern? The context is a multi-player, turn-based game environment where there are Game "Tables" that a player ...
0
votes
1answer
65 views

Strategy pattern can use this pointer?

I want to use strategy pattern, but I wander if it is correct to use "this pointer" with the strategy pattern interface. This is required in order to get internal information which is required for ...
5
votes
2answers
68 views

Difference between class scope and object scope design patterns

Apparently design patterns have a ton of classifications. One I am struggling with is whether or not the pattern is a class scoped pattern or an object scoped pattern. Of course no documentation ...
4
votes
0answers
161 views

Design patterns for navigation between pages on mobile platforms

I'd like to ask you about the best way of handling navigation between pages/activities on mobile platforms. To be more specific - about handling state in more complex apps, about handling 'Back' ...
1
vote
3answers
121 views

Software pattern for combining properties [closed]

I have two classes that read distinct files. As an examples, two classes, sourceA or Client, and sourceB or Resources: public class Client() { public string ClientName {get; set;} public int ...
1
vote
1answer
78 views

What is a context object in relation to a web application?

I've seen the term "context" used in a few web application frameworks but I'm not sure what it's actually about. It seems pretty important and seems to be related to holding session information, but ...
9
votes
4answers
810 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
53 views

Appropriate Design Patterns [closed]

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

ClickHandler for button = strategy pattern? [closed]

If you provide a implementation of a ClickHandler interface to a button (defining some behaviour), is this the strategy design pattern?
2
votes
1answer
85 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
138 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 ...
5
votes
2answers
127 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
135 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
46 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
346 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
55 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
73 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
19 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. ...
11
votes
3answers
378 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
65 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, ...
3
votes
2answers
123 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
50 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
69 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
162 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
102 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 ...
1
vote
1answer
98 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 ...