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

Questions tagged [object-oriented-design]

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

2
votes
2answers
272 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
109 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
55 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
1k 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
155 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
115 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
70 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
179 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
227 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
187 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
91 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
63 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
100 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
61 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
125 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
180 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
102 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
197 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
381 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-...
8
votes
3answers
531 views

Communication between decoupled components using events

We've got a Web App where we have a lot (>50) of little WebComponents that interact with each other. To keep everything decoupled, we have as a rule that no component can directly reference another. ...
16
votes
4answers
1k views

Unable to solve mystery of functions in Javascript

I am trying to understand behind the curtain scenes of Javascript and kind of stuck in understanding the creation of built in objects, specially Object and Function and the relation between them. ...
42
votes
8answers
11k views

Class that does not represent anything - is it correct?

I am just designing my application and I am not sure if I understand SOLID and OOP correctly. Classes should do 1 thing and do it well but from the other hand they should represent real objects we ...
2
votes
1answer
468 views

Domain Model vs Service in a MVC context

At the end of this article from Martin Fowler there is this sentence: In general, the more behavior you find in the services, the more likely you are to be robbing yourself of the benefits of a ...
3
votes
1answer
91 views

Modelling the domain

I am working on the domain model of an application that stores information provided by sellers about the goods they sell on a platform. The application just acts as a data store for this information. ...
15
votes
4answers
3k views

Java - Is it a bad idea to have fully static classes?

I'm working on a larger solo project and right now, and I have several classes in which I do not see any reason to create an instance of. My dice class right now, for example, stores all of its data ...
3
votes
4answers
386 views

concerns about constructor dependency injection logic

There is a kind of rule in dependency injection literature, stating that we should declare all arguments in the constructor, in order to have a constructor injection, which is better than other ...
7
votes
1answer
242 views

Should every method in a class be defined in an implemented interface?

I can see how interfaces are very useful to force different classes to have the same functionality. But there are also actions that are bound to a specific class (like updating an unique variable ...
1
vote
0answers
69 views

Should I pass presenter to use case when implement clean archeiture using scala

This question came to me when I was trying implement Clean Architecture using Scala, and come across this post. In the accepted answer, @candiedorange emphasis on the separation of responsibility, ...
1
vote
3answers
183 views

object1.action(object2) vs object2.action(object1)

I apologize for the potentially misleading and ambiguous title; I've tried to generalize it as best as I can. I am currently working on an OpenGL project in C++. I wanted to wrap a couple of OpenGL ...
3
votes
4answers
176 views

Circular Interface references

I've heard circular references are generally an issue, however I was wondering if this was true for interfaces that reference other interfaces, for example: IQuestion{ IAnswer getCorrectAnswer(); ...
1
vote
1answer
97 views

How to verify that every object responsible for Itself

I wonder if I have multiple objects and how to list their responsibilities where every Object Must be Responsible for Itself for example: If I have three objects: Employee,Schedule,Shift. and ...
1
vote
2answers
178 views

Depending on Dependencies

public class Connection : IConnection { public Connection(Uri baseAddress, ISerializer serializer) { BaseAddress = baseAddress; Serializer = serializer; ...
0
votes
0answers
278 views

Class Model Diagram vs. Concept Class Diagram?

In the requirements engineering process of gathering requirements, etc., models are used to depict the relationship between various entities. The two mentioned models are just two but I'm trying to ...
4
votes
3answers
505 views

OOP PHP: How to avoid each class for each table situation

I am working on a project of an online service provider. I have tables for admin, agent, customer and tables for data storage like city, services, category, sub-category, gender. I have created ...
1
vote
1answer
89 views

What is the solution of enum based dynamic states and actions used in a project

I have recently started working on a project where we have a workflow engine which has flexibility to add dynamic states and corresponding actions for each state and all these are stored in database. ...
4
votes
2answers
383 views

I'm struggling to see how dependency inversion doesn't lead to tighter coupling in lower level modules and less reuseability

I'm refactoring a project I did for my work and I'm trying to apply the SOLID principles to make the architecture cleaner. I've run into an issue with the Dependency Inversion Principle that I can't ...
-1
votes
1answer
150 views

Should a graphical user interface implement Propertychangelistener or it's objects?

I was learning about design patterns and i came across a line where a domain object has to update it's view using observer design pattern. In the book , Applying UML and design pattern, It says Let ...
1
vote
1answer
123 views

How to manage a lot of little worker processes

So I have this idea i'm playing with to make my own neural network experiment from the ground up as a fun hobby exercise, so I have something to learn, and to expand upon in doing research for what I ...
1
vote
1answer
138 views

Is model aware of Controller

There are already many useful answers about MVC. Most of the topics clearly state how controllers and view interact. A controller is aware of model but is the model also aware of Controller? A ...
1
vote
2answers
99 views

Class Divisibility Metric

A few years ago I was using Sonar (before it was SonarQube) to analyze some Java code, and I remember seeing a useful metric that would come in handy again today. However it does not appear to be ...
1
vote
3answers
179 views

Class invalid flag vs exception

So i have the following. I read in lines from a text file. Each line needs to be analysed and get the important data extracted (I wont go in the details here). I worte a Parser class which does this ...
2
votes
2answers
114 views

Design an audience-based system

Background I designed a social-media application (such as Facebook) where there is this strong concept of audience-based content system. For example, let's say this user A can create posts (public, ...
1
vote
1answer
207 views

Passing ServiceLayer's services to WCF service

I want to expose my business logic via WCF service in the intranet environment. I have N-tier architecture, pretty simple: Database -> .Data (DAL) -> .Business (Service Layer) -> WCF So, far I have ...
2
votes
2answers
96 views

Trait and Implementation vs just Implementation

In my previous Java job, we tended to avoid defining interfaces for everything unless we genuinely had multiple implementations for it. This may just be my opinion, but if there is only one ...
0
votes
2answers
299 views

How to design classes in php in respository pattern?

I use laravel with repository pattern. My project strucuture is: I have an Entity class(POPO) which implements an Interface and has a repository class related to it. For example for a User Entity, ...
0
votes
3answers
120 views

Handling inconsistent state of domain objects

In general, I would my domain objects (customer, contract, etc.) to be always in a consistent state. However there are situations, where they might be in an inconsistent state, and nevertheless I want ...
2
votes
4answers
185 views

Should a base class implement a virtual method for the most common type or derived class?

Is it okay to implement a virtual method in a base class because I know that the majority of derived classes will use that particular implementation? Suppose I have the following class hierarchy (in ...
0
votes
0answers
86 views

Send records to messaging queue using either of one policy

I have bunch of keys (clientKey) and values (processBytes) that I want to send to our messaging queue by packing them in one byte array. I will make one byte array of all the keys and values which ...
3
votes
3answers
894 views

How to avoid code duplication while extending two umodifiable classes

I already have this core class structure that can not be changed: class A { //some basic fields and methods } class B { //some another basic fields and methods } It is core classes and I'm ...