Object-oriented design is the process of planning a system of interacting objects for the purpose of solving a software problem.
5
votes
1answer
71 views
Functional core for elevator system design
How can Gary Bernhardt's "Functional Core / Imperative Shell" architecture be used to design software for an elevator system?
Specifically, let's say there are a few elevators, each with call buttons ...
0
votes
0answers
37 views
Implementing A Set of Rules
I have been tasked at work with implementing what I can only refer to as a rule interpreter. Part of my job is to identify production errors as they occur with shipment codes, and we are looking to ...
1
vote
0answers
128 views
Design elevator system algorithm and classes? [on hold]
Here are the main classes I can think off the top of my head. All business objects will follow the abstraction (implement interfaces). I have not mentioned interface names
to avoid verbosity. I have ...
2
votes
0answers
80 views
Design Pattern for Internal Builder
There is an object which is very complicated to build and many algorithms needed to figure out how it should be created (for your curiosity it is an object that represents and draws the beaming of ...
5
votes
4answers
131 views
Immutable vs mutable mobile object
I need to model a very simple mobile object (Robot) on a rectangular grid. Its state is described by position (basically a pair of integers) and direction (e.g., N, E, S, W). It only has two methods (...
119
votes
12answers
15k views
Did the Gang of Four thoroughly explore “Pattern Space”?
Ever since I first learned about the Gang of Four (GoF) design patterns, at least 10 years ago, I am having the impression that these 23 patterns should be only a small sample of something much larger ...
9
votes
4answers
96 views
When following SOLID, are reading and writing files two separate responsibilities?
I'm just starting to explore SOLID and I'm unsure if reading from files and writing to files are the same responsibility.
The target is the same file type; I want to read and write .pdf's in my ...
5
votes
4answers
458 views
Does it violate any OOP principle if a member function does not use any of class properties/member variables?
I have an existing class which interacts which can open, read or write to a file. I need to retrieve a file modification for that purpose I have to add a new method
Suppose this following is my ...
3
votes
4answers
126 views
Hierarchical structure that needs to enforce availability
The project I am working on has deep parent/child relationships that needs to enforce availability.
Imagine we are a large Worldwide Electronic Seller (Best Buy) and selling mobile phones
We have ...
0
votes
1answer
87 views
What architecture/guidelines should be considered to write reusable module of project?
Introduction
I am working on MyProject which is windows (desktop) application being developed in C#.NET and DotNet Framework 4 in WPF. Project is layered as DataAccessLayer (DAL) --> ...
5
votes
2answers
249 views
Separating business logic on code
I have a Category and Product tables in database and classes on project.
Category class has {id, Name} properties
Product class has {id, Name, CategoryId} and other relations.
And I have repository ...
0
votes
0answers
105 views
Should all classes and interfaces ultimately derive from one Class, and how does this affect type safety?
If I have "Object" as the top level class, then I have various interfaces, ISomething, ISomethingB, ISomethingC, then I have Class x,y,z, all ultimately deriving from the class Object (these ...
3
votes
1answer
81 views
How would one avoid circular object references when each element in a collection can possibly interact with any other element?
I have a class called Canvas that acts as the container for a number of Rectangle.
The Rectangles have the following behavior:
They can be moved within the Canvas.
They can be resized.
They may not ...
4
votes
5answers
256 views
Should a Match keep a list of Players or should a Player keep a reference to its Match?
In the game I am working on there is a Match object and a Player object.
The game is divided into different Matches (basically a lobby). Every Player needs to be in a Match but cannot be in several ...
1
vote
1answer
74 views
Override method with subclass as argument
When you want an overrided method to take as argument a subclass of the argument of the overridden method, you usualy accomplish that with generics (as discussed in Template pattern with varying input ...
0
votes
2answers
100 views
Repository Pattern with Multiple ORM
We are developing the application with MVC and Repository Pattern. Currently we are using EF as an ORM. But Later we need to change the ORM to nHibernate.
Any Idea on the architecture.
Currently I ...
1
vote
3answers
168 views
Handling diverse “plugins” while staying sane
My colleagues and I are struggling with a design problem. I'll try and explain
the situation:
We have a number of different components (let's call them plugins), that take
an input, do something ...
2
votes
1answer
143 views
Backwards inheritance in OOP to model a real-life taxonomy [duplicate]
Is there a way to use the existing features of object oriented programming languages to work around the square/rectangle problem?
Can a child be defined in terms of being a more restrictive subset ...
6
votes
9answers
796 views
Are init() methods a code smell?
Is there any purpose for declaring an init() method for a type?
I'm not asking whether we should prefer init() over a constructor or how to avoid declaring init().
I'm asking if there is any ...
1
vote
1answer
82 views
Design a java based menu so that it's easier to add new options
I am trying to create a java console program which displays a Menu with few options. Each option selection performs some independent operation say executing a script or performing some db operation, ...
0
votes
2answers
68 views
Keep consistency when items can be in several classes
I'm having a difficulty to figure out relating an item to classes properly.
For example, I have a business directory website that shows profiles of different companies according to the products/...
3
votes
2answers
136 views
How to reconcile these two requirements?
I'm developing a system on which there are two requirements that seems to be in conflict. Since this seems to be a situation that can be more general, I thought it to be valid to ask here.
The system ...
3
votes
2answers
91 views
Interface declaration - latest vs historical
Imagine there is an interface IPriceProvider which supposed to serve 2 needs: historical and latest. So I think we have 2 options here.
First:
PriceInfo GetLatestPrice(string symbol);
PriceInfo ...
4
votes
4answers
303 views
Design Pattern for Indirectly Connecting Two Classes
Admittedly, this is a homework problem but I have tried to figure it out on my own. Just want to make sure I get it correct. So far, the only design pattern I believe to be correct would be the ...
3
votes
2answers
146 views
Design pattern for free / premium user role
this question is actually about a complex java project I am doing at university, but it is possible to find a simple case which is really similar to the problem I am facing.
In this scenario, we have ...
3
votes
5answers
450 views
Start Method vs. Setting up everything in constructor
The internal framework my company uses has a pretty pivotal Object that has a pattern of being instantiated as a member of a class with a no argument constructor but to be usable you have to call a ...
1
vote
1answer
82 views
Pattern for dealing with different File Types
In my application I fetch files from the user and process it.
Im to limit to a certain scope of file types and each one of these has a different processing approach.
How can I design the application ...
-2
votes
1answer
66 views
Is there a common term for class roles?
In object oriented design, we define solution domain with classes. We give a particular role to each class such as factory, data transfer object, serializer, validator, service, proxy, adapter, etc.
...
0
votes
2answers
203 views
Let an object be configured by another class
I am currently planning a monitoring server for a distributed system. In a file (or maybe a database, someday) I save all the servers and parameters that I want to monitor. When the monitoring system ...
2
votes
3answers
150 views
What does the following definition of an interface mean?
I am reading Real-Time UML Workshop for Embedded Systems and I do not understand what they are saying here. I have bolded the parts of the text that I do not fully understand. I am trying to ...
2
votes
1answer
111 views
Flyweight Pattern : UnsharedConcreteFlyweight
Here is the flyweight pattern structural diagram:
Here you see UnsharedConcreteFlyweight which GoF explains:
UnsharedConcreteFlyweight :
Not all Flyweight subclasses need to be shared. The ...
-4
votes
1answer
51 views
In internal computer memory Char value ,string and integer how they differentiate time of storing and retrieving
In internal computer memory Char value ,string and integer how they differentiate time of storing and retrieving .
Char A =ASCI value 127
Int value 127
Binary is same then how computer ...
-1
votes
1answer
78 views
abstract classes or other generalization classes?
i have a question about software engineering best practice.
Let's consider a class "User", with 2 subclasses "Student" and "Teacher"
if we need to specify some data for "University special council" ...
3
votes
2answers
195 views
Where to put “orchestration” code
I have a web application implementing the MVC pattern where I have controller classes whose methods each map to an HTTP request.
I also have a service layer with a bunch of service classes, with each ...
2
votes
1answer
34 views
Encapsulate multiple retrieval methods for a class
I'm doing a little bit of cleanup and I'm trying to gather all the spread SQL queries done to an object into a single place. I have a class whose responsibility is to present a CRUD interface to the ...
1
vote
0answers
56 views
When to make classes that do multiple things? [duplicate]
When is it advisable to write a class that can do multiple things?
A bit of background: my boss prefers to write things that can be used over and over again. While I tend to agree with this sort of ...
4
votes
1answer
97 views
Comparision of modeling with inheritance vs idiomatic trait based composition
I recently I started learning Rust and Scala and what struck me was the lack of inheritance model that I'm used to in C++ and Java.
Although I can model simple things with structs and traits in Rust,...
4
votes
1answer
119 views
Can the command pattern be applied to a turn-based Pokemon game?
I'm writing the core logic of Pokemon Gen I in Java (8), and I am struggling to figure out the best way to implement the turn-based aspect of the game. Right now I have a Battle class which has two ...
2
votes
1answer
83 views
Understanding the worker layer in software architecture
I'm new to Java, I've been mostly a scripter. I recently started working at an all Java shop and have been investigating the architecture. I've encountered more than one project with a directory ...
2
votes
1answer
85 views
Two data sources merged
I have a save game editor. It uses a library that can read the file and return it in a form of an object. Within that object is an ItemSave object.
Also, to be able to interpret the data in the ...
1
vote
1answer
66 views
When to create an in-memory object to manage repository records?
Suppose I have a conceptual Ledger that is populated with Line Items. Assume that Line Items themselves are stored in some type of persistent storage. The ledger is shown to the user who can add/...
0
votes
1answer
118 views
Designing an Order service that accepts many types of orders
I've been having some trouble coming up with a design that would alleviate most, if not all, the issues I've been running into, and I'm wondering if it is my base design.
Our company accepts orders. ...
0
votes
0answers
21 views
Way of filling collection in generated web service class without boilerplate
I have generated classes:
class ServiceCatalogFilterType {
protected IdentifierListType verticalIdList;
protected IdentifierListType packetIdList;
// many lists
}
class ...
4
votes
2answers
118 views
Design of a “storage object” - object used soley to store data
I have a file editor. It reads from a file, creates an object with the read data and can then write that data into a same (or another) file.
Every time user opens a file a new tab is created and a ...
1
vote
1answer
150 views
Review of my OOP design for simple password manager
I'm going to write a simple password manager, which is going to store my accounts encrypted. Here is description of the classes ,
LoginManager - This class will be responsible for authenticating the ...
-3
votes
2answers
113 views
Can we fix Singletons testability tight coupling?
It is well known that Singletons are anti-patters for several reasons:
tight coupling
singletons are pathological liars
no testability
inheritance is not available
you cannot program to interfaces, ...
0
votes
2answers
84 views
Creating instances of an ability when there are multiple different type of abilities
I'm creating an RPG game where a player has a set of skills, each of which he can level up to improve its effect. Here are two example skills:
health: increase player's maximum health
regeneration: ...
0
votes
1answer
70 views
Message queue between server and engine
I'm planning on using a message queue for communication between a game engine and game server. This should allow me to write both without direct dependencies on each other.
The example that I'll use ...
3
votes
2answers
246 views
What public interface should I offer for creating objects that know about each other?
I'm creating a library in C# which will be used to query databases.
In order to use this library, a user first needs to tell the library what the database schema contains, by creating Schema, Table, ...
2
votes
0answers
80 views
Two-way adapters
In GoF there is a two way adapter concept:
A potential problem with adapters is that they aren't transparent to
all clients. An adapted object no longer conforms to the Adaptee
interface, so ...