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

learn more… | top users | synonyms (1)

0
votes
3answers
138 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
156 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 ...
0
votes
1answer
55 views

Abstract Factories Nesting and DI - Is this acceptable?

I am still trying to get some experience with DI. Let me illustrate my situation and you can give me advice on whether I am using DI and Abstract Factory correctly. I need to create IModels at ...
0
votes
0answers
43 views

Looking for pros/cons on using OWIN vs. a simple hand-rolled token based auth

We are wanting to implement an API to be used internally and externally and add it to our solutions. Some environment notes: We are currently using VS2013, .Net 4.5, EF5, SQL2008, MVC4, C#, and ...
-3
votes
1answer
120 views

Returning a variable or a return code from a function

Let assume that we have a main() function in which we call a createDirectory() function. In Python for instance, the code would be: def main(): # Do some stuff createDirectory(myPath) # ...
1
vote
0answers
56 views

Implementing an algorithm for parallel task scheduling

Problem Given a set of applications "A[]" with execution cost "Ex" ,Arrival Time "t", Resource requirements "R" and the system having free resources "Fr", calculate the finishing time of all of the ...
4
votes
2answers
127 views

Design question about hiding implementation from users of a dynamic library

I'm building a DLL and in my public headers I have this: (definitions are in .cpp but for clarity I show them in .hpp here) ObjectTag.hpp: class API_DLL ObjectTag { public: ObjectTag() : ...
0
votes
0answers
33 views

DAOs - As a separate package or encapsulated in Service itself?

This question is to understand the pros & cons for keeping the DAO's with the service or as a separate package being consumed by the services. Consider a micro-service architecture. Let's say ...
1
vote
4answers
941 views

How do you make a service stateless?

When doing Domain Driven Design it is advised that services should be stateless. There are several kinds of services when doing DDD: Application services. Domain services. Infrastructure services. ...
1
vote
1answer
121 views

How to deal with states in front end?

This may sound as a naive question but its bugging me since a long time. I have the following scenario: I have written a new shiny Todo service with my favorite front-end and back-end framework. To ...
1
vote
2answers
104 views

How to implement application that will connect to server allowing the server to request data

I'm not sure what to title this question or if this is the right place to ask it. After Googling and continually coming up empty, I'm turning here as a last resort. I've developed a SAAS web ...
16
votes
2answers
2k views

Principle of least astonishment (POLA) and interfaces

A good quarter of a century ago when I was learning C++, I was taught that interfaces should be forgiving and as far as possible not care about the order that methods were called since the consumer ...
81
votes
8answers
13k views

What is “Soft Coding”, really?

