-1
votes
0answers
56 views

Java: Singleton Event Driven Design [on hold]

I have a singleton class ( I make this as immutable ). This class is present in the base module. It has a static method getInstance() which will initialize a new object based on the data stored in a ...
0
votes
1answer
41 views

System Communication: Avoiding Including a Large “HAS-A” Hierarchy Which Isn't Used

The situation: System A Huge, complicated system. Uses an important Message object with many other Message objects attached, many of which have further Message objects attached. In total, this is ...
2
votes
2answers
236 views

What should a repository really do?

I've heard a lot of the repository pattern, but I quite didn't understand what a repository should really do. When I say "what a repository should really do" I'm mainly concerned about which methods ...
3
votes
3answers
197 views

OOP what is meant by object-to-object communication

I've been reading in basic concepts of OOP,as i'm trying to make this shift from transactional scripts to more oop manner in php, and i often come across this definition : An object stores its ...
3
votes
1answer
79 views

reloading singleton classes and dependency

I have a singleton object. It's a DAO that looks somewhat like this (pseudoish code): class UsersDAO { public usersDAO init(string sDSN){ variables.sDSN = sDSN; return this; } public ...
0
votes
1answer
66 views

Interface questions for using Command Pattern and Dependency Injection together

I have many projects that have essentially the same high level requirement: test all hardware on a device. Each device can have a different communication protocol, requires different test equipment to ...
2
votes
3answers
191 views

Design for creating a menu based on user type

Problem I am building a PHP application which has a main menu, which in turn contains various "sections" or "subheadings" with various links. There are several user types such as SuperAdmin, Admin, ...
4
votes
4answers
195 views

Design pattern for bidirectional signals/events

