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

learn more… | top users | synonyms (1)

1
vote
2answers
441 views

How to solve this inheritance problem

I have the following classes: public abstract class StaticFileController<File, QueryData> : AsyncController { private string _resourceName; public StaticFileController(string ...
0
votes
3answers
220 views

Is this 'implementation' of a builder pattern good design

public class MyButton{ public MyButton(){} public MyButton setIcon(Icon icon){return this;} public MyButton setText(String text){return this;} } And used like: MyButton testButton = new ...
1
vote
2answers
252 views

How to write highly changeable, highly complex software? [closed]

I know questions like this has been asked before. But none of them truly answered me. How to keep a big and complex software product maintainable over the years? How do you organize highly customized ...
-1
votes
1answer
84 views

Design of simple disassembler [closed]

I am writing a simple x86 disassembler in c++ and I would like to hear an input on class which will handle disassembly. I thought to make a class which would receive a pointer to the table which will ...
1
vote
3answers
218 views

Factory of factories? [closed]

I have concrete factory classes which implement MyFactory interface. I want to get concrete factory objects based on parameter. How to do this? One way is to create factory of factories[FoF], and ...
-2
votes
2answers
155 views

Avoid copy and paste programming, what pattern to use? [closed]

I have a small software that generates some Word documents. It reads a template, runs a few SqL procedures to get the data, generates the documents and then sends them via e-mail. It's quite simple. ...
4
votes
1answer
179 views

Why is abstract Decorator class needed in this example?

Why do we need ShapeDecorator in this design? Why can't we just have RedShapeDecorator implement Shape directly and inherit from Shape?
3
votes
5answers
524 views

Does the Factory Pattern violate the Open/Closed Principle?

Why does this ShapeFactory use conditional statements to determine what object to instantiate. Dont we have to modify ShapeFactory if we want to add other classes in the future? Why doesnt this ...
18
votes
5answers
20k views

Designing a REST api by URI vs query string

Let's say I have three resources that are related like so: Grandparent (collection) -> Parent (collection) -> and Child (collection) The above depicts the relationship among these resources ...
3
votes
3answers
91 views

How to design access to different type objects in protocol response

I have written a communication library for an industrial device protocol. The response frame contains a byte array as payload data. The payload data consists of several "objects“ of different types, ...
3
votes
1answer
113 views

A condition on an argument used in multiple calls of a method: enforced by caller or by the method?

Let's assume I have an object a of a class A. It has a method that needs an argument in form of another object of a particular type - but the argument should also be in particular state, because the ...
1
vote
3answers
200 views

Why do we need a context class in strategy pattern?

For the strategy pattern, why do we need a context class to call the appropriate algorithm? Why cant we just do Strategy s=new OperationAdd()? This way we still use polymorphism.
0
votes
0answers
41 views

Why doesnt the Factory Pattern violate OCP? [duplicate]

Why does this ShapeFactory use conditional statements to determine what object to instantiate. Dont we have to modify ShapeFactory if we want to add other classes in the future? Why doesnt this ...
2
votes
1answer
95 views

Use of project-specific values with enum defined in class library

We have an enum in a class library: Public Enum FieldType Phone Span Gender DrawPath .... End Enum which we use with an attribute applied to properties, for multiple scenarios: ...
1
vote
0answers
50 views

Strategies for creating a mobile site? [closed]

I'm looking for 2nd & 3rd opinions on a general mobile strategy for a website I work with. We have decided that tablets generally have an acceptable experience with our site (especially in ...
31
votes
7answers
4k views

When NOT to apply Dependency Inversion?

I am currently trying to figure out SOLID. So Dependency inversion means that any two classes should communicate via interfaces, not directly. E.g. if class A has a method, that expects a pointer to ...
-2
votes
1answer
69 views

What is better to design or discover interface [closed]

Let's say you have some issue to develop. And as recommended practice it is good idea to use interfaces ( I don't mean GUI, I mean interface or abstract class ). And you can apply two ( I'm pretty ...
3
votes
2answers
138 views

Design review of a small configuration framework [closed]

I want to create a simple configuration framework. Yes I know, there are many frameworks, which make their job very well. But for interesting in architecture, I want to create my own. My framework ...
5
votes
4answers
877 views

How narrow or broad should constant names be?

I always seem to come back to this question and cannot settle on a convention that I'm comfortable with or that I can concretely define: when naming a constant, how narrowly or broadly should it be ...
4
votes
2answers
417 views

What are functional programmers using in place of UML?

I'm CS student. I am currently attending lectures, where we're taught Objective Analysis and Design. It consists mostly of writing use cases, analysing the problem that we can face when writing some ...
20
votes
3answers
28k views

What is a recommended pattern for REST endpoints planning for foresighted changes

Trying to design an API for external applications with foresight for change isn't easy, but a little thought up front can make life easier later on. I'm trying to establish a scheme that will support ...
0
votes
1answer
95 views

What pain point does Intelligent Children Design Pattern solve?

In absence of this pattern, downcasting is needed in the derived classes. My question is does this pattern solve only the problem of downcasting? And why is downcasting bad compared to the alternative ...
6
votes
2answers
722 views

Capturing mobile device system (output) audio [closed]

I'm trying to figure out a way to capture the system audio of an Android and/or Windows Phone. The idea is to provide a stream based on the music I'm currently playing on my phone. What I'm not sure ...
2
votes
4answers
97 views

Question regarding actors in a Use Case diagram

OK, so I have this homework question whereby we are given a rather complex system description and need to create several UML diagrams that describe the system being described. I'm having an issue ...
5
votes
5answers
459 views

Advantages of Strategy Pattern

Why is it beneficial to use the strategy pattern if you can just write your code in if/then cases? For example: I have a taxPayer class, and one of its methods calculates the taxes using different ...
3
votes
2answers
145 views

One wide table or multiple themed tables?

I'm trying to design a database for a simple text based game where the player characters have a large number of statistics that I want to track. Currently I have a few groups of related statistics, ...
1
vote
4answers
93 views

How to design class model for specific products, some of which may contain groups of specific product models

Class Design Question I am trying to figure out a good way to design my class system. I have a class Product to compute various product specifications. I have two product model groups, each ...
0
votes
0answers
35 views

How to keep xml view and designer view in sync?

My task is to create a designer for a Visual Studio Shell application to edit a specific file format that is based on XML. One of the requirements is that the designer has to support a split view, ...
0
votes
1answer
168 views

Best way to design chess game [closed]

This is a theoretical question, and excuse me if it is not clear, I am new to this field. Thing is, I was asked to design a chess game in an interview (java/ android.) And my intuition was that P. ...
2
votes
4answers
185 views

Abstracting out a module or using the Module Singleton directly?

I am working on a module which is dependent on other module for some functionality. Now the dependent module provides a lot of functionality and I need only few of them, hence got the idea to create ...
8
votes
4answers
510 views

Are there any significant disadvantages to depending upon abstractions?

I was reading this wiki on the Stable Abstractions Principle (SAP). The SAP states that the more stable a package the more abstract it should be. This implies that if a package is less stable (more ...
10
votes
6answers
18k views

Using a relational database vs JSON objects for event/activity data

I am working on a project where I am trying to decide between using a standard SQL relational database or JSON objects to store data about an event or activity. The project will store data on ...
2
votes
1answer
57 views

Is accessing data using a representative value a viable strategy?

Over the years i have seen multiple cases where data is accessed and/or manipulated using a representative value which is internally resolved to the right object/data-field/algorithm. Some examples: ...
0
votes
0answers
36 views

How to extend code which is without documentation and very difficult to decipher? [duplicate]

I'm a junior developer and I'm coming across code which was written in a way which can only be extended with very hacky code, time constraints don't allow me to spend weeks trying to decipher the ...
48
votes
7answers
5k views

Two structs with the same members but different naming, is it a good idea?

I am writing a program that involves working with both polar and Cartesian coordinates. Does it make sense to create two different structs for each kind of points, one with X and Y members and one is ...
7
votes
4answers
13k views

When should we use weak entities when modelling a database?

This is basically a question about what are weak entities? When should we use them? How should they be modeled? What is the main difference between normal entities and weak entities? Does weak ...
12
votes
5answers
2k views

Algorithm for percentage without knowing total number

Suppose there are n lines for a hotline. Whenever a customer calls the hotline, the call is forwarded to one of the n lines. And I want to assign percentage of calling to each of the n lines. ...
5
votes
1answer
130 views

Economics of scaling, denormalizing NoSQL for personalized content [closed]

I am using Cassandra for a data intensive app. With relatively little operations and deployment experience, the expertise I am looking for is someone that can read the example below and decide whether ...
0
votes
1answer
44 views

Naming conventions for hierarchical roles in an application [closed]

I'm creating an application that internally will have have three totally different separated areas of interfaces. - One where users create content and interact with each other - One where one person ...
10
votes
6answers
4k views

Are There Any Programming Focused Notebooks? [closed]

I know that engineering paper exists, but are there any companies that make programmer-specific notebooks for notes/pseudo-code/designs? Paper is my preferred way of outlining things, so the addition ...
0
votes
4answers
76 views

Public and Private Constructors with Equivalent Signatures

Here is the problem illustrated using an example of an immutable class. A Book must have at least one of a title and an ISBN. public class Book { private readonly string _title; private ...
4
votes
2answers
296 views

Design interface for WebService to access several MySQL databases

I am currently trying to design an interface for a WebService that can access several MySQL databases. There will be 4 operations available, Add(), Read(), Update() and Delete(). The WebService just ...
21
votes
2answers
1k views

Who should read Exception.Message if at all?

When designing exceptions should I write messages that a user or a developer should understand? Who should actually be the reader of exception messages? I find exception messages aren't useful at all ...
4
votes
2answers
349 views

What is NOT MVC? (in a web app)

It is easy to find many descriptions of what MVC is - for instance here, here or in this video. I'm curious, what is NOT MVC? or more precisely - In a MVC-using app, what is everything else apart ...
3
votes
1answer
119 views

What Lisp data structure to use?

I am studying different language games and trying to implement them in Common Lisp. Currently, I am studying a game which studies the relation between forms and meanings. An agent needs to store the ...
2
votes
2answers
290 views

Why do some prominent web sites use alphanumeric strings for resource IDs instead of numbers?

For example, the video IDs that YouTube uses are not a simple number, but instead a case-sensitive, alphanumeric string (like dQw4w9WgXcQ). Why do some websites, such as YouTube and Dailymotion use an ...
5
votes
3answers
173 views

How to reconcile “not mocking what you don't own” with “expectations” in unit tests?

I'm putting together a set of models for use in a Zend Framework 2 application. So, each model has a table class which acts as the interface between the model and database for querying. Using the ZF2 ...
0
votes
0answers
60 views

generic inventory system that can be used by many types of inventory systems

I would like to write code that can be used for inventory control. The initial requirement is simple, but I would like to write it generic, in case the requirements expand, the code be ready for it. ...
2
votes
1answer
218 views

How to avoid tying these two methods together with global mutable state?

I'm in the process of reading Code Complete 2 and learned that using global state is a no-no. What can I do to avoid using global state in this situation? Some background information: I have two ...
3
votes
2answers
499 views

How to avoid calling String.Replace() in a loop?

I am building a very simple email templating system in C#, and it works amazingly, but I have a personal issue with the way I designed it: Template looks like this: Hello {UserName}, Welcome to ...