Stack Exchange Network

Stack Exchange network consists of 175 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]

A methodology that enables a system to be modeled as a set of objects that can be controlled and manipulated in a modular manner

4
votes
0answers
99 views

Intuitive dependency management with code includes?

I am building a PHP CMS system that parses template files and replaces tags with content. Sometimes this content is a HTML, CSS or JS snippet, but it can also be a code include. Most code includes ...
3
votes
0answers
91 views

Ripple Effect Analysis using coupling metrics

How can I observe ripple effect using coupling attributes alone? I first find the common coupling metrics for a set of deprecated classes in a project, like CBO(Coupling Between Objects), RFC(...
3
votes
0answers
271 views

Dependency injection - Nested objects

# Introduction I am working on a CMS application in PHP with about 200 classes. The CMS, in general, does the same thing every CMS does: generate sites. I am learning a lot about OOP and design ...
2
votes
0answers
139 views

Separate business logic from ORM models in SQLAlchemy

I have a Flask application with tens of complex models, almost all of them related to each other. A simple pseudo-schema of some of them: +----------------+ | FoodGroup | +-------+--------+ ...
2
votes
0answers
255 views

Design a Windows Service with self-hosted ASP.NET Core Web Services and UPD port listeners

I'm designing a software platform in automation that is responsible of many different tasks like: Core functions Driver interface for machines UDP listener for machine messages from PLC UDP listener ...
2
votes
0answers
76 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), ...
2
votes
0answers
63 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
0answers
271 views

PHP OOP best practice to split low level class into two

What i got now is low level object that has bunch of methods and its difficult to navigate trough i want to break it down, however functions logically have same functionality just different ...
2
votes
0answers
43 views

Component needs to invoke class methods and instance methods (via ORM), how to structure

An interesting design choice/discussion has cropped up in code review, and I would like to understand more about proposed solutions. The original review includes re-factoring of a messy piece of code ...
2
votes
0answers
202 views

Is Nested Structure with Spread Responsibilities Not Logical?

