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

learn more… | top users | synonyms (1)

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
109 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
156 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
101 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
19 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
176 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
162 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
57 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
156 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
117 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
168 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
171 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
291 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 ...
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): ...
1
vote
0answers
70 views

SignalR design concept [closed]

I'm creating a work diary web application in mvc using vb.net The application will display any diary entries that have a HiLite boolean field (HL) set to true in a table on the home page. Currently ...
5
votes
4answers
347 views

Dependency Inversion Principle and Hollywood analogy

Often DIP is known as the Hollywood principle: "Don't call us, we'll call you.". But doesn't always higher level module calls lower level module, whether there is dependency inversion or not? Then ...
5
votes
1answer
168 views

Call base inside overriden method

I know there are questions about calling the base method inside an overridden method such as this. But what if an overridden method only calls the base class? Is this bad/good deign? It just seems ...
0
votes
2answers
143 views

Designing classes that depend on each other

How would one go about designing classes for a system in which two components depend on each other? For a more concrete example, consider this scenario, you're designing a piece of software to manage ...
2
votes
0answers
40 views

Handling of messages with several indicators

I am currently working on an application, which will show several messages (alarms - warnings - hints) on a cable-connected display. As these messages depend on several indicators I have to decide ...
9
votes
2answers
468 views

Why is it inappropriate to use UML diagrams to plan how your code will be organized?

So, yes, diagrams can be inappropriate at times. When are they inappropriate? When you create them without code to validate them, and then intend to follow them. There is nothing wrong with ...
0
votes
1answer
46 views

Include exceptions in activity diagrams? [closed]

Should I include exceptions, like a TimeOutException or just general Exceptions, to a activity diagram? For example: A activity diagram describing a client-server connection. Several exceptions can ...
1
vote
2answers
84 views

What is “recorded” relationship in a class diagram? [closed]

Composite aggregates Part, Container contains Content, and Recorder records. Recorded are all very common relationships between classes in a class diagram. Creator suggests that the enclosing ...
3
votes
3answers
223 views

How to “program to an interface”

I've read these questions: Understanding "programming to an interface" What is the point of an interface? Does it always make sense to "program to an interface" in Java? I ...
4
votes
2answers
71 views

Multiple controllers for same resource based on user's Role

I'm having trouble designing this role (or permission) based application, when it comes to figuring out how to handle actions that differ per use role. For instance, our controller is ...
2
votes
0answers
74 views

Displaying complex objects in Angular

What in your opinion is the best way to display complex objects in Angular? You have some sort of return from a service used in multiple places in a app and you might have to display multiple ...
2
votes
1answer
191 views

How to implement a facade correctly

I have read multiple websites on this topic but none of them gave me a 'good' solution for the problem I am having. The problem is described in the following (related) questions: How do I couple the ...
1
vote
1answer
56 views

Encapsulate algorithm configuration in system hierarchy [closed]

Say, I'm building a system that uses various complex algorithms (k means, mean shift, a few others), all of which are parameterized. I'm highlighting `uses', because the system is not just a thin ...
2
votes
2answers
242 views

How much implementation should I provide in an abstract class? [closed]

I have an abstract class AbstractService and about 10 classes that extend from AbstractService. However, I'm not sure how many methods and what methods I should implement in the abstract class and how ...
0
votes
1answer
71 views

How to periodically serialise object's state and deserialise on initialisation in Python?

We're designing an application that is supposed to monitor a system for certain events, email interested parties to prompt them to take action when relevant and parse their replies. The application ...
0
votes
1answer
680 views

Best way to represent multiple JSON response in a REST service? [closed]

I am working on a REST service in which I am trying to come up with a JSON response that I am supposed to return back. Below is the design I am able to come up with in which each line is a response ...
6
votes
4answers
326 views

Class design dilemma: Encapsulation vs Single Responsibility/Separation of Concerns

I'm working on a class that represents an object with multiple representations - one is an XML type representation used by an automatic ordering system, the other is a POJO-based representation used ...
0
votes
1answer
205 views

New Kind of VM Type

I have designed my own kind of vm, a sort of stack-register. It works by having a stack but instead of pushing and popping values, you simply store the values on the stack, and add together different ...
3
votes
2answers
103 views

Best practice in helper/util methods: IoC container or static methods?

So I'm developing an application which is using an IoC container. Now I need some helper methods for array manipulation like set, get, etc. I see two possible ways to go: Using a class with static ...
2
votes
0answers
139 views

Analysis of ways to control/refresh a directive with isolated scope from parent controller

I'm asking this question because there doesn't seem to be a "recommended" approach for this. If a page had a directive with isolated scope, and if the directive needs to update itself after an event ...
6
votes
3answers
575 views

How many classes are too many?

I'm making a Book Manager App using Java Swing that allows me to do a variety of things such as opening a txt list of books, searching for books, adding/removing books. There are different classes ...
37
votes
7answers
2k views

Referencing database values in business logic

I guess this is another question about hard coding and best practices. Say I have a list of values, lets say fruit, stored in the database (it needs to be in the database as the table is used for ...
0
votes
0answers
48 views

UML Modeling - Creating flexible Pattern Viewer, extending context leads to too much changes

What I'm trying to make with jsp's java and servlets is a web based 'selector' for patterns. Here you can see all the design patterns there are (like www.oodesign.com). But for learning purposes I'd ...
1
vote
1answer
238 views

Refusing to define 2 or more classes in one .cpp file [closed]

In my company there is implicit rule not to define multiple classes inside one .cpp file. The argumentation is that it looks like a mess and hard to read. But in my opinion it will make sense if the ...
0
votes
3answers
312 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 ...
2
votes
4answers
138 views

Is it ok to use service locator for ubiquitously used dependencies? [closed]

We strictly adhere to inversion of control in our codebase, but that creates hellish constructors (yes, I know that means our classes aren't cohesive enough, this is a work in progress). The thing is, ...
1
vote
2answers
269 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
100 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 ...
-2
votes
2answers
166 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. ...
1
vote
3answers
247 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 ...