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

learn more… | top users | synonyms (1)

2
votes
2answers
102 views

How to accomplish a task of evaluating editable variables and formulas, using PHP?

Task as defined: User needs to be able to define their own variables and formulas to operate on those variables, to get output based on their inputs. Since formulas and variables and their inputs ...
1
vote
1answer
45 views

Preventing unauthorized writing to parts of server [closed]

Say I have two members which share a server. Both members have a game that is accessible to anyone and after playing, it records high scores by sending a request to write to a file on the server. ...
1
vote
1answer
94 views

Stuck on design when attempting to create an object store

I'm working on a small scale API project but as it will be used and maintained by people that are not Software Engineers to trade I am attempting to keep the design as separate and identifiable as ...
5
votes
1answer
452 views

Is using protected inheritance to hide (but exploit) implemented interface from the public ok?

Recently, we had a discussion about code using protected inheritance in order to hide the fact (to client code) a class inherits from a specific base class but to exploit this fact in the ...
5
votes
6answers
4k views

What are good reasons to use explicit interface implementation for the sole purpose of hiding members?

During one of my studies into the intricacies of C#, I came across an interesting passage concerning explicit interface implementation. While this syntax is quite helpful when you need to resolve ...
3
votes
1answer
95 views

Implementing a requirement with a decorator and ensuring its usage

In a shared library I have a function that is widely used. I'm implementing a requirement for the function to override its behavior when the entities are in a specific state. I have decided on ...
1
vote
0answers
141 views

What is a good name for functions like 'sum', 'max', 'min'? [closed]