Given the following code snippet in a Laravel Controller: $this->userRepository->saveByProject( $this->fileRepository->saveByProject( $this->metricRepository->...
2
votes
0answers
375 views

JS closures - Passing a function to a child, how should the shared object be accessed

I have a design and am wondering what the appropriate way to access variables is. I'll demonstrate with this example since I can't seem to describe it better than the title. Term is an object ...
1
vote
0answers
35 views

Splitting aggregate leads to inconsistencies in data

What I'm going for is something like GNUCash or any type of personal finance tracking software that looks similar to this: That is the main page listing all your accounts; then when you click an ...
1
vote
0answers
74 views

Expected behavior from client when thinking about design patterns?

I'm confused about the behavior I should expect from a client when thinking about design patterns. To be more precise, I'm reading the Head First Design Patterns book, and on the difference between ...
1
vote
0answers
70 views

Hierarchy of models while designing a client for a RESTful service

I am trying to write a client for a restful service. I am confused in designing the models. Below are the details: I have a Model named UnicastMessageRequest, it's definition is like this: ...
1
vote
0answers
608 views

design pattern/oop for large validation rule set

I'm writing this in node.js I have some data that needs validating before anything can be done with this. The data is validated in two different ways. I can use JSONSchema to validate the structure ...
1
vote
0answers
56 views

Is it okay to have an asymmetric relationship between entities in a JavaEE data model?

I'm having difficulties assessing a design decision regarding entity relations in a JavaEE persistence data model. Let's say I want to design a simple data model that's supposed to represent a ...
1
vote
0answers
156 views

Constructing a stateful allocator using an interface

I have the following abstract class which implements the "Allocator" concept, using policies and traits to customize behavior: #define FORWARD_ALLOCATOR_TRAITS(C) \ typedef ...
1
vote
0answers
111 views

Class decomposition for user interface panels

I'm developing a desktop application which has some similar UIs. So, I decided to extract out the common behaviors like below. Here is my Class diagram for the application. Since I have another ...
1
vote
0answers
160 views

How to decompose workflow's node classes DDD-way?

System model has Workflow container class, instances of which may contain subclasses of the Node class, specialized for different behaviors (eg, Initial, Intermediate1, Intermediate2, Final). There ...
1
vote
0answers
664 views

Reading and saving big data to db

I have a method for reading data from file. The problem is how to handle files that are too big for a simple read and save to database? I was thinking about reading a chunk of it and saving it to ...
1
vote
0answers
53 views

Hierarchical data structure: pull requests + pull request reviews + pull request review comments

GitHub has: pull requests pull request reviews pull request review comments BitBucket has only: pull requests pull request comments So there are three kinds of objects. I write code ...
1
vote
0answers
119 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 ...
1
vote
0answers
397 views

How to Make Reusable Classes/Package in Laravel for Billing which uses PaymentExpress?

I am working on a Laravel Project where we are Payment Express. What currently we are doing is that we have Payment Express Class with static function (Not a single property) like given below: Class ...
1
vote
0answers
80 views

Creating duplicate instances of objects for timeline functionality

I am working on a Spring-MVC based project, in which I would like to add Timeline functionality. The most important object in our project is the Note, there are objects associated with it like ...
1
vote
0answers
679 views

Change object state in different point in program

This is not about whether or not getters/setters are wrong. I understand its impact to encapsulation and that question has been raised here and SO several times already. I also do not want to just ...
1
vote
0answers
232 views

Lazy loading collection data through granular subscriptions and OOP (Meteor.js)

I am transforming my Meteor collection to a class I've created: People = new Mongo.Collection('people', { transform: function(doc) { return new Person(doc); } }); Person has a bunch of ...
1
vote
0answers
122 views

C++ object design

I am programming a database similar to Cassandra. I use C++. Simplified database store its data in one or two "memory table" and several "disk tables", all stored in single directory. I have class ...
1
vote
0answers
295 views

How and where to make global function file in jsp sevlet web application

I am making a website in Servlet&JSP. I am looking for good way to make a specific function file from where I can call and declare my common functions. If I made a java file function. Java, so is ...
1
vote
0answers
304 views

How to separate out below tightly coupled classes

I have two classes which are somewhat tightly coupled to one another. Lets call them A and B. A derives from C and B derives from D. B is the class whose instance is created by the system and then B ...
1
vote
0answers
57 views

Adding new Interface & Replacing Method with Interface Type

Let's say that I have 2 classes: Foo and Bar. `Foo` { List<Bar> bars String bippy() int boop() } `Bar` { int biz() String baz() } Observe that Foo's fields include a List<Bar>. ...
1
vote
0answers
80 views

Modelling network and persistent entity representations

I have an app where I need to synchronize some entities (simply download latest versions of entities from server to client). Entity has bunch of text properties and bunch of resource links (referenced ...
1
vote
0answers
54 views

Class/Object with different sets of configurations, singletons etc (PHP)

I want to produce maintainable code for configuring one or multiple classes differently depending whether in a production or development environment. For example, making a Paypal class/object that ...
1
vote
0answers
92 views

using internal or external iterators over graph edges

I've written some code to manipulate sparse graphs for school work I'm doing, and I have an operation which requires me to loop over all the edges of a graph. The interface I need to implement is some ...
0
votes
0answers
14 views

What naming convention should you use for the 2 model classes of the same business logic, one shallow and one deep

In one of our services we have business objects, and sometimes we would like to return them in their "flat" form and sometimes in their hierarchical form. An example: Let's say we have an Account ...
0
votes
0answers
38 views

Separate Class for Current User vs List of Users?

Suppose I have system with a User class, meant to represent one row in a database table of users of the system. There will be queries for the administrator's screen reading a list of all users, in ...
0
votes
0answers
54 views

Apply Value Object (Stringly Typed) in PHP

What is the best way to prevent wrong states in an object? This is the source of my question. Basically my curiosity started with the intention of not letting a class exist with wrong values. Prevent ...
0
votes
0answers
111 views

Decorator Pattern Java

This is an object-oriented design question that is specific to Spring Boot. I'm extending a Spring Boot application that has an interface that is being extended and used inside another service. The ...
0
votes
0answers
38 views

Role Based Access Control on OOP how do you map Permission of Role to Entity?

I've been trying to wrap my mind around this RBAC system. The goal is with a static method from a class, I can get the current user/actor, then check if he has capability to do something for specific ...
0
votes
0answers
52 views

Getting into situations that requires mixin while building classes. How should I correct my class design?

I have the following classes for to solve a particular problem related to HTTP responses. Problem is for class ServerSentEventStreamResponseService I am in a situation where I need mixin because I ...
0
votes
0answers
29 views

Which diagram to visualise chain of events (in Django)?

Model situation: In Django (Python web framework), I have a model Event. I need to visualize this chain of events: Everytime new Event is created, confirmation email is generated and sent to Event....
0
votes
0answers
50 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
0answers
110 views

Is it a valid OOP design for Python?

I have following class design (not exact but you can get the idea): WRITE_METHODS = ('POST', 'PATCH') class CanPOST(BasePermission): def has_permission(self, request, view): return ...
0
votes
0answers
57 views

How to implement M-N relationship to reflect the domain correctly

If I have three entities like this: WorkingGroup WorkingTime Shift The WorkingGroup has one or more workingTime public class WorkingGroup { public WorkingGroup() { ...
0
votes
0answers
63 views

A DLL as an IO module in C++

I created a set of classes that represent the structure of a game save file which structure I do not control. Each of those classes has a read() and write() methods that are invoked by the parent in ...
0
votes
0answers
419 views

Event-driven architecture avoid getters

I understand an event-driven architecture leads to decoupling. However, can using an event-driven architecture lead to minimal "getter/accessor" use? It seems that if you had some type of event ...
0
votes
0answers
92 views

Strategy for fetching data from an API

I am working on a permission based system where a user can request any resource which is permitted based on his role, the resource can be one of the following types: VM DB etc. The request should ...
0
votes
0answers
40 views

Relationship Between Driving Simulation Objects

I am working on a very basic driving simulation. I am trying to decide the relationship between the following objects: Freeway, Vehicle, Driver, ProximitySensors. My real-world analysis suggests the ...
0
votes
0answers
47 views

Use Local Parameters If Global are empty?

Simplified Case with Immutable Class final class Secret implements IFoo { private $header; public function __construct(array $header = []) { $this->header = $header; } ...
0
votes
0answers
186 views

A modification of singleton pattern

"Singleton" is widely considered anti-pattern ("bad" in everyday language). What about this alternative modified singleton pattern? An object constructor for our class ensures that at any given ...
0
votes
0answers
93 views

object configured by another class

Below I describe what I'm trying to do and how I think I will do it. What I'm hoping is that a design pattern exists for using one object to configure another. This would allow me to have a nice ...