Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

0
votes
2answers
85 views

Is an OS kernel a singleton?

In my understanding, a singleton design pattern is where we have only one instance of an object in a system. I am not sure on this part of the definition, but I believe in an OS there is only one ...
0
votes
2answers
111 views

Pattern name for a class inheriting of a generic based on itself

I'm wondering if there is a name for the pattern of defining a generic class with one type argument where the type inherits the defining class. For example public class A<T> where T : A<T&...
3
votes
2answers
129 views

Object Oriented vs. Procedural Processes in Embeded System

I'm currently developing a controller for an industrial application which takes data inputs from various sensors and interfaces (ethernet, serial, etc.), does some minimal processing, and adjusts ...
1
vote
2answers
114 views

Which design pattern for combination of objects in Java?

I am looking for the best approach to design the following system : I have a class of object, called Compilers (C, Go..Etc) I have another class of object, called Protocols (HTTP, RPC, WEBSOCKET..Etc)...
4
votes
3answers
111 views

Create a single class to map different object to a target object?

I have a service (S) that receives an object of type 's', this service will be called by several classes (maybe 6) and each class has their own object a,b,c, etc. with the information necessary to ...
1
vote
2answers
37 views

Is NSNotification in iOS a good design?

Because of some essential C++ libraries, I have to mix Objective-C and C++ in my code. But the problem is that the callback between C and Objective-C is extremely hard to design and manipulate, so I ...
0
votes
1answer
85 views

Should services be used in a ViewModel

So I have a service which is injected in my controller via dependency injection. I can either use it in the controller multiple times to convert a value when assigning to a particular property in a ...
-1
votes
0answers
68 views

Looking for a Design pattern [duplicate]

I am looking for a fitting design pattern. What I have is a sequence of processes that all use results of one or more of the previous processes. Something like this in pseudocode: List<B> = ...
-1
votes
1answer
45 views

Best OOP practices for object accessing “aggregate object” members?