In this article by Alex Papadimoulis, you can see this snippet: private void attachSupplementalDocuments() { if (stateCode == "AZ" || stateCode == "TX") { //SR008-04X/I are always required in ...
2
votes
2answers
707 views

Is it possible to migrate struts/spring based application to GWT?

I am using the combination of spring, spring-security, struts and iBatis in my application. Now I am looking to migrate the struts UI to GWT. The new combination must be spring, spring-security, GWT ...
4
votes
3answers
291 views

Does the visitor pattern violate the Liskov Substitution Principle

When using the Visitor pattern, I have observed the following: The visitor has weak dependencies to concrete types (each visit method has the concrete element as a parameter or is a method that ...
28
votes
9answers
2k views

Design for future changes or solve the problem at hand [closed]

While writing the code or during design do you try to generalize the problem at the first instance itself or try to solve that very specific problem. I am asking this because trying to generalize the ...
4
votes
2answers
1k views

Confusion with Factory pattern regarding Liskov's Substitution Principle, code maintainability and Unit Testing?

I have a confusion regarding Factory Pattern there are basically two ways You can implement that. Approach 1: public interface IProductFactory { IProduct GetProductA(); IProduct ...
2
votes
1answer
55 views

How to design a dynamic thread allocator

Forgive the title if it isn't correct, I am just not sure what I am trying to design is called. Say I have a number of tasks I want to run, N. Additionally, I have a maximum number of threads I can ...
3
votes
2answers
512 views

Does this Decorator implementation violate the Liskov Substitution Principle?

Please consider the following implementation of the Decorator design pattern: WordBank objects store strings and return them to the client through the method getWords(). The decorator class, ...
27
votes
10answers
6k views

Should a view and a model communicate or not?

According to the wikipedia page for the MVC architecture, the view is free to be notified by the model, and is also free to query the model about its current state. However, according to Paul ...
-1
votes
1answer
88 views

Should I re-write VB6 Code to Java [closed]

I work at a mid-sized company where an update is needed to an piece of the application due to an addition to the environment. The part that needs updated has been in place for 13 years, is fairly ...
2
votes
1answer
80 views

Possible DRY with Pausing Mechanism

Background I am currently working on the architecture for a future software design. The design is one long running task (hours-long) with thousands of sequential calls to various libraries. I ...
4
votes
2answers
95 views

Go - idioms/design for determining when an unknown number of goroutines are complete

I have a workflow wherein I walk recursively through a bunch of directories, then for each file perform some action. I'm using goroutines to walk each directory, and also to process each file. The ...
39
votes
10answers
3k views

Be liberal in what you accept… or not?

[Disclaimer: this question is subjective, but I would prefer getting answers backed by facts and/or reflexions] I think everyone knows about the Robustness Principle, usually summed up by Postel's ...
46
votes
9answers
7k views

Code Smell: Inheritance Abuse [duplicate]

It's been generally accepted in the OO community that one should "favor composition over inheritance". On the other hand, inheritance does provide both polymorphism and a straightforward, terse way of ...
3
votes
2answers
410 views

Preventing Liskov Substitution violation

I am reimplementing some component and noticed that the original version has a Liskov Substitution violation. It's not all that critical, though I'd like to get rid of it in the new implementation . ...
0
votes
2answers
73 views

What are 'good' cases for subtype overloads

To explain what I mean, I'm going to give an example of a bad case for a subtype overload. Let's say we have a community of people. And depending on what kind people are in our community, our ...
1
vote
2answers
131 views

MVC - Database search logic in View or Model

Special Note: I asked a very similar question on Stack Overflow, but I have since decided the problem should be solved from a design standpoint rather than an implementation standpoint. I have ...
1
vote
0answers
144 views

How to virtualize/sandbox windows games to simulate inputs for each individually?

We are working on a game streaming product in a startup which works really well in its current state. Games can be played over the internet with very low latency on client application. Now there are ...
2
votes
1answer
104 views

Deciding the best way of modeling a timeslot or period of time for a schedule

I am making a sport events scheduler to calculate possible schedules out of initial data and configurations. There are three main domains: players, courts and timeslots. My question regards the ...
1
vote
1answer
61 views

My web app uses a number of photo hosting APIs. What would be an effective database design to store their limitations?

For the sake of an example, let's say I'm using Picasa, Flickr and 500px APIs, and that each of the services has limitations on these simplified parameters: overall account space individual file ...
2
votes
1answer
71 views

How to handle error opening Windows file created by my code

My Windows desktop app creates a file in: %LOCALAPPDATA%\XYZZY Software\Our Product\foobar.json One customer on Windows 7 is experiencing "Accessed Denied" errors when our software tries to ...
2
votes
4answers
232 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 their should be avoided. Are static global variables equally bad? In all my projects, I have heavily relied on static global variables. From ...
2
votes
5answers
240 views

Constructor overloading or allow null?

Which is the preferred design to use, one constructor that allows null, or two constructors where one throws an ArgumentNullException on null? Two constructors with exception throwing public class ...
1
vote
0answers
24 views

Create unique buckets for stream of entities based on constraints on the entity attributes

I have stream (magnitude 10s of millions) of entities, say Item which is modeled as below: class Item { String id; Double price; Double profitPercentage; Country originCountry; Country ...
0
votes
0answers
43 views

How to save the differences between objects which are the result of random changes?

I keep a state object of the following form: class State { int num1, num2; List<String> strings; MyObject myObject; // A class I wrote // etc. } The state changes many times ...
5
votes
3answers
389 views

Is it ok to have a class that only has boolean properties?

Scenario We have a class Vehicle, this class contains some properties to define the object such as a CarBrand, TransmissionType, Color, etc.. A car (vehicle) also has options, these days a lot of ...
16
votes
2answers
17k views

best practices for NoSQL database design

I have just started using a NoSQL document based database (MongoDB) and i'm curious about the best practices for designing databases. I presume the architecture should be different from relational ...
6
votes
2answers
195 views

MVP (Supervising Controller) Does the view update the model?

I've been reading about MVP, specifically Supervising Controller. One thing I'm having difficulty wrapping my head around is how the View interacts with the Model. It was my understanding that the ...
2
votes
1answer
134 views

REST api design: How to manage multiple type of resources in URL?

Lets say I have an Organization and Users inside that organization. To get a user in particular organization what should be the GET request url from below options? 1. ...
42
votes
6answers
2k views

Business logic: Database vs code [duplicate]

I'm a student of systems engineering, and all my teachers and friends (that actually work in the area) say that it is better to have as much logic as possible implemented in the database (queries, ...
5
votes
3answers
146 views

Can I implement a payment feature in my own software?

Note: I spent some time thinking about this question before choosing which StackExchance site to post it on. I have decided on this domain because of the description: "For professional programmers ...
3
votes
1answer
154 views

What is the most sensible design for making files available for download from a URL?

This is what I need to do, in a nutshell: Generate Excel spreadsheet files (programmatically). Store these .xlsx files in a location where they can be accessed by users later. These files need to ...
25
votes
8answers
32k views

What software can be used to create architecture diagrams? [closed]

I use MS Visio for most of my design/architecting work when I need to be able to save the diagram somewhere and edit it later. I'm not the biggest fan of Visio, but it gets the job done (and it's free ...
2
votes
2answers
148 views

Reversible Functions

Currently writing a JSON Importer and creating some POJOs based on the data. I also have a requirement to write an JSON Exporter which take the information in the POJOs and exports a JSON doc. To me ...
1
vote
2answers
70 views

Prevent creation of multiple entities

In an application I'm developing we have integrated with a third party api. One of the use cases consists of a user of our system filling out a form and submitting it. This results in us mapping the ...
6
votes
1answer
100 views

How to allow for custom Rules in a Entity Component System designed game engine?

So I've been doing a lot of research into game engines, and Entity Component System (ECS) seems to be the most flexible and extendable design to use. Just to summarize, in ECS the basic idea is that ...
2
votes
2answers
293 views

Modeling a multi-channel communication device in C#

Background We (my coworkers and I) are architecting a high level C# API to interact with a hardware device's native Windows DLL. First I will discuss the hardware-architecture, then get to the ...
7
votes
4answers
357 views

How to save a list of strings which might grow too large but old data is not useful

I am developing an application which sends certain notifications to the user as read from a read-only external service. The user might dismiss notifications, and those should not appear again. I ...
0
votes
0answers
20 views

Where to store authentication/authorization entities with respect to crosscuting concerns?

Can you explain me how and where to store authentication/authorization entities in project structure. For example I have 4 projects in my solution in Visual Studio: SolutionName.WebApp ...