A design pattern is a general reusable solution to a commonly occurring problem in software design.
-1
votes
2answers
64 views
multiple uses for original software [on hold]
How does a programmer figure out multiple uses or applications for the original software he/she has written. I am an artist who has designed a RPG game with several different and separate applications ...
2
votes
1answer
59 views
How does the Aggregate Root concept and the Repository Pattern solve DRY in database operations?
If I have ten classes, and they all need CRUD operations, how does an Aggregate Root and the Repository Pattern solve me having to write lots of boilerplate code (the DRY)?
Take the example of a ...
-2
votes
0answers
43 views
Software package metrics
I am looking for a metric similar to that presented by Martin in "Agile software development: principles, patterns, and practices" to measure the abstractness and instability of software packages in ...
1
vote
2answers
119 views
When should the builder design pattern be used?
I am currently learning about various object oriented design patterns. I came across a pattern called the builder pattern which is basically where you build a complex object through the use of ...
5
votes
2answers
173 views
Is there a good standard approach for execution of a long list of methods/functions?
I am creating some software that runs on a machine that performs multiple tests on a product that is built at my company. I am also trying to improve my coding and I have been recently researching ...
2
votes
1answer
126 views
Is mixing Builders and Factory pattern a good idea?
I have an object Carconstructed using builder pattern.
Issue was a lot of code redundancy.
Car.Builder builder = new Car.Builder("Mercedes");
builder.numDoors(carConfig.getNumDoors()
...
1
vote
3answers
105 views
Should a singleton be used in the following case?
Building an android app that displays a list of of Dog objects in Activity A. When you a tap a Dog in the list, that single dog is accessed by Activity B, Fragment B, and 3 other classes.
After that ...
2
votes
0answers
118 views
Is there a name for the counterpart of the lazy loading pattern?
Definition of the lazy loading pattern from Wikipedia:
Lazy loading is a design pattern commonly used in computer programming to defer initialization of an object until the point at which it is ...
4
votes
5answers
151 views
Pattern to detect when all but one reference (in a managed language) are destroyed?
In my application I have a class, and each instance of this class shares part of an unmanaged resource. Sharing is facilitated by a manager object.
When an instance is destroyed, the manager should ...
3
votes
1answer
61 views
Complicated Data Constraints — Business Rules or Database Constraints?
I inherited a project that includes a database (MS SQL Server) that was filled to the brim with bad data. I've manually cleaned it up, which was a painstakingly tedious process and am working on ...
1
vote
1answer
51 views
Is it worth encapsulating messages shown to a user from a repeated operation?
For example, say I have a service that kicks off some operation, such as running a cron-job. Then, it returns whether it not it was successful.
The code might look something like
var service = new ...
2
votes
2answers
217 views
how to create generic class structure
I have a requirement where user selects a ReportType from a dropdown and hits download button. Based on his type chosen, the system should generate a report. Right now I have only report type that is ...
1
vote
1answer
72 views
How to decide level of Single Tenancy vs Multi Tenancy for application
How would one implement a multi tenancy application structure with the following technologies:
Multiple SQL Server Databases (One per tenant)
Asp.Net
Entity Framework
Active Directory and possibly ...
0
votes
2answers
85 views
Preserve MVVM while using XAML resources
Context:
I'm creating a WPF application using MVVM. I have a Page which displays a status informing what task the app is performing on Background.
I have a container, and bind its Content to an ...
3
votes
1answer
80 views
Separating functionalities in a food delivery app
I am creating object oriented design for a simple app through which users can order food from restaurants. User can browse nearby restaurants, explore menu, add items to cart, and finally checkout.
...
5
votes
4answers
240 views
Singleton without any state
I worked on a project and found a working solution, but now I got some questions on how I solved some problems in the code. First of all, I am no expert in design patterns, but I know the (anti-)...
1
vote
1answer
65 views
Visitor pattern and collecting visited data
I have a few operations to make over many similar elements.
I would like to collect data from each element firstly and next bind all the data to an object (binding is expensive operation so I need to ...
1
vote
2answers
258 views
smelly C# pattern - refactoring advice please
I have added this method to a C# class:
public bool CanAddLeave(Leave newLeave, out AddLeaveResult result)
{
result = _repository.CreateSqlQuery("CanSendLeaveRequest ")
.SetParameter("...
0
votes
0answers
55 views
Separation of concerns and data divided into multiple API endpoints
Is it possible to separate concerns if data is divided into multiple API endpoints ?
I want to integrate with a following type of REST services:
GET /product/get
{
"id":1,
"fields":[
{
...
3
votes
3answers
196 views
Should I reduce event listeners by making functions more complex?
An example would be if you had multiple inputs, each of which effect a completely different process, (perhaps one changes a div's width, while another sends ajax request for predictive search), would ...
3
votes
1answer
86 views
Convert class to another class and vice versa
I've a domain class named Campaign.
Class Campaign {
public long CampaignID { get; set; }
public string CampaignName { get; set; }
public DateTime StartTime { get; set; }
public ...
1
vote
0answers
38 views
Analysis of the intersections of data sets (complex sports betting markets)
I am looking for a methodology, design pattern or other research that would be appropriate for analysis of multiple numerical elements of data sets, with the analysis based on a series of definable ...
2
votes
1answer
234 views
Handle Named constructors with factory pattern
In my current project I'm refactoring the code to get a DBAL. I have a class Entity that is the base class for all classes that model a database table. So there are several classes that inherit from ...
5
votes
2answers
107 views
SAX-like parser: what is this pattern called?
I wrote a parser for a certain type of binary file with recursive structure. I made its API to be similar to SAX, that is:
the parser accepts an object of a specific interface,
this interface has ...
7
votes
3answers
242 views
How to perform input validation without exceptions or redundancy
When I'm trying to create an interface for a specific program I'm generally trying to avoid throwing exceptions that depend on non-validated input.
So what often happens is that I've thought of a ...
1
vote
2answers
131 views
Design patterns for smart containers
Suppose that there are multiple classes (let's call them Container-s) that have somewhat similar structure. They are smart containers for some other Foo-s classes.
These Container-s have:
[1] A ...
12
votes
5answers
553 views
Find nearest best fit for circle
Below is an example image, if I have a point of the white dot in the middle and I want to find the nearest possible location for the blue circle (which is obviously at the location where I placed it) ...
3
votes
3answers
135 views
“Factory Method is a specialization of Template Method”. How?
Similarities and differences between the two:
Template Method
Relies on inheritance.
Defines the steps of an algorithm, and leaves the task of implementing them to subclasses.
Factory Method
...
3
votes
2answers
114 views
How do I manage dependant values without running the same computation twice?
I am working on an application that is essentially a calculator, not the handheld calculator but more of a spreadsheet. It will take many inputs across different views and show the outputs all over ...
5
votes
1answer
135 views
Repository Pattern and database queries
Having read others posts, it already seems to me that the concept "repository" and "database" do not go well hand in hand, as they are meant to be completely separate concepts.... but I'll ask the ...
0
votes
0answers
35 views
Impl Pattern Question with respect to older post
With respect to this post
What's is the point of PImpl pattern while we can use interface for the same purpose in C++?
Any recommendations on how to best provide multiple implementations of ...
6
votes
4answers
1k views
Why aren't OOP design patterns included in the standard libraries?
I have a question similar to this other question
Why aren't design patterns added to the languages constructs?
Why isn't there java.util.Singleton and then we inherit it? The boilerplate code ...
-1
votes
2answers
103 views
Design pattern name for thin wrapper for unit testing purpose
Assuming I'm using a class from third party library that does not implement an interface, for example:
class ThirdPartyLibClass {
void DoThis() { ... }
void DoThat() { ... }
}
I want to ...
2
votes
0answers
71 views
Composite and Observer pattern implementation
I'm learning Composite and Observer design patterns and I have created a FileSystem class where I define Node, Folder and File as a composite relationship. Now I want to implement Observer pattern so ...
0
votes
1answer
61 views
In ASP.NET MVC Core do CRUD operations follow the Repository Pattern?
In some MVC frameworks I've used the Model has the method and SQL in the Model so that if you call the controller, it invokes a method on the model class (say Products), and it returns the data. In ...
3
votes
3answers
225 views
How to describe the architecture of a software product?
I'm working on my CS Masters thesis at a company which does user interfaces in the field of embedded devices. As part of that I am developing a library for integrating a certain device. My C++ library ...
4
votes
3answers
154 views
Strategy for avoiding defensive copies while keeping correct encapsulation
I want to keep a dependency decoupled, but at the same time, once it's passed to the constructor, I want to allow changes only through Whatever (in the following example) because changing the ...
0
votes
0answers
57 views
How can i maintain clients data on browser side ? Like their selections and userid's
How can login of a particular client can be maintained in browser side.
Which concept can i use for this? I have to maintain their session login even after client closes the browser till he/she opens ...
-1
votes
2answers
95 views
Design - Sub-classes with similar implementations
I'll try word this as succinctly as possible.
I currently have an object called a StoresAdaptor which inherits from a base class ERPAdaptor, that takes a Stores object and pushes it into a 3rd party ...
3
votes
1answer
45 views
Implementation of observer pattern with one observer/multiple publishers and multiple events?
I'm in a bit of a tricky situation where I need to use the Observer pattern but I don't really know the best way to go about it.
Here's a quick briefing on my application:
I'm implementing a GUI ...
0
votes
2answers
89 views
Critique on design principle and validity of such in general
I was hoping you could give some feedback on an idea I had for designing functions.
I am trying to think of a unifying principle for choosing what functions should return. The specific project is ...
5
votes
2answers
216 views
How to avoid two step initialization (C++)?
I'd like to follow the RAII(resource acquisition is initialization) idiom throughout my code but I'm also doing the template pattern where I'm developing generic versions of my classes and using them ...
4
votes
6answers
410 views
Command Pattern vs Functional Decomposition
Android developers probably are familiar with Ceja's Clean Architecture, where use cases are classes that implement the Command Pattern.
Shvets defines the pattern intents as follows:
Encapsulate a ...
1
vote
2answers
62 views
Modeling Composite Design Pattern
I'm using Java Eclipse EMF to model my Composite Pattern. What would be the right UML representation to model aa new class (Root) which implements a unique root directory. This is the original ...
2
votes
1answer
99 views
Swift-like extensions in Java using inheritance
After picking up some Swift skills with Java as my strongest language, one feature of Swift that I really like is the ability to add extensions to a class. In Java, a pattern I see very often is ...
0
votes
1answer
151 views
Does my file system implemented using the Composite pattern require a singleton?
I'm exploring composite pattern to write a file system, one of my requirements is to create a unique root element in this case a directory, similar to Linux System ('/'), I have seen many examples of ...
4
votes
3answers
89 views
Using Bridge and Strategy together, is my idea correct/useful?
I'm working on a website project for a software engineering course. This site will be using a database to store data, currently through JDBC and MySQL.
Now the first thing I would want to do, is use ...
-1
votes
0answers
91 views
Different server side languages vs 1 server side language
I am building an application where people can chat with each other. So I have an node.js script running with socket.io, no problems here.
But I need to register devices, and the relation between ...
5
votes
2answers
119 views
What is the common procedure when producing jump targets in bytecode?
Over the course of the past few days, I've been trying many different methods for correctly calculating jump targets in bytecode, but none have been practical or reliable. Furthermore, the methods I'...
0
votes
2answers
60 views
How to design functions when they need to work with “normalized” and “non-normalized” data
I'm working on a web application that stores identifiers, such as usernames and email addresses in a "normalized" form and a "non-normalized" forms, for a variety of reasons. For example, an username '...