Is there a best practice for something like this? (Example in C++) class A { public: int usefulParameter; std::vector<B*> bContainer; }; class B { public: void ...
2
votes
5answers
231 views

How to pass command line parameters to various parts of program

Consider a large program with many different parts that have a single command line interface, as is the case with most applications. How best do I handle passing various command line parameters, that ...
0
votes
0answers
42 views

Check if exists user_id when create user

I have User class class User{ public User(string id){ this.User_Id = id; } public string User_Id{get;private set;} } When I create User in Application Layer.I am checking if exists any user ...
3
votes
2answers
158 views

How to design users class

I have been developing Cloud Broker system so I have Users. Users can register with phone number and code. How should I design the User class? Class User { public string User_Name{get;private set;} }...
2
votes
0answers
71 views

Creating bindable input handler in C++ spanning two separate modules

I have a wxWidgets application. This is the first, main module. The second module is an openGL engine. It's a model-view-(controller) structure, where application is the view (and the controller), ...
0
votes
1answer
111 views

Variable vs value in a user interface label as a method parameter

Imagine I have updated a user interface label with a value. Since this is a label, end user cannot update the value directly and can only be changed through code. Lets say the value is X. X could be ...
2
votes
0answers
57 views

Memento and releasing resources

Let's suppose we have a class whose state has to be saved and later restored, and we resorted to the Memento pattern for that. What if the state includes resources that have to be explicitly ...
2
votes
1answer
135 views

Designing a pause'able & resume'able task handler

I don't think the title describes the situation exactly. I apologize for the poor description. I'm trying to write a software system, in C++, that will have a heavy job (scanning the file system for ...
0
votes
1answer
88 views

Memento for inherited class

I have the following question. I have an abstract class that manages graphic elements. Let's call it GraphicHost. Something like that: class GraphicHost { class GraphicHostState { List&...
3
votes
5answers
274 views

Using a variable to indicate object type

The use of instanceof or getClass() is largely considered code smell. Is using a variable to indicate the type of object you're using also considered code smell? Suppose if I had an enum called ...
0
votes
2answers
122 views

When methods could be applied to more than one object

I was reading on this slide show presentation about Elder Scrolls 6. The author writes: Add some different directions to swing your weapons, more tactical options, feinting, parrying, literally ...
2
votes
2answers
150 views

Input based data fetch optimization

Is there a cleaner/ better readable way to maintain and iterate many-many mapping rather than multiple if conditions ? (One way would be to store the mapping of ReportType -> DataSet Req. in the ...
1
vote
3answers
208 views

Rethinking inheritance when subclass implements interface

Suppose if I have an abstract Weapon class, and the subclass ReloadableWeapon which implements the interface Reloadable. interface Reloadable { void Reload(); } public abstract class Weapon{ @...
0
votes
1answer
78 views

How to define a system class?

My course notes have stated that a system should have a system class which coordinates the behaviour of all other objects in the system and should be one which is instantiated only once. In many ...
2
votes
2answers
69 views

Is ER model used in database design and software design the same thing?

ER model appears in both database design and software design. I was wondering if ER models in both designs are the same concept? If not, what are their differences? Thanks.
0
votes
0answers
52 views

Preferred way to implement protobuf-based classes in Python?

I'm working on a distributed application that will use protocol buffers as it's core interface definition language. While am amazed how pleasant protobufs are to work with in a networking context I'm ...
0
votes
0answers
67 views

Game Model Architecture?

Just for background, this is a project using Swift and GameplayKit. I've dealt with MVC and simple design patterns and architecture. Shout out to this thread(What architecture should I use for my game ...
1
vote
1answer
47 views

Resolving Higher/Lower level component dependency

I have a .NET application (actually this can be a problem for any N-Tiered application) which has 3 separate components. ClassLibrary Has Cross Cutting Concerns like logging, authentication and IoC ...
7
votes
6answers
1k views

How to know when to use dependency injection?

The question might sound a little weird, and I guess it is. I'm came up with the question while browsing through some design patterns. I came to the notorious state / strategy pattern and I came up ...
1
vote
1answer
90 views

How to fetch data based on id from isolated code cleanest way?

I'm working on client-server application. Client architecture (class hierarchy) looks like this: System (name is of course different, more descriptive) - represents whole system Module A - a class ...
0
votes
0answers
48 views

Creating a central repository for repositories with related data?

I am building a website for a fruit company. In my database I have a list of countries, and for each country, a list of distributors that sell my fruit products. The country and distributor are ...
0
votes
1answer
85 views

Subclassing a Singleton class

When do we need to subclass a Singleton class or in other words, is it good to subclassing a Singleton? If its generally allowed what would be the pros and cons and how to handle or get instance from ...
0
votes
1answer
128 views

UML Class Diagrams - Too many associations?

I have recently started a course in software development and I'm having some confusion over modelling my system in a Class Diagram. The context of the system is as follows: The user wants to calculate ...
0
votes
2answers
70 views

I have two different account types that can do different things in a Single Page Application. Should I turn it into a Multiple Page Application?

In my new SPA (Single Page Application), I have teachers, which can make tests, and students, which can take tests, subscribe to teachers, and view their grades. This means that in JavaScript, they ...
3
votes
2answers
100 views

Object design: Class property vs. list of objects

We have an object-oriented database. So, our persistence is truly object oriented. The example is the object person and the attribute VIP. We have to store, if a person is a VIP or not. Usecase: ...
0
votes
0answers
39 views

Designing currency exchange class

I am writing a small library to get the currency exchange rate, at present the data is being gathered from European Central Bank which provides exchange rates from EUR. The rates are updated daily ...
1
vote
4answers
512 views

Why the industry prefer/use composition over inheritance? [duplicate]

I was having a discussion with few friends about inheritance and composition and what I learnt from that discussion is that the use of inheritance more or less condemned in industry nowadays and ...
1
vote
2answers
126 views

How to model my Child Classes without violating OO Principles

I am trying to model an external system in Java and running in to some issues. I have a handful of related types that I have mapped together through abstract (and sometimes concrete if it made sense) ...
-1
votes
1answer
114 views

When to Method and when to Class? [closed]

Following SOLID first principle, the Class should be responsible for only a single part of the functionality provided by the software. The same, I guess, goes with the Methods design principle. They ...
-3
votes
1answer
68 views

What constitutes AGILITY where Behavior-Driven and Unit Testing are concerned

This morning I had a presentation on PHPSPec which the official website describes as follows: A php toolset to drive emergent design by specification. As defined within an adjective context the ...
0
votes
1answer
80 views

Class definitions in static getter methods

[Node.js / CommonJS] I'm creating a single GitHub repo for my tool which has a Core, Control, Server, and Client library. It's unlikely that all of them will be used at the same time. I'd like my ...
1
vote
2answers
114 views

How to refactor code when capturing calls made to an API service

I am currently in charge of designing the API of a new service. It started simple enough, 10 different URIs or so were allowed. I knew I was not doing the best code, but frankly I did not see a better ...
1
vote
2answers
164 views

Implementing interfaces vs using a base class

I am writing an application in python. The part I am little confused about is providing a little structure to my code. This is the basic requirement of my web application. I have these different ...
-2
votes
2answers
78 views

When should you create a subsystem?

I'm looking into system architecture and can't seem to figure out when you should create a subsystem/what deserves its own subsystem. Common examples I have seen include: Input Database Networking ...
0
votes
1answer
58 views

Dealing with Complex Value Objects

I am working with Martin Fowler's definition as a working base. I have a class called Condition that I am having trouble properly classifying. What makes me think this might be a value object: A ...
1
vote
2answers
98 views

Design for 2 closely related (1 for 1) classes that may alter each other

I have a program that communicates with an API to get information on different organizations, so I have an Organization class and an ApiCall class which are both closely related. As the API I'm using ...
2
votes
2answers
56 views

Is a file hosting server a secondary actor in a “Play a Video” usecase?

I have a use-case named "Play a Video" in my project. The video is played from a purchased webserver on which i host the video only for my application's use.Now in the "Play a Video" use-case is "File ...
1
vote
2answers
123 views

Are repeat, forward, rewind and stop extending usecases of the base usecase “Play Music” in a music player?

I am confused in a scenerio, where i have a music player that has a music playlist. I need help on the following usecase of the music player. Title : Play the music playlist Precondition: ...
0
votes
0answers
108 views

Abstract Factory of Composite Builders - Dependency Injection?

I was hoping to get some help on a mixture of complex design patterns. I will do my best to simplify the issue using very basic examples. Modularity is a very big need in this system as well as ...
1
vote
2answers
83 views

How to implement Domain Model with Repository without leaking responsibility?

Imagine, we have test modules with large number of questions and we can create tests which will contain exactly 30 questions. public class Module { public long Id { get; set; } public List&...
0
votes
1answer
73 views

AST design: Call is both expression and statement?

I'm designing the AST for a compiler and found that I don't actually know how to represent the Call node. Currently, the relevant part of the AST looks like this (where the arrows denote inheritance):...
3
votes
2answers
352 views

What differentiates function objects from poltergeists?

The Short (Original) Version How are function objects, sometimes called "functors" in C++ and other OO languages, where they make sense different from classes symptomatic of the poltergeist anti-...