Suppose you have a function that allows you to find the sum/minimum/maximum of a data field: void g(DataField* d, Operation* op){ // applies op->f(...) on all fields of d } Operation would be ...
2
votes
2answers
299 views

Best approach for a server configuration data collection and reporting solution from a legacy script?

I have a project which involves collecting config data from windows servers in our (very large) server estate. My manager wants me to collect over 150 data items across all configuration areas ...
2
votes
1answer
81 views

How “close” should a IO class/logic be to a form or thread that controls the IO device?

I am having a difficult time determining where my IO logic should reside within my application. In this application there are multiple IO devices both USB and serial. I currently have the idea to ...
1
vote
1answer
217 views

Code First Approach and Business Classes Validation

I have a solution split into two projects : A class library containing all of my model classes (lets call it Business), and an ASP.Net MVC project. My Business classes are meant to be generic and ...
6
votes
3answers
257 views

Is mutually referencing classes a consequence of bad design? [closed]

I am currently working on a small game I did in about ten days. Since I am programming for myself, I am being lazy and going to the easiest solution with (too) little concern about bad code quality. ...
2
votes
3answers
174 views

Help me design this use case

I have following entities: Data: User_id Categories: Interests, Disinterests, Categories A, B C... Each categories have sub categories: Interests=Gaming, Physics, Programming etc.. Now each user ...
24
votes
4answers
5k views

What are the data structures behind a spreadsheet?

I would like to understand how a spreadsheet (a group of named or otherwise identified cells containing values or formulas referencing other cells) is solved. I have tried looking at existing ...
2
votes
2answers
147 views

Upgrade and downgrade customers subscription

I have been stuck at a requirement for way too long too handle it :(. Our company is having increased number of customers who wants to upgrade or downgrade their subscription. For now, the ...
5
votes
11answers
700 views

White Boards — Who Uses Them? [closed]

So as both a full-time programmer and hobbyist as well (developing my own things for personal use and maybe to sell one day), I feel that me purchasing a big white board to hang in my room at home or ...
1
vote
2answers
107 views

Efficient way to handle foreign keys

I am building a script that checks a large network of sites for invalid links. The idea is to flag links that continuously show as not available so that they can be cleaned by the administration team. ...
6
votes
6answers
499 views

Object creation: when should I expose a factory vs wrapping class?

I am having some problems trying to figure out when to use a factory or to wrapper class. This question is slightly geared towards C# I guess, so I'm not sure if this is the correct place to ask. Say ...
5
votes
2answers
195 views

Designing a ticketing system where the User and Administrator have similar but different functionality

I am designing a simple ticketing system in Laravel 4. The system will simply allow a User to create a ticket, and an Administrator to answer it. The User will be able to: View a list of his ...
2
votes
5answers
175 views

Creating variations of a property heavy class

What kind of pattern or design can prevent the creation of a class packed with properties that aren't always used? Example class Car{ public string type; public string name; public DateTime ...
1
vote
1answer
218 views

Multi-tenant database design

My boss is currently working on a database design for a multi-tenant capable ERP/CRM system, which will have a Sql Server backend. Some key points of the design: A server instance will host a ...
4
votes
1answer
133 views

Better to have two variables to designate whether a variable exists, or one

Lets say I have a string variable FirstName. FirstName can be null. I need to know if FirstName exists or not. Is it better to just use one variable: FirstName and if FirstName is empty assume that ...
1
vote
2answers
103 views

How to achieve inheritance when using just modules and vanilla functions in Python?

Python doesn't enforce any paradigm. It gives you freedom. Python provides encapsulation at module level. If I have a module A and have a module B with same interface. How do I sort of inherit B ...
1
vote
1answer
38 views

Deploying and maintaining a script on customer's domains

I am trying to figure the best way (or just the pros and cons of various options) for delivering a service via a script which runs on the customer's site (think Google Analytics). Unlike Google ...
7
votes
3answers
441 views

C++ Header files design : just like defining an API?

I'm kind of new to large scale software development in C++, and I was wondering on the design side of things. I was reading this question, and I thought that, overall, once we get past constant ...
5
votes
5answers
628 views

Debug function input vs expecting code users to read the documentation - How far do I go? [duplicate]

I could write an endless amount of debugging code to handle the various components of input for a function, check that the correct data types are used, make sure things are decendants of the proper ...
1
vote
1answer
59 views

MVC .NET APP Program Structure [closed]

I am just building a MVC .NET application, eventually this will use entity framework and the repository pattern to structure the program. The first release however will only be calling other jobs that ...
8
votes
5answers
306 views

Fine grained search over a large dataset

I have roughly 4 million records per day and have to keep 7 years worth online, so we are looking at 10.2 billion records that I need to be able to search through. The users are expecting that the ...
2
votes
1answer
107 views

Multiple different versions of similar apps in one project

I need some help to improve the architecture of a site I've built. What I want to achieve within a single Django project is the following: I want a site that comes in several versions (one per ...
2
votes
4answers
243 views

Why shouldn't pure functions always be static and public? [duplicate]

What are the reasons, technical or otherwise, that pure functions (functions which do not rely on external state and have no side effects) should not always be public and static? When a static and ...
10
votes
2answers
756 views

Event sourcing and REST

I came across Event Sourcing design and I would like to use in an application where a REST client is needed (RESTful to be precise). However I fail to connect these together as REST is quite CRUD-like ...
5
votes
2answers
2k views

Objective-C class cluster pattern

I have many sublcasses of one class. I choose concrete class based on type (simple enum). I like idea of class cluster. Should i use it or just create factory class (but each class in objective-c is ...
2
votes
2answers
320 views

How is encapsulation broken by getters/setters, even when using MVC model [duplicate]

I was thinking about encapsulation in Java and then I thought how getters/setters break encapsulation. After I went through this , I saw many recommendations like to avoid getters/setters on fields ...
0
votes
3answers
223 views

Forcing Cache Refresh

I'm updating an existing tomcat web application to read certain resources from a REST API. Currently the application reads them from flat files. Since the application is very critical, I added a ...
29
votes
3answers
26k views

AngularJS: structuring a web application with multiple ng-apps

The blogosphere has a number of articles on the topic of AngularJS app structuring guidelines such as these (and others): http://www.johnpapa.net/angular-app-structuring-guidelines/ ...
26
votes
6answers
4k views

Can you implement “object-oriented” programming without the class keyword?

Say we want to provide an abstraction of an "account" in a bank. Here's one approach, using a function object in Python: def account(): """Return a dispatch dictionary representing a bank ...
4
votes
2answers
142 views

Who is the Owner of Information? Memento vs. Originator

Imagine for a second that I'm implementing the Memento Pattern, using the following classes. Classes An Originator class that has public and private, properties and fields respectively A Memento ...
9
votes
3answers
333 views

CRUD API: How do you specify which fields to update?

Let's say you have some kind of data structure, which is persisted in some kind of database. For simplicity, let's call this data structure Person. You are now tasked to design a CRUD API, which ...
7
votes
7answers
2k views

How to cope with the problem of (compiling) a large code base?

Although I can code, I don't yet have any experience with working on large projects. What I did so far was either coding small programs that get compiled in matter of seconds (various c/c++ exercises ...
0
votes
1answer
59 views

When is the best time to compute rating changes in a PHP application?

Imagine a simple PHP application where an user can post notes and the other users can upvote or downvote them. We want to implement a system where each note has a different rating (normal, good, ...
3
votes
3answers
319 views

How does Functional Programming's immutability feature work with CQS?

Given immutability (which is often encouraged and said to be one of building blocks of functional programming) and CQS (which says that commands should not return a value other than void/unit), how do ...
3
votes
2answers
126 views

Database + Java Design for a scenario

Overview A central web application to supports other web applications(A) for user and its role/permission management. Applications (A) call the central application via API to get the user ...
0
votes
2answers
197 views

Ensuring program output is always the same [closed]

I am working on a +10k LOC program, and I need to ensure its output is always the same for given input. The program consists of dozens of modules and classes, inherited by a MainClass. (The examples ...
16
votes
4answers
37k views

Best way to unit test methods that call other methods inside same class

I was recently discussing with some friends which of the following 2 methods is best to stub return results or calls to methods inside same class from methods inside same class. This is a very ...
1
vote
1answer
53 views

multiple accounts with the same roles represented as one row in the database

Say there is an online hotel management application. One feature is the Receptionist will confirm and cancel bookings made by the customer. So all Receptionists do the same things. Is it bad practice ...
1
vote
2answers
165 views

Better application design - where to place interfaces

Where to place interfaces in a typical multi-layered app with DataAccess, BusinessLogic and an Endpoint modules? I propose 2 options In both cases there's only dependency from abstractions, but in ...
3
votes
2answers
716 views

Where should the database and mail parameters be stored in a Symfony2 app?

In the default folder structure for a Symfony2 project the database and mail server credentials are stored in parameters.yml file inside ProjectRoot/app/config/parameters.yml with these default ...
31
votes
1answer
4k views

DRY unrelated, but nearly identical, code

I have some code that is nearly identical, but uses absolutely different types, with no inheritance between them, on the main variable. Specifically, I am writing an analyzer with Roslyn for C# and ...
3
votes
2answers
172 views

OO Design Question - Library/Objects for API which includes id references

Public api: getClients / getClientById - returns a json object like: { clientid: 1, name: "Client1" } getProjects / getProjectById - returns a json object like { projectid: 5, name: ...
4
votes
3answers
352 views

IoC invalidation

I have a bunch of services that get registered as singletons by my IoC container on startup, all of these services have a constructor which takes in a connection string which is used by the underlying ...
2
votes
3answers
175 views

How to simplify structure of a monitoring software that uses the Observer pattern?

I am working on a project where I have to monitor the status of an elevator. So far, my design looks like this: We are using a third party library to read and monitor real-time values from the ...