Questions about problem solving and planning for a solution through software design.

learn more… | top users | synonyms (1)

2
votes
2answers
221 views

Does it make sense to have a user specified thread limit?

I'm developing a C++14 application and would like to take advantage of the new multithreading features, in particular std::async. I have seen a number of applications which allow the user to specify ...
0
votes
2answers
192 views

Efficient Repeating Alarm Clock in Low Level Language like C

I was thinking about it and I was curious as to how one would code an efficient repeating alarm clock in C? Would you set an alarm time and then offset the time with the ms time equivalent of a day ...
3
votes
4answers
239 views

Is there a reason for support multiple different releases?

I have a discussion with my team recently and I heard a suggestion for deploying multiple releases. Such as version (newest) and version (old). But I am thinking what would be the reason for customer ...
2
votes
4answers
235 views

Handling Multiple Collections in C#

I'm currently trying to learn C# and want to enhance my understanding of Object Oriented Programming (OOP). I'm hoping to accomplish this by experimenting with a small program that keeps track of my ...
1
vote
0answers
54 views

Universal Modules GUI Design

PROBLEM: GUI built above database entities usually consist of creator window (pane etc.), editor window, maybe grid or other view window. To represent an entity for user it usually requires building ...
2
votes
3answers
148 views

How can I store incomplete records but enforce data correctness?

I'm in the planning/design stages of a new project, and I'm having trouble coming up with a good way to handle one of the requirements: Users must be able to create a new record and save it as ...
6
votes
1answer
171 views

Software design: recommend approach to avoid slicing/type erasure here

