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

learn more… | top users | synonyms (1)

2
votes
1answer
458 views

Thoughts on having a generic, reusable grid viewmodel

I'm developing a wpf-based application and I'm currently struggling to find the best way of supporting a recurring scenario in it. This app uses grids a lot. There are a bunch of features I want in ...
2
votes
2answers
76 views

How to create an efficient implementation of a dictionary of synonyms?

How do I create a dictionary of synonyms that is efficient in terms of retrieving synonyms of a word? Basically, I want to use some sorts of data storage to store groups of words, and enable an end-...
2
votes
4answers
130 views

Should CRUD actions be Java classes?

I am working on a simple project developing a telephone directory application. As such, it requires the implementation of the CRUD actions. Right now I have them as individual classes (e.g. "AddEntry")...
2
votes
2answers
227 views

What's the best way to create a two-level library, containing a class with different levels of abilities?

I would like to create a library consisting of two layers, lets call them A and B. There should be a class "Sample" in layer A. Layer B also knows about class "Sample" and enlarges it by some methods. ...
0
votes
1answer
77 views

Matching objects of different types without violating SOLID/minimizing dependencies

I have two separate inheritance hierarchies that represent objects that can be "matched" to each other to consitute a FooBarMatch (which contains references to the matched FooBase and Bar partners): ...
4
votes
4answers
2k views

Building a distributed system on Amazon Web Services

Would simply using AWS to build an application make this application a distributed system? For example if someone uses RDS for the database server, EC2 for the application itself and S3 for hosting ...
2
votes
0answers
56 views

Adding behaviour to a part of a third party class

I am working with an effectively third-party library. This library has a base class that's used as the interface (C++ style), ComponentBase. ComponentBase has a number of methods and setters that are ...
-1
votes
1answer
157 views

Want Some Advice on Structuring My Text-Editing Program

I want to make a small command-line-run program that looks for a word or phrase in a target .txt. or .docx file, prints out a corresponding blurb about that phrase, and then replaces it with a ...
9
votes
1answer
313 views

Code Design: Delegation of arbitrary functions

On PPCG, we frequently have King of the Hill challenges, which pit different code bots against each other. We don't like limiting these challenges to a single language, so we do cross-platform ...
0
votes
1answer
103 views

What is the best way to publish a REST API so that other people can see and improve/add new methods on it?

I have a requirement to (re)design an existing REST API which is written in Django REST. One of the main requirements is allowing third parties, approved by us, extending of our API. The API is a ...
0
votes
0answers
24 views

Exposing 'utility' functions with AngularJS

I have an single-page Angular application which contains several controllers, directives and services. The fact here is that there are some controllers that hold two type of methods: "Scope" methods,...
-1
votes
0answers
53 views

Why does Erlang implements strings as single linked lists? [duplicate]

What is the reason for Erlang to consider strings as single linked lists, unlike other languages (C, Python, ...)? Why was this choice of design made? Thanks
9
votes
2answers
7k views

REST API - Should API Return Nested JSON Objects?

When it comes to JSON APIs is it good practice to flatten out responses and avoid nested JSON objects? As an example lets say we have an API similar to IMDb but for video games. There are a couple ...
2
votes
1answer
83 views

Which document model to choose in different situations

I needed some custom document format and stumbled on this issue. DocBook does it this way <chapter> <title>Chapter 1</title> <para>Hello world!</para> <...
3
votes
1answer
209 views

User Authentication in REST API (domain driven design)

I am using REST API as a presentation layer of a DDD project. In order to secure API calls, I am using token based security. Security in Web APIs-Basic Authentication and Token based custom ...
0
votes
1answer
23 views

Duplicate Software and Add Functionality or Keep One with Versatile Functions

I was recently hired, and I found two exact applications with a single extra service in the duplicated version, and of course each application points on separate databases. However, the original ...
1
vote
1answer
53 views

Accessing data from the middle-tier

I'm creating a 3-tier Web API application based on the Azure guide here. This has a middle tier and a data tier both in Web API. So far my application is pretty simple, the middle tier receives a ...
4
votes
1answer
192 views

Refactoring of a client API for avoid duplicated code and unclear passage of parameters

I need to develop an API, the functions of the API are requests that call the service exposed by a server. Initially the API worked like this: class Server: def firstRequest(self, arg1, arg2): ...
0
votes
1answer
62 views

Mapping match-up combinations into an integer

First of all, I want to say I wasn't sure if I should post this here or in math.stackexchange but I think the question is too programming-related to belong to the latter community. Definetly not a SO ...
2
votes
0answers
59 views

Elements of structure in a functional program

In object oriented, we have requirements, use cases, and UML which can form a nice conceptual framework. The goal there, is to define objects, their responsibilities, behaviors and communications ...
1
vote
1answer
99 views

System for scheduling parallel tasks/callbacks

I am looking for a system for building state machines with timed/scheduled transitions, and with events that happen periodically during a given state. I can implement it myself, though I feel like ...
47
votes
11answers
3k views

Clarify the Single Responsibility Principle

The Single Responsibility Principle states that a class should do one and only one thing. Some cases are pretty clear cut. Others, though, are difficult because what looks like "one thing" when ...
2
votes
1answer
296 views

UML diagram for an existing implementation

I have some code, which I want to present in UML, but I've stuck at one point. Let me tell you something about code's functionality. I have a workspace in which I can place some Components, select ...
1
vote
1answer
171 views

Finite Element Shader

I am working on a geometric wrapper for a space jet exhaust impingement solver. A key part of the solution is determining what the jet can "see" and therefore hit. My model is grouped with nodes or ...
2
votes
1answer
89 views

How to keep IDs in sync when using Factory?