This problem feels rather basic, yet I've never known a great solution. I'm looking for a way for components in an application to notify each other while being as decoupled as possible (both at ...
0
votes
3answers
255 views

Software architecture which allows for growth, real life situation [closed]

I know of Interfaces, Abstract classes that serve as Base class, I've been reading up on loose coupling, ... But I can't come up with a decent solution when a property of a class changes, and the new ...
0
votes
0answers
101 views

Javascript design pattern with jQuery Widget factory

I am using the jQuery widget framework for creating some graphical elements on a webpage, and I have a conseptual question about the overall structure of the code. I have 3 classes A, B and C which ...
0
votes
2answers
113 views

Where should the ACL handler be called in a MVC architecture?

Thinking about Access Control Lists bound to a web MVC architecture, I have a doubt on where the verification should be done. Within Models? Controllers? FrontController? Imagine a multiple module ...
0
votes
4answers
516 views

What is this design pattern called? [closed]

I have some code: /// <summary> /// Represents Record Locator class /// </summary> public class RecordLocator : IRecordLocator { /// <summary> /// The Record Locator string, ...
0
votes
2answers
146 views

How to remove redundant code that enables button. Or “if” statement

I got probably "micro optimization" problem. I got "History number", "Next Number", "Reset" buttons, as well "label" for text. Every time I click At "Next number" button I would like to show random ...
5
votes
2answers
482 views

Open Close Principle (OCP) vs Dependency Inversion Principle (DIP)

I was trying to understand the difference between Open Closed Principle (OCP) and Dependency Inversion Princible (DIP). Based on research I've made on the internet so far, I came to the conclusion ...
0
votes
1answer
135 views

Boolean properties in Class A control availability of members in Class B: Design Pattern?

Given the following code: class AnimalDescriptor { String species; boolean hasLegs; boolean hasTeeth; boolean hasHair; public AnimalDescriptor(String species, boolean hasLegs, ...
0
votes
1answer
229 views

Flexible / Dynamic object creation or Alternative to list of lists [closed]

I have a xlsx file, that has some tabs with different data. I want to be able to save each row of a tab in a list. The first thing that comes to mind is a list of lists, but I was wondering if there ...
1
vote
3answers
293 views

Problems with Facades and then evolution in software

I initially started a project with Facades and Polymorphism as a way to create simple extensible design following SOLID Principles. Here is a sample code: public interface IInterface { void ...
5
votes
2answers
445 views

What is the difference between self-types and trait inheritance in Scala?

When Googled, many responses for this topic come up. However, I don't feel like any of them do a good job of illustrating the difference between these two features. So I'd like to try one more time, ...
4
votes
4answers
298 views

How would you model an objects representing different phases of an entity life cycle?

I believe the scenario is common mostly in business workflows - for example: loan management the process starts with a loan application, then there's the loan offer, the 'live' loan, and maybe also ...
1
vote
4answers
461 views

Explanation needed, for “Ask, don't tell” approach?

I'm taking a course on design patterns in software engineering and here I'm trying to understand the good and the bad way of design relating to "coupling" and "cohesion". I could not understand the ...
8
votes
4answers
721 views

How do we keep dependent data structures up to date?

Suppose you have a parse tree, an abstract syntax tree, and a control flow graph, each one logically derived from the one before. In principle it is easy to construct each graph given the parse tree, ...
6
votes
1answer
1k views

Understanding Visitor Pattern

I have a hierarchy of classes that represents GUI controls. Something like this: Control->ContainerControl->Form I have to implement a series of algoritms that work with objects doing various ...
1
vote
0answers
138 views

How should Object Model wrapper classes behave when underlying objects are deleted?

I'm currently building an object model library for use in a project. It wraps our internal concepts - Servers, Folders, Items - in an object hierarchy (IFolder, IItem, etc), and we have several ...
1
vote
2answers
184 views

Pattern / methodology for representing large database records as objects

A bit of background information: We have an old database application written in Access that lets users monitor their workload, and the code is... 'procedural' might be too kind. The vast majority of ...
1
vote
2answers
329 views

A better alternative to incompatible implementations for the same interface?

I am working on a piece of code which performs a set task in several parallel environments where the behaviour of the different components in the task are similar but quite different. This means that ...
1
vote
3answers
150 views

Force user to extend class or use configuration

What is better practice: force user to extend abstract class or make class with configuration? Eg. pseudocode: ClassA{ this.name this.weight this.height this.width constr(config){ this.name = ...
0
votes
1answer
171 views

Architecting Domain Layer and other modules with dependency injection in mind

I am currently new to Dependency Injection pattern. I am influenced by link by Mark Seemann. I have a confusion regarding whether an interface for an agent class of some agent module should be ...
2
votes
5answers
455 views

How to handle assumptions while designing any system?

I have been going through various system design examples to understand how we approach any system design question. Here is what I have understood till now. Know the system first and find out how it ...
1
vote
1answer
109 views

Where to put entity model classes in case of using a dataservice layer?

If my solution has both a "dataservice" project and a "business logic" project, where do the entity models, which represent database tables, belong? At first i thought putting them in the ...
0
votes
1answer
131 views

How should I implement “queueing” of approval on my objects?

I have a list of objects that will need to go through an approval process. I am curious if it would be best to simply add some properties to my object, like ApprovedBy, and ApprovedOn. Another ...
1
vote
1answer
152 views

Component design: getting cohesion right

I currently have a set of components named DataValues, ValueParsers, ValueFormatters and ValueValidators. The first one defines an abstract base class DataValue and contains a whole load of ...
6
votes
3answers
646 views

Is it a good practice to wrap all primitives and Strings?

According to Jeff Bay's Essay on Object Callisthenics, One of the practices is set to be "Wrap all primitives and Strings" Can anyone elaborate on this ? In languages where we already have wrappers ...
2
votes
1answer
145 views

Help me to understand following points about the strategy pattern, how it relates to open/closed principle

I am learning design patterns. I read this article. Point no. 3 is not clear to me. The writer said that strategy lets you change the guts of an object. But this is a violation of the open-close ...
2
votes
2answers
378 views

Is it a Single Responsibility Principle violation?

I'm designing an OO graph library and at the moment I'm trying to figure out the design for a GraphEdge class. I've added setters and getters for it's nodes, direction and weight. This seemes ...
1
vote
1answer
142 views

Design pattern advice required for sending xml files to different destinations

I am using an Export Module, now I want to extend it for different connections. I have a database which contains products Its Description, Review, Images etc. I use the serialize function to save it ...
0
votes
2answers
235 views

Which could be a good design pattern for complex numeric calculations between three or more different data models?

The source code I'm working on at the moment performs numeric calculations between a bunch of different properties belonging to different data models. All the calculations are coded in a big method ...
0
votes
3answers
278 views

Object design where hard-coded values are used to instantiate objects?

I'm creating the design for a browser bookmark merging program and I've ran into a design problem that I've seen before yet I've never come up with a good solution for it. So lets say I have a ...
-1
votes
2answers
121 views

Design suggestion required to create an Export plugin

I am trying to create Export Module for our application, this seems to me a bit complex so I am posting it here to get some guide lines. In our database we have a list of Products, which can be ...
2
votes
2answers
227 views

Where should I parse data obtain with a DAO

I have a DAO that brings data from a web service, that data comes in a string, in the likes of: *NAME|John Doe *DATEOFBIRTH|1978-23-01*ID|anID123 (...) I have a DTO that I wanna fill up with the ...
3
votes
2answers
165 views

Are there any well-known quantitative approaches to evaluate a particular design whether it satisfies or violates the SOLID design principles? [duplicate]

I designed an application framework by considering the SOLID design principles and supported by design patterns. However, I wonder if there are any automated tools or well-known approaches to evaluate ...
0
votes
4answers
1k views

Best OOP design pattern for a sequence of operations

I am working on an application, a module of which does the following financial operations sequentially: When a user requests for a certain amount to be transferred into her bank account: check ...
0
votes
1answer
65 views

Program Structure for Table Cells Representing Objects

So I have a program with "cue" objects and each have their own table cell. The thing is that the table cells have loading bars on them that represent the progress of the cues. This presents the ...
0
votes
2answers
153 views

How to design member access for an Article-type class? [duplicate]

I am doing a final project in a C++ class writing a very simple usenet-like client/server. I figure that since it's usenet-like I'll have a NewsGroup class and an Article class, I'm now working on my ...
4
votes
2answers
277 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 . ...
2
votes
2answers
174 views

Changing __class__ in a factory?

I'm parsing a set of XML files of different kinds (these kinds are known in advance). These are my requirements: I want an object to represent each XML document (object-xml mapping) I'd rather ...
3
votes
3answers
677 views

Visitor stability vs instanceof flexibility

I am writing on a GUI program which allows for the visual creation of some configuration file. I have a class hierarchy for the configuration model and I use an object tree of that hierarchy in ...
1
vote
1answer
80 views

How to get a reference to a central AssetLoader in every Widget?

I'm working on a simple UI system for a game. The building blocks are Widget objects, which can contain each other. There are several sub classes of Widget, e.g. LabelWidget, ImageWidgetand ...
2
votes
4answers
995 views

Good design pattern for a c++ wrapper around a c object

I have written an extensible c++ wrapper around a very hard to use but also very useful c library. The goal is to have the convience of c++ for allocating the object, exposing its properties, ...
1
vote
1answer
370 views

Liskov substitution and abstract classes / strategy pattern

I'm trying to follow LSP in practical programming. And I wonder if different constructors of subclasses violate it. It would be great to hear an explanation instead of just yes/no. Thanks much! P.S. ...
3
votes
4answers
300 views

Representing complex object dependencies

I have several classes with a reasonably complex (but acyclic) dependency graph. All the dependencies are of the form: class X instance contains an attribute of class Y. All such attributes are set ...