Here is a concrete minimal example to formulate my question : In small ball game, you have a physics engine that moves the objects regularly: void move(set< PhysicalObject* > objets, Duration ...
5
votes
1answer
179 views

Architecture for Web application to monitor remote servers

So I'm a relatively new programmer, attempting to create a web application (ASP.net) to display the system information (E.G. Status of windows services, disk & resource usage and errors in event ...
0
votes
1answer
55 views

Packages : opposing forces of reusability and developability

In choosing the classes to group together into packages, we must consider the opposing forces involved in reusability and developability. Balancing these forces with the needs of the ...
3
votes
3answers
139 views

How do you test a selenium framework?

I have a very large selenium test framework I use to test a web application. It it built around a page-object pattern. This week I fixed a bug in a low level piece of the framework, but it broke many ...
3
votes
3answers
246 views

Single Responsibility - is this class doing too much?

I'm redesigning one of my programs which performs certain actions on processes of interest (known as "Monitored Processes" in my program). Some actions I always need to do on those processes are: ...
9
votes
1answer
331 views

Enum with a lot of boolean properties

I'm currently working on a webapp where we often need to condition some server logic based on the page that is going to be returned to the user. Each page is given a 4-letter page code, and these ...
121
votes
5answers
8k views

What are good habits for designing command line arguments?

While developing the application I started to wonder - How should I design command line arguments? A lot of programs are using formula like this -argument value or /argument value. Solution which ...
1
vote
2answers
150 views

Parameterization vs subclassing

Example taken from : Agile software development : principles, patterns and practices A new employee is added by the receipt of an AddEmp transaction. This transaction contains the employee's name, ...
1
vote
1answer
150 views

Making more than one instance of factory that is supposed to be singleton

However, there are some classes that should have only one instance. Sometimes they are factories, which you can use to create the other objects in the system. If more than one factory ...
3
votes
2answers
159 views

How unit test service method that use repository method

For service methods that call repository methods to interact with database how could I unit test these service methods? For example, public function updateSlideshow($data){ // do some logic ...
2
votes
3answers
244 views

C++ Virtual destructors used only when there are virtual functions

This is from Effective C++ (Meyers): Classes not designed to be base classes or not designed to be used polymorphically should not declare virtual destructors I don't understand why ...
3
votes
2answers
97 views

Is it a bad idea to put externally dependent logic in ORM classes?

Case in point in Entity Framework, but this is a design question which has applicability to any ORM. In the current application we have a couple of ORM data classes which do stuff not directly ...
9
votes
2answers
475 views

Interface Segregation Principle: What to do if interfaces have significant overlap?

From Agile Software Development, Principles, Patterns, and Practices: Pearson New International Edition: Sometimes, the methods invoked by different groups of clients will overlap. If the overlap ...
4
votes
1answer
85 views

How does an product order payment works during a race condition?

This is a pretty generalized question which I am asking. Scenario 1 I have a product 'Pen' which has a quantity of 1. Now 2 users a and b has come to buy the product.User 'a' clicked on buy now and ...
26
votes
10answers
3k views

Given a herd of horses, how do I find the average horn length of all unicorns?

The question above is an abstract example of a common problem I encounter in legacy code, or more accurately, problems resulting from previous attempts at solving this problem. I can think of at ...
2
votes
1answer
90 views

How to represent data objects gradually getting augmented in a pipeline [closed]

I'm working on a Scala data-processing program. Essentially we start with a collection of many small data objects, say, (eventId: String, basicInfo: Basic) and gradually filter out some objects and ...
1
vote
1answer
80 views

Personal pages domains architecture

We're looking to add personal pages generator for our users, which is simple enough while all of them are on our domain. We also want to enable them to purchase their own domains through us, and serve ...
9
votes
2answers
199 views

Programming to Data Oriented Interfaces

There is a portion of our codebase written in the following style: // IScheduledTask.cs public interface IScheduledTask { string TaskName { get; set; } int TaskPriority { get; set; } ...
6
votes
3answers
306 views

Alternative to Anemic domain objects (Simple example provided)

I want to model (TV)Events and Reminders and I’m wondering what’s ‘the best’ way to model this. The requirements are roughly When an Event has no Reminder, a Reminder can be created When an Event ...
16
votes
8answers
3k views

Refactoring a long method which is based on large number of switch cases [duplicate]

We are using Java as a backend development language. One year back, we wrote a method which uses switch cases based on Enums values. Since we are continuously adding enum members and according adding ...
16
votes
6answers
2k views

When is a circular reference to a parent pointer acceptable?

This Stack Overflow question is about a child having reference to its parent, through a pointer. Comments were pretty critical initially of the design being a horrible idea. I understand this is ...
6
votes
3answers
1k views

How to solve circular dependency?

I have three classes that are circular dependant to each other: TestExecuter execute requests of TestScenario and save a report file using ReportGenerator class. So: TestExecuter depends on ...
24
votes
6answers
3k views

Is there a design pattern to remove the need to check for flags?

I'm going to save some string payload in the database. I have two global configurations: encryption compression These can be enabled or disabled using the configuration in a way that either only ...
2
votes
1answer
106 views

Pass request as argument to service client vs. pass service client as argument to request [closed]

I need a design recommendation: I have a class that send a http request via another class WebServiceHandler() I am hesitating between the following two implementations, which one to choose?which one ...
2
votes
1answer
98 views

Persistence Strategies - Filling a cache strategy

Let's say I have an interface IDataAccessObject<TSource> with CRUD methods to access a data source. I have an implementation StrategyDataAccessObject<TSource>, which uses an strategy ...
21
votes
5answers
1k views

Implementing an interface when you don't need one of the properties

Pretty straight-forward. I'm implementing an interface, but there's one property that is unnecessary for this class and, in fact, shouldn't be used. My initial idea was to just do something like: int ...
3
votes
1answer
110 views

Does my design break modularity and loose coupling?

I want to know if my implementation is modular and loosely coupled such that pieces can be replaced easily. Any concrete class that extends the abstract class HexGridLayout will be expected to ...
6
votes
3answers
157 views

Overriding Equals in an unbrittle way

I have a class WorkflowItemSearchCriteria whose instances represent a set of values and references that will be used to return a filtered result set of workflow items based on the given search ...
4
votes
1answer
104 views

Mobile app architecture to improve speed and reduce data transfer

Business Context of the Problem Our iphone app allows users to pay merchants and earn rewards. Users can also do things like: View transaction history View their points and available rewards, or ...
2
votes
0answers
35 views

Should my application call statsd directly or should I call statsd based off logs?

I'm planning on incrementing counters in statsd based of various events within my application. I have logging in place for these events. So, from my viewpoint I have two options: Update the ...
1
vote
1answer
69 views

How can I create a client for a service without hiding the parameters needed for each endpoint?

I'm creating a client to a third-party soap web service in my application. Here is the way I'm thinking of doing it: Create a ClientFactory that makes a client based on the wsdl file, and sets ...
0
votes
0answers
70 views

Compute the permutations for a set of numbers and then run each to find every possible schedule that fits a client constraints

I am building a Java program that computes the permutations for a set of numbers and then runs each of those permutations to find every single possible schedule that fits a client constraints. The ...
0
votes
0answers
22 views

Which design pattern for interaction with miscoded project [duplicate]

I am actually working on JavaEE application (Spring, Hibernate). I have an old project which is not well coded. I have to not modify any line of code on it. And I have to add classes that uses this ...
0
votes
2answers
187 views

DAO design for writing big XML file on database

I am currently working on JavaEE application (Spring, Hibernate). I have to put a big XML file (more than 1 gigabyte) on a relational database (Postgres). The application does not use batch ...
3
votes
3answers
163 views

How to refine the architecture, look for better solutions and not to spoil relationship with the team?

TL;DR What are the good practices of iterative search of a better solution? Well, if I knew everything in advance and could immediately suggest 146% correct solution for a given context, I'd ...
4
votes
1answer
61 views

Adding permission levels in Rails

So I'm making a bug tracker to help me learn Ruby on Rails. My current setup is something like this: Each Project has_many :metadata and has_many :permissions, through: :metadata. Also some other ...
3
votes
2answers
157 views

When rewriting medium to large applications, which of these approaches are useful?

Despite Joel's missive that software rewrites are to be avoided under pain of death, it is still fairly common place. A lot of the existing software is good, but here and there, parts of it niggle, so ...
4
votes
3answers
118 views

Drawbacks of a master error handler?

I'm thinking that I could simplify my life by making an exception handling class that I can just ship all exceptions to and it will handle appropriately. Ideally: def dostuff(): try: dothis() ...
5
votes
1answer
183 views

What is the most efficient way to implement a RESTful client app?

I am working on a web application for ranking some products based on some factors. The user send a search query to 5 restful webservices which by their turn send a response in a JSON format and ...
2
votes
0answers
19 views

What reasons would someone separate instantiation and data loading? [duplicate]

I was wondering what the purpose of separating the instantiation logic and the data loading logic of a class that loads data into memory if the class is a one time use. Here is an example of what I ...
1
vote
1answer
174 views

Are decorators/annotations the result of bad design decisions?

Talking generic, there are programming languages who make more or less use of annotations and decorators. Be it to add type information to variables in a dynamically typed language or to add ...
25
votes
1answer
1k views

Is “StringBuilder” an application of the Builder Design Pattern?

Is the "Builder" pattern restricted to addressing the "telescoping constructor" anti-pattern, or can it be said to also address the more general problem of complicated creation of immutable objects? ...
16
votes
3answers
1k views

Legitimate “real work” in a constructor?

I am working on a design, but keep hitting a roadblock. I have a particular class (ModelDef) that is essentially the owner of a complex node tree built by parsing an XML schema (think DOM). I want to ...
8
votes
4answers
307 views

Best strategy for reporting progress to the UI - how should the callback happen?

Sometimes the user starts an extended technical operation that takes a while to execute. In these cases, it's usually nice to display some kind of progress bar, along with information about which task ...