abstract class Product { public abstract Product createProduct(); ... } class OneProduct extends Product { ... static { ProductFactory.instance().registerProduct("ID1", new OneProduct(...
0
votes
1answer
47 views

Use redundant data in database design when have multiple relation

In my web application users can submit their advertises and buy package for advertise (packages are used for priority of showing advertises) Database schema is like this: **Package: id, title, ...
-1
votes
1answer
100 views

How to design property files

I always wonder what is the best way to design your property files. I have few questions that I didn't find an answer to them Do we place all our labels / error messages in one file? Do we split the ...
2
votes
6answers
298 views

Should I be doing checks on data that I'm supposed to be able to trust?

I am working on the frontend of a product, and it is now broken due to bad data from the backend. This can be caught internally before it gets anywhere close to production, but we end up fiddling ...
3
votes
4answers
222 views

Would implementing a “Throwable Event System” be abusive?

I have been thinking for a couple years now about using Throwable events and implementing a sort of event system that uses throw to dispatch an event, or let a different method handle it with throws. ...
35
votes
9answers
6k views

How to cope with different development styles (top-down vs. bottom-up) in a team?

Say you've just started working in a very small team on a {currently relatively small, though hopefully bigger later} project. Note that this is an actual project intended to be used by other ...
1
vote
1answer
45 views

Specialized API endpoints or multiple calls to generic resources?

This problem came up while designing the API for a SPA web application, which communicates with the server via AJAX. On one page the user, who is creating a list of people to invite to an event, has ...
4
votes
1answer
278 views

Reuse already fetched data for request

I have action that fetches user model from db to check access. Then I have method that in some cases requires same model. function checkAccess(req, res, next) { var data = Data.fetch(req.params....
10
votes
5answers
11k views

How to make creating viewmodels at runtime less painful

I apologize for the long question, it reads a bit as a rant, but I promise it's not! I've summarized my question(s) below In the MVC world, things are straightforward. The Model has state, the View ...
1
vote
2answers
68 views

Separating save logic from WinForm to make it reusable

I have a Windows Form for creating configs. It has around 50 fields of data, which represent a group of entities, that I need to capture when the user presses the save button. Currently, on the press ...
0
votes
2answers
120 views

Where/how to store program data?

This may be more of a software design question - but I've been working on my first "real, non-academic" Java project and have recently learned about good code practices (such as breaking down methods ...
2
votes
2answers
102 views

Idempotency and concurrency in a REST web service

Is concurrency and idempotency mutually exclusive for a REST web service or can it be done so a service can be both concurrent and idempotent? Using a optimistic lock methodology like using Version ...
0
votes
1answer
140 views

What kind of data structure should be used to store components in an electrical schematic program?

Is there a specific data structure, object oriented programming methodology, and/or approach for achieving what programs like LT Spice, Altium Designer, and Cadence Virtuoso use to manage components/...
2
votes
4answers
294 views

Are static global variables as bad as global variables? How to avoid using them?

In general, I know that global variables are bad and should be avoided. Are static global variables equally bad? In all my projects, I have heavily relied on static global variables. From design ...
0
votes
2answers
71 views

How to calculate new property for old records efficiently?

Let's say we have classes something like this: public class Item1{ public Guid Id {get; set;} public string Name {get; set;} public decimal Price {get; set;} public int Quantity {get; ...
4
votes
2answers
177 views

Distinguish different type of Comments

I would like to provide design decisions in the comments as well. I want design decision comments to be distinguishable from function contract comments, on cursory examination of source code. How to ...
9
votes
6answers
5k views

Understanding “programming to an interface”

I have come across the term "programming to an interface instead of an implementation" a lot, and I think I kind of understand what it means. But I want to make sure I understand it's benefits and it'...
16
votes
6answers
4k views

A language based on limiting amount of arguments passed to functions

The idea is inspired by the fact operators such as +, -,%, etc. can be seen as functions with either one or two arguments passed, and no side-effects. Assuming I, or someone else, writes a language ...
1
vote
1answer
83 views

Inner and outer class relationship: should outer class be friend of inner's?

Is this design bad? Does it break encapsulation? The structure class B is a component of class A. Therefore, class A needs access to class B's members. Let a house be class A. Let a housekeeper be a ...
14
votes
9answers
12k views

Use constructor or setter method?

I am working on a UI code where I have an Action class, something like this - public class MyAction extends Action { public MyAction() { setText("My Action Text"); setToolTip("My ...
2
votes
2answers
66 views

AMQP broker and happen-before guarantees

I am trying to figure out how an AMQP broker, such as RabbitMQ, can be integrated in our architecture. This should allow to easily scale horizontally in the future. For the sake of simplicity, let me ...
1
vote
1answer
74 views

Should written use cases be consistent with use case diagram?

I'm developing a video web system like YouTube where users can upload, view, update and delete their own videos (CRUD operation). Original I drawn the use case diagram like this: But I learned ...
0
votes
1answer
30 views

Design question to best option for storing data in file or DB

I am working on a feature where I need to store some data and I am not sure what should be my best option to store this data. I am sending data to some third party and want to show some part of that ...
10
votes
4answers
561 views

Is it bad practice to reuse method parameters?

There are times when I will need to modify a value passed into a method from within the method itself. An example would be sanitizing a string such as this method here: void SanitizeName(string Name)...
1
vote
1answer
51 views

Decoupling the loading of data, sorting and usage

I have the following requirements: Load data from a variety of sources and fill a list with it Use a batch of data to perform some computation Some additional information: The algorithm for ...
1
vote
2answers
142 views

Is an empty class in some cases correct

I know it's generally a design flaw to have an empty class, yet I'm wondering whether there are some cases where it isn't to have an empty (abstract) class to group objects. Especially when ...