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

learn more… | top users | synonyms (1)

2
votes
0answers
40 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
452 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 ...
36
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
47 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
237 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
224 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
135 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
254 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
85 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
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. ...
1
vote
3answers
219 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 ...
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?
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 ...
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
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 ...
-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 ...
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.
4
votes
1answer
186 views

Is it ever appropriate to lazy load properties?

Consider the following contrived program: class Program { static void Main(string[] args) { var myClass = new MyClass(); var stuff = myClass.MyProperty; // this takes 5 ...
1
vote
2answers
58 views

Single Class to Serve as View Model as well as Container for Submitted Form

I see the following design in the code which is part of the default web application project in visual studio: A single data model class in constructed and decorated with various data validation ...
4
votes
2answers
422 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 ...
3
votes
5answers
525 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 ...
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 ...
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 ...
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 ...
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
460 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, ...
12
votes
4answers
904 views

How does having too many instance variables lead to duplicate code?

According to Refactoring to Patterns: When a class is trying to do too much, it often shows up as too many instance variables. When a class has too many instance variables, duplicated code ...
0
votes
0answers
36 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
170 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
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: ...
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 ...
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: ...
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 ...
8
votes
4answers
511 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 ...
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 ...
1
vote
4answers
94 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
4answers
77 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 ...
3
votes
1answer
122 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 ...
4
votes
2answers
351 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 ...
2
votes
1answer
50 views

Custom Outlook Web App Shared Mailbox

We currently have a large amount of custom mailboxes hosted on Lotus Notes/Domino and have been tasked to migrate these over to our Outlook/Exchange environment. The mailboxes are basic Lotus Notes ...
3
votes
1answer
147 views

For what reasons would you use a separate class extension for each delegate in Swift?

I was working through a Ray Wenderlich tutorial and noticed that the author uses class extensions to hold delegate callbacks rather than having them be handled in the class itself i.e.: delegate ...
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 ...
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 ...
5
votes
3answers
174 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
63 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. ...
1
vote
3answers
263 views

Use of electronics in programming [closed]

Does a programmer need to have a deep understanding of digital electronics. Theoretical v/s practical. As what they teach us at college is pretty basic? If yes, then do all kinds of programmers ...
4
votes
2answers
148 views

Exposing nodes in a generic binary search tree implementation to visitor pattern

It's common to implement binary search trees with an internal Node class public class BinarySearchTree<TKey, TVal> { class Node { public readonly TKey Key; public ...
3
votes
2answers
136 views

Better To Call In Dive Into Submethods Or Pass Around a result

I have a service that does fairly complicated business logic when it receives a request. I have most the functionality isolated into private methods which dive a couple levels down from the method ...
1
vote
1answer
59 views

OO Design: Reading/Writing object with multiple formats

I have a class Song, which has the following public methods: String getSong(); void setSong(String); int getId(); void setId(int); Now I have two different ways I might want to store these songs in ...