Tagged Questions
A design pattern is a general reusable solution to a commonly occurring problem in Software Design.
0
votes
0answers
15 views
Paradigms for changing data types in a large java project
I have a fairly large scale java project that is in the process of being updated to integrate with a new service. The old service uses Id columns in the form of Long and the new Service uses String. ...
0
votes
1answer
27 views
Send string variable from Activity to AsyncTask Class
I need to send a string variable from my main activity class to the AsyncTask Class and use that string as part of the url to make the api call.
I tried using Intent and share preferences but ...
0
votes
1answer
9 views
Circular Dependencies with Dependency Injection
I have a solution with the following project:
Core/Services/Services Interfaces/Infrastructure/Web UI
In the Infrastructure project I have the following folders:
-Data
-IoC
-Logging
The data folder ...
0
votes
1answer
18 views
Pattern recognition for data alignement and data difference
I have some data that can be used as "reference" and I'd like to realigned new data using the reference.
Let's say I have this:
and I want to compare it to
I would like to be able to recognize ...
3
votes
4answers
38 views
JavaScript constructor patterns
I'm looking for a sane solution to JavaScript's only-one-constructor problem. So let's say we have a class Point and we want to allow object creation from coordinates.
I'm gonna ignore type-checking ...
0
votes
1answer
19 views
Is this a correct use of the prototype design pattern in Swift?
func tableView(tableView: UITableView!, heightForRowAtIndexPath indexPath: NSIndexPath!) -> CGFloat {
let cellPrototype: NDCustomTableViewCell = NDCustomTableViewCell()
return ...
1
vote
0answers
34 views
Is Business Validation in a Value Object acceptable?
We have a multi-tenant application which, for better or worse, handles the the distinction between different customers with lots of if-then-else statements all over the place. I have a particularly ...
1
vote
1answer
32 views
How to communicate if stack allocated references are allowed as argument?
I am looking for a standard way to tell the user of a C++ API whether a constructor (or method) accepts objects allocated on the stack as valid arguments. Is there a pattern (e.g. a special ...
0
votes
0answers
26 views
Async Constructor Javascript
It's in context of PureMVC Javascript port (www.puremvc.org) but it can be a general question as well.
Under Inheritance, when a child object extends the parent, the parent needs to be constructed ...
0
votes
1answer
14 views
Design suggestion for Add / Edit scenario in Angularjs
Here is my scenario. I have a addPersonController and editPersonController with addPersonView and editPersonView respectively. In both controller, I am uploading the Person's picture. My upload ...
0
votes
0answers
31 views
Database Process Rollback Design Pattern
I am using a database Script (oracle Request) that applies changes to many tables, sometimes I need to rollback the process, and it is a headache to do it manually, so I was thinking to do a custom ...
0
votes
0answers
14 views
Applying user security in Cached Master Data
In current application we have Master Data Cached at application level using EH Cache, but in recent requirement I need to extract user authorized data from the cache as this same Master Data can be ...
-3
votes
1answer
52 views
How do I find a repeating set of cells in Excel?
I have a set of cells like : Each alphabet is in seperate cell
A B C D E F
D E F G H D
H J E R T U
X Y M N N O
There are around 2000 to 3000 rows like this.
In same worksheet, this set has ...
1
vote
2answers
40 views
Inheriting a python class while adding a property
I'm running into a problem trying to inherit a python class while adding a property. To illustrate, define the following classes:
class A:
def __init__(self, prop, x1, x2):
self.prop = ...
1
vote
2answers
46 views
Design Pattern to output separate different files from same input parameter
I have this Food class with 20 properties. I need to use this Food class and output 3 different files, using variations of these 20 fields. For example, File 1 contains output only 8 fields. File 2 ...
-2
votes
1answer
71 views
generic programming in java with dynamic nature and fully customizable [on hold]
I am working on an engineering data presentation and management project.
The nature of our project should be customizable because we might have some similar entities with few more or less attributes. ...
-3
votes
1answer
25 views
Choosing the right design pattern for execution on a dictionary key
Which design pattern is preferred?
For a dictionary d that may or may not have a key named 'foo'...
Pattern A
if d.get('foo'):
func(d.get('foo'))
Pattern B
foo = d.get('foo')
if foo:
...
1
vote
2answers
68 views
Understanding the strategy pattern
I have looked all over the web for good examples of the strategy pattern, but the examples I find are way to simplified.
I want to implement MyMatrix class.
for this, I'm using the strategy pattern, ...
0
votes
1answer
59 views
Aggregate & Aggregate Roots
I'm currently trying to define certain base classes & interfaces to use them in DDD & CQRS projects, however I'm struggling with the definition of aggregates and aggregate roots.
The blue ...
0
votes
0answers
28 views
Surprising behaviour when trying to prove a forall
Consider the following SMT-LIB code:
(set-option :auto_config false)
(set-option :smt.mbqi false)
; (set-option :smt.case_split 3)
(set-option :smt.qi.profile true)
(declare-const x Int)
...
-2
votes
1answer
33 views
Which design pattern can be used for web pages with similar functionality
There are 3 webpages Employee.aspx,EmpSal.aspx,EmpQual.aspx.The Employee details can be found only on a single table with the columns EmpId,EmpName,EmpBasicSal,EmpGrossSal,EmpQual,EmpDesgn.Now ...
1
vote
0answers
41 views
dom references and global variables localization. does it make sense?
Does it make more efficient to make a local( and private ) variables / DOM references if you use them in backbone view?
var app = {};
(function( window, document ) {
var variable = 'some data';
...
0
votes
3answers
52 views
Entities depends upon Repositories abstractions
How to make entities lazy load its relationships?
For example: Post and Comment models, where a Post can have 0 or more Comments. How to make the getComments() method on Post entity lazy load its ...
0
votes
1answer
30 views
iOS Swift: UITapGestureRecognizer and Storyboard
I am a novice at iOS programming, obviously a novice at Swift (as it is new), and a dabbler at best in programming overall over the past ~35 years. I have, however, worked for the past 20 years as a ...
0
votes
3answers
31 views
Should I pass information inside Observer Events
I have an Event Login. I plan to populate that event with information such as this:
// Class A.
Login login = new Login();
login.setUsername(userName);
observer.notifyEvent(login);
The idea is for ...
1
vote
1answer
42 views
Java Swing + MVC pattern in a modular way
I'm developing a Java Swing application and I'm following the MVC approach. I've a controller and then I've my model and my view.
Model and View only communicate via the Controller. The Controller ...
0
votes
1answer
34 views
Pattern evaluater
I have some a string which needed to be evaluated in following pattern -
Input => String testTree = "(1(2(4)())(3))";
Output => {1,2,3,4,*,*,*}
Input => String testTree2 = ...
0
votes
0answers
11 views
HTTP codes & headers to determine behaviour
Can anyone give (or point to) a guide to various ways that http codes and headers are used to determine a response? I am interested in patterns used by app frameworks (e.g. Django), browser plugins or ...
0
votes
3answers
43 views
Javascript module pattern import
I am trying to understand Javascript module patter, but I can't figure out the difference between parameters added to the anonymous function and parameters added at the end. So can someone please help ...
0
votes
1answer
27 views
Correct pattern for Android app using fragments
I'm currently developing a simple Android app which is basically a list of items which when clicked display a second screen with details.
Here's the app hierarchy:
---> MainActivity.java
...
0
votes
0answers
26 views
Callable Future, How can I shutdown and restart ServerSocket Callable threads from an executing class that hands off successful socket connections?
I would like to execute server threads that return sockets when successful incoming socket connections are made, and are easily shut down... simply and cleanly.
ServerSocketThread.java :
Creates a ...
1
vote
3answers
57 views
Can static properties return new instances of objects/classes in c#
I am building an application in ASP.NET MVC 4. I am creating a class (similar to Factory type) that will return me instance of my service classes which i have made in BAL Layer. I want to declare ...
1
vote
2answers
48 views
Pubnub many private chats in ios
I am developing an ios app like Tinder. Users can chat only in private 1:1.
Should I have to open one channel for every single "match"? Is this the correct design pattern for this case study? What ...
1
vote
0answers
23 views
Nice approach for redirecting request to correct application instance?
This is not a question but an effort to get the comments from experts out there.
Let’s consider, that there are 2 web applications, namely, “SPRING-WEB-APP-1” & “SPRING-WEB-APP-2”.
Now, both of ...
0
votes
1answer
26 views
default value in the function
Noticed two patterns to set a default value for an argument of the function:
function fn ( val ) {
val = val || 'default'; // (1)
val || ( val = 'default' ); // (2)
}
Generally I use #1, ...
0
votes
0answers
29 views
Multiple service layer interface implementations
Folks, we have a web application for which there is a service layer interface. Recently we were told that we need to make this more modular such that we need to support a new enforcement technology ...
0
votes
1answer
20 views
Why using interface for Presenter in MVP?
I am going to learn MVP pattern using Professional ASP.NET Design Patterns. In presentation layer chapter it learn how to apply MVP to asp.net. The code for presenter is:
public class ...
0
votes
2answers
44 views
Elegantly Making an In-Process State Visible Elsewhere in Code [on hold]
In my code I sometimes set a boolean to indicate a state - and flip the value to indicate that the state is complete:
private bool _skipEvent;
public ChangeTextSkipEvent(string value)
{
_skipEvent ...
1
vote
1answer
46 views
How does CQRS and DDD work together?
For most of my applications, I use a straight-forward DDD approach which means separating the architecture into the common layers of the Onion Architecture, decapsulating the domain from the ...
0
votes
1answer
13 views
General Design Requirements to make an application “pluggable”
I am wondering if there are programming language agnostic paradigms, models, patterns, etc for designing an application for which the author intends to allow third party developers to write plugins.
...
0
votes
0answers
18 views
DAO design pattern interface
Is this design pattern only good for one interface, cause all I can find is talking about interface implemented it by a class?
like the site
...
0
votes
1answer
22 views
Restricting a layer in Maven Project
We are developing Service Oriented Architecture in Model, DataAccess, Service and Services API layering Architecture, where as I have implemented following layered architecture in place for dependency ...
0
votes
0answers
16 views
One view with different models: good practice or not? (MVC)
So I have two models (pseudocode):
class Photo
string name
string src
class History
Array<Photo> photos
And one view (pseudocode):
class PhotoView
Photo model
function ...
4
votes
4answers
70 views
Conservative IDisposable marking on interfaces
In a situation where implementations of an interface may or may not need to be disposed of, is it a good idea to require that all implementations must be disposed of by marking the interface itself as ...
0
votes
0answers
27 views
What pattern is(are) often used together with the Abstract Factory pattern [closed]
Abstract Factory same as catalog. But I don't know it used together with? and why?
0
votes
1answer
52 views
Best way to manage messages to show users in an application [closed]
I have a desktop application using winform and C#. The application does not have to use any database. I have to display different types of messages such as error, warning, information, notification ...
7
votes
2answers
95 views
Hypermedia-friendly REST pattern for creating and updating a resource
I am trying to design a RESTful service that makes a good use of the Hypermedia.
Preferably, the user agent should only know the root URI in order to be able to explore all the functionality of the ...
4
votes
1answer
145 views
Other alternatives to virtual inheritance?
This is a classic example of virtual inheritance in C++ (copied from cprogramming.com):
class storable
{
public:
storable(const char*);
virtual void read();
virtual void write();
...
0
votes
0answers
15 views
java android nanohttpd - proper way to copy file uploaded from the temporarily storage to internal storage
A related question was asked here
move file uploaded from nanohttpd's Temporary directory to SD card
the reference questioner asks for copying an nanohttpd uploaded file to external sd card. ...
1
vote
2answers
65 views
one button click disable others button in wpf
I have an application with 2 tabs which are A and B. Both of the tab has 2 buttons. Besides out of the tab got 1 OK button. (refer to screenshot)
I have 3 view models, which are SampleApplication, ...