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

learn more… | top users | synonyms (1)

1
vote
1answer
46 views

Should I actually be using encapsulation here?

Problem Statement I am going to write a library to control a whole bunch of relays, and I am just trying to think conceptually right now. Here are my design constraints: We have an exact number of ...
13
votes
4answers
4k views

Am I wrong in thinking that needing something like AutoMapper is an indication of poor design?

Automapper is an "object-object mapper" for .Net, which means copying objects from a class into another class that represents the same thing. Why is this ever useful? Is the duplication of classes ...
0
votes
1answer
60 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> ...
6
votes
6answers
4k 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 ...
4
votes
1answer
158 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): ...
89
votes
8answers
9k views

Is this a violation of the Liskov Substitution Principle?

Say we have a list of Task entities, and a ProjectTask sub type. Tasks can be closed at any time, except ProjectTasks which cannot be closed once they have a status of Started. The UI should ensure ...
0
votes
1answer
49 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 ...
1
vote
1answer
68 views

Standalone library for error logging?

Background Here is how I currently log any exceptions that occur in my code: Pass each object instance the path to a file where I want all of the logging to happen. Each of the objects have their ...
1
vote
2answers
103 views

Fault tolerant software design of application running as distributed cluster

Mission-critical software system (such as systems-control software in spacecrafts) often employ multiple redundant software modules developed by different teams (sometimes using different programming ...
1
vote
1answer
72 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 ...
2
votes
1answer
182 views

Why support cyclic dependencies at all? Are there valid use cases?

Background Time ago I learnt something about package design, in particular about loose coupling: The Acyclic Dependencies Principle The dependency structure between packages must be a ...
4
votes
2answers
151 views

Ubiquitous language and maturity level in REST API?

According to Richardson Maturity Model there are several levels of maturity in REST approach. http://martinfowler.com/articles/richardsonMaturityModel.html Since DDD uses ubiquitous language, I am ...
1
vote
0answers
42 views

Drawing sequence diagram for user-forget-password functionality

I'm trying to draw a sequence diagram of the functionality of user retrieving their password when they forget it and its procedure could be illustrated in this activity diagram. As you can see, ...
2
votes
1answer
263 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 ...
0
votes
1answer
146 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
3answers
80 views

What should be primary guideline when defining a bounded context?

When defining bounded contexts of a Domain, what should be a primary guideline: departments (Sales/Manufacturing/Warehousing), where each department has a common context ...
2
votes
0answers
68 views

What are the benefits of an input/output component design?

For the company I work at, all of our projects, including a new one started last year, are written in C89. We write for vxWorks (a real time embedded operation system). Our software runs ...
2
votes
1answer
235 views

Working with a large, messy object [duplicate]

I have been handed a very cluttered, "One Ring" object (one object to rule them all). The OR class has 40 fields. These fields map to 16 different objects (the OR has all the fields from the 16 ...
0
votes
1answer
31 views

Sdk building, declare dependencies inside the assembly or use external?

At my company, we're building an SDK consisting of a number of assemblies. For example, we deliver an assembly called Company.Platform.Security that contains the implementation of our authorization ...
4
votes
1answer
246 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 = ...
0
votes
1answer
43 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 ...
1
vote
2answers
85 views

Approach for inserting rows

Let's say I have a sale order with multiple rows of products. Multiple users insert rows so I must check for concurrency. In my db the ID of the order and the number of the row makes my record unique. ...
1
vote
0answers
81 views

How to authentication user 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. ...
-2
votes
0answers
41 views

When the system metaphor does not work

I'm trying to figure out how to combine the metaphor system with patterns. For example, with MVVM or MVC. These patterns dictate a specific naming system. For example, in my project I have classes ...
4
votes
2answers
302 views

What are the practical uses of a neural network?

Even as an outsider to neural network development, they still seem to be a hot topic... I get lots of projects I see being starred on my GitHub homepage relating to neural networks. These projects ...
0
votes
2answers
113 views

Is a global context stack a code smell?

I would like to hear arguments for or against a plan I am considering. I have a large network of nodes each of which has vector-valued properties. Accessing these properties (read or write) requires ...
1
vote
3answers
77 views

Should a repository or the Login/Register service have an encryption service as a dependency?

I'm designing a simple user login/register program with user login/register and a repository. The passwords for users should be encrypted when stored but I don't know where to put the encryption step ...
0
votes
3answers
79 views

Design for a function to skip a step if called multiple times

Terrible title, but this is the situation I find myself in often and have not found a good design to make it nice. Lets say I'm working with Javascript and I have an object I am working on that needs ...
1
vote
1answer
220 views

Does anybody still use TODO for writing code later on? [closed]

Statement I often find myself still writing the following statement all over my code: // TODO: (the work that needs done) I do this in order to flag that I need to come back and do something later ...
4
votes
0answers
61 views

Distributed Calculation of Geometric Distance between vectors

I am looking at a large scale low latency way to calculate the geometric distance between vectors. Let's say I have a vector A. It has size 128 and of type 32 bit float. I want to get it's geometric ...
2
votes
1answer
141 views

Checking preconditions the proper way

I have a class with around 1300 lines and it has many CRUD-like methods that need parameters to be checked, for some of them it's more than just a few rules. For clarity purposes, I am going to use ...
1
vote
0answers
37 views

How to design microservices without leader election but job scheduling?

There is a microservices system that is currently using Zookeeper. Let's assume there is just one type of service A that exhibits a simple read of some value t. However, the one of existing A ...
2
votes
2answers
176 views

Law of Demeter and its applicability

Let's say I'd like to perform the following command: house.getFloor(0).getWall(WEST).getDoor().getDoorknob(); To avoid a NullPointerException, I'd have to do the following if: if (house != ...
0
votes
1answer
67 views

Controller calling multiple services

I have a few layers in my WebApplication: Presentation, Service, DAO, Domain. Services call DAO objects which reads data from a Database/File whatever. I have a Controller that needs to fetch data ...
5
votes
2answers
123 views

Is using partial classes for supporting multiple versions of data entities for continuous delivery scenarios a bad idea?

When you want to have continuous delivery any data schemas that you have must support multiple versions of your application at the same time (as you may have multiple version deployed when new ...
2
votes
2answers
162 views

What is a good approach to get a detailed system design from an existing system?

I will be working on a system which will be ported over from Java to .Net. It is a pretty big system. I don't have any specifics about how the system is designed, no documentation, nothing. You know ...
1
vote
1answer
68 views

Designing validation classes

This is a follow-up of this question. I decided to implement what the accepted answer suggests, however, I realized I also needed individual public methods for each member the entity to be validated ...
1
vote
2answers
114 views

Does it make sense to internationalize logs?

I'm working on converting the logging API used by a web application from log4j to slf4j, and noticed that the interface used to abstract over the log4j implementation supports internationalization; I ...
3
votes
0answers
79 views

Finger Paint path gets huge over time and slows the app

So I am writing a Finger paint app. I have multiple color which user can select. I save the path and paint information inside an array. ArrayList<PaintPath> arrayPaintPath = new ...
2
votes
2answers
125 views

Best way to enforce constraints in Class

I have a class, something like this one (C#): public class MyFavoriteClass { public string Name { get; set; } public string Description { get; set; } (...) public ReferencedClass1 ...
46
votes
16answers
3k views

How do I deal with analysis paralysis?

Very frequently, I am stuck when choosing the best design decision. Even for small details, such as function definitions, control flow, and variable names, I spend unusually long periods perusing the ...
1
vote
2answers
64 views

Implementing an event scheduler for animations

The basic idea is to have some animated widgets that sit in a container, quite similar to Qt (the only actual difference is that my widgets are animated). The animation is in some cases dependent on ...
1
vote
3answers
112 views

Is separating design from implementation a net win?

In my experience, technical design is made more challenging when it is divorced from implementation, particularly by assigning the roles to different people, because its easy for the designer to ...
1
vote
1answer
46 views

Redesigning a builder to make it reusable

Let's say I have a builder class (which by the way is not techinically a builder, but it's not a factory either) to generate different rules for a game: public class RuleBuilder { private Game ...
6
votes
2answers
216 views

Data validation: separated class or not?

When I have a lot of data that needs to be validated, should I create a new class for the sole purpose of validation or should I stick with in-method validation? My particular example contemplates a ...
6
votes
1answer
94 views

Extracting and generalizing “repeated” methods with similar functionality

Let's say we have a class with many methods that do something different but can be grouped together as one "kind of functionality". For example, adding a configuration o setting rules up. Let's go ...
5
votes
6answers
315 views

Breaking the contract: throw exception or do nothing?

Let's say we have a list of players in our Event class. And we have a dictionary with the score of each player. We can add a score to a player using the addScore method: public class Event { ...
-1
votes
0answers
93 views

How to implement “invite a friend” workflow?

I am developing a service and to increase the growth I'd like to implement a customer referral program. This means a customer can send an "invite" and get points if his invitees accept the ...
0
votes
3answers
134 views

Should I check for nulls in setters and similar methods?

I have plenty of setters in my classes, as well as many methods to add an item or a set of items to lists or maps. Should I check for nulls for each one of them, or should I allow ...
4
votes
2answers
154 views

How to design an iterable but immutable (read-only) collection

My program models a sport tournament which has one or many events or categories. The class Event has members like players or courts as a List, as well as some dictionaries using the class Map. So far ...