Object-oriented design is the process of planning a system of interacting objects for the purpose of solving a software problem.

learn more… | top users | synonyms

1
vote
5answers
121 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
58 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
60 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
120 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
86 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
285 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
135 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
422 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
78 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
65 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
172 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
142 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 ...
0
votes
1answer
95 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
182 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 ...
1
vote
1answer
27 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
54 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 ...
3
votes
1answer
85 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
113 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
77 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 ...
1
vote
1answer
75 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
64 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
90 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
143 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
109 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
68 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
228 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
75 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 ...
1
vote
2answers
120 views

Trouble with circular dependency in state machine design

I am trying to develop the structure for a basic state machine that can also take in input and produce output. I've hit a bit of a mental block in trying to figure out how to model the relationship ...
0
votes
1answer
141 views

Designing a small object-oriented interpreter

I'm building a small interpreter for a language I created. The grammar, lexer and syntax analyzer are already done. What's confusing me is the interpreter part. I know interpreter pattern, but it ...
1
vote
2answers
62 views

Public Data Object but privately accessible field to select class

This is a software design question. Not sure how to ask, so I'll illustrate with a scenario. I'll update the title to help reference for others if there is a better way to ask. Scenario BizLogic is ...
2
votes
1answer
102 views

What to include in a Database class

I am currently developing a java application, which will communicate with a SQL server. Therefore I created the class Database which is responsible for open() and close(). I want to be able to add ...
1
vote
2answers
121 views

When should a Callable<Foo> be returned over a Foo?

I have a repository that contains login credentials interface LoginCredentialRepository { LoginCredential fetchCredentials(String username); } For this framework, I'm designating one thread to ...
13
votes
5answers
2k views

Why shouldn't static methods be able to be overrideable?

In answers to this question, the general consensus was that static methods are not meant to be overridden (and thus static functions in C# cannot be virtual or abstract). This is not only the case in ...
0
votes
0answers
51 views

Should a new interface be created if it doesn't add anything to the contract (yet)?

I'm writing an API for a bunch of different aspects of my project. I have some code that currently looks like interface LoginCredentialRepository { Callable<LoginCredential> ...
1
vote
2answers
88 views

Dependencies between class attributes

I wonder whether there is a concept for attribute dependency in object oriented terminology? It's an example showing what I mean with attribute dependency: 2DShapeclass may have an areaattribute. ...
2
votes
2answers
82 views

Setting class/methods conditionally

I want to keep the end-user (often myself) from being presented with inapplicable methods when coding directly in an interpreter, but I also don't want the user to have to inspect the incoming data ...
1
vote
1answer
111 views

Refactoring Password Validation Utility

Given a password, I am trying to validate if it passes all validation rules such as Be at least 6 characters long Contain at least one letter (a-z or A-Z) Contain at least one number (0-9) ...
1
vote
1answer
46 views

Choosing the right class at runtime

This is a general software design question. My program is written in Java, but I suppose my question applies to any object-oriented programming language. The best way for me to explain my situation is ...
0
votes
2answers
66 views

Implementing a publicly-editable tree where each node must hold private implementation data

I am trying to implement a tree data structure that callers of my code edit for me to operate on. The idea is that the caller can hold a reference to nodes from the tree and modify their data (both ...
6
votes
5answers
191 views

Choose only one of several inheritances

I may look like a total idiot with such a question but nothing came up when I searched it, so I guess why not. Here is my problem: I'm doing the UML work for a C++ game, that will feature animals ...
1
vote
2answers
169 views

Help with getting rid of circular dependency

I have the following circular dependency that I'd like to eliminate. I think I must have a flaw in my design. And I'd much appreciate any feedback on how to fix this. My circular dependency comes ...
1
vote
2answers
100 views

Exposing capabilities with a collection of enum values or with boolean functions

High-level explanation I have an object with some methods: public class Foo { public void Bar() { } public void Baz() { } } These methods cannot be executed unconditionally, there is some ...
1
vote
2answers
109 views

Would it be good practice to separate a user entity and a user profile entity?

When designing a system that displays information about an entity (but where modification of the data is rare or restricted to few users - such as a user profile), would it make sense to have two ...
1
vote
2answers
182 views

Formulating a more sensible constructor method

This question is in the context of an Android application written in Java. I have this class which performs a specific action and returns the result of such action with a callback implemented in the ...
1
vote
2answers
84 views

Processing and sending processed data to super from child class constructor

I want to do some initialization in child class constructor and pass result to super(). But Java doesn't allow any processing in child class constructor before super() call. Whats a good way to ...