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

Filter by
Sorted by
Tagged with
1
vote
2answers
112 views

Designing UI module for an application

I have an UI module that will expose only one class - UserInterface. The class will be responsible for collecting user input and providing output (command line UI style). From logical way of thinking, ...
-1
votes
1answer
169 views

If I have 2 different implementations of the same interface but with the same methods should I have 2 interfaces? [closed]

I have 2 different implementations of the same interface, but each one of those objects have different implementations, however they have the same methods, should I create one interface for each type ...
-1
votes
3answers
275 views

What are the differences between Class Oriented Design and Object-Oriented Design?

I saw an answer on SO which said that just having a class with methods doesn't make it OOP and that it represents Class Oriented Design. I'd like to hear the differences between Class Oriented Design ...
2
votes
1answer
139 views

Do we still use modular subsystems with object-oriented models?

I have been reading some old design books (SSADM, JSD.etc) on software engineering that deal mainly with a procedural view of creating systems. I was just wondering if we still use these old ...
1
vote
1answer
90 views

Loose coupling vs transparency in visitor pattern that visits composite

I have a composite object (I will call it A) that has fixed number of sons (I will call them A1 and A2) All of them have an Accept(Visitor) method. I have a GUI, A is the main window that consists of ...
1
vote
0answers
128 views

Scalable architecture design for managing data flow in C++ using an Observer design pattern

What I need I need a suitable and scalable solution to manage data flow between the classes in my C++ program. Why I need it Upon new feature requests, I'm continually adding new classes to the ...
0
votes
1answer
114 views

Any tradeoffs for using open methods?

I was trying to understand the use of multi-methods recently and saw several claims that they solve the Expression Problem. However, I ended concluding that it is not the multi-methods that solve it, ...
4
votes
2answers
230 views

How to model classes that can be extendable?

I have recently inherited a codebase which has a weird problem and I am trying to search for an extensible solution that can solve my issue. Consider I have a model class that is used as a model to ...
2
votes
1answer
506 views

Dependency Injection: Dealing with late property initialization

I am using some C# pseudo to illustrate here. Below, you will see a Service and a Client (in the context of using DI). The service has a required property that will need to be initialized by the ...
2
votes
5answers
337 views

Opposite verb to "inherits"

What's the name of the relationship opposite to "inherits"? Subclass inherits from superclass Superclass ______ subclass
2
votes
2answers
123 views

Given a 2D map with some entities on it, should the position be kept inside the map, or the entities?

I've got a 2D map, on which entities interact. Should an entity's position be kept on the map object, or on the entity object itself, or both? Why? What does decide where a property is kept? What ...
2
votes
1answer
113 views

Selective method inheritance

I have a lot of classes that are just a CRUD interface for microservices. They only have a param for the endpoint and some of the methods get_list / get_item / create / update / delete / activate / ...
-1
votes
2answers
157 views

Robins magic Chess game: Where to put/split the behaviour to full fill Law of Demeter [closed]

So now i have a really concrete example; its highly related to that question here: Tell one, but ask the others? the important statements there are: In the comment section https://softwareengineering....
-1
votes
1answer
94 views

Different composition techniques from the perspective of the client

There exists different composition arts/techniques, i will present in the following some of them. The question then is do you know more techniques additional to my presented ones? And then the ...
-2
votes
1answer
61 views

Deep Object Graph Hierarchy: access an object which belongs to that hierarchy

Consider we have something like this: A person, which has a physical body with arms, each arm has a hand, each hand fingers, and each finger a fingernail. Another example: we have a car and a car-...
0
votes
0answers
41 views

Internal behavior VS external behavior with the count of method-parameter

Inspired by my own question + a fragment of Robert Bräutigams answer there: Tell one, but ask the others? i came up with this question here: let's take us the write method of a chatroom or any other ...
-1
votes
1answer
52 views

Model design for `Team`s and `Member`s

Say we have to create a model for a company, where employees can be part of many different teams. A team can have member members. Members can be part of many teams. How to design database tables for ...
-4
votes
3answers
209 views

Confused between HAS-A and representation [closed]

I'm currently working on a game in which a maths module is being used, here is one of the classes called Vertex. I'm getting confused with the relationship between HAS-A and objects representation. I ...
0
votes
1answer
152 views

Is it any more efficient to reuse a variable than to create a new object?

In a project I am working on we load various entities from the database, do some work then attempt to save the resulting entities. If saving the result is not successful, we return a Result object ...
-1
votes
1answer
153 views

Modeling a workout schedule using OOP(DDD specifically)

I am just getting into DDD, and I am trying to model a very basic exercise schedule. I have a Schedule and I have a Slot the slot takes 0 - many Exercise entities. The schedule is composed of Slots ...
0
votes
1answer
68 views

Memento Pattern:Philosophy of createMemento() method in Originator class

I've question about the philosophy of createMemento() in Originator class in Memento Pattern. My teacher said: now that Originator class no longer stores Memento objects internally, we should give it ...
-1
votes
2answers
117 views

Payment Processor using polymorphism?

I am writing a payment Processor class, then will take different payment objects in input and talks to external services to process payment.My class is designed using polymorphism as follow: public ...
1
vote
4answers
206 views

Software-design for algorithm engineering

I'm currently working on an program that solves a graph optimization problem. I know the "standard" software-design principles like information hiding, modularization, etc. What I'm ...
0
votes
3answers
415 views

Tell one, but ask the others?

Consider we have three classes which want to collaborate, then, where is the behaviour? I guess it can only be in one of the three classes or in a fourth one acting than as a procuedural connector-...
0
votes
2answers
89 views

Interface and Implementation Classes

I know various forms of this question have come up before, but none of them quite seem to answer in a way that I can apply to / understand in relation to what I regularly see others doing. ...
1
vote
2answers
363 views

No trivial god-class refactoring

Consider you have the following code: class UserContainer { List<User> user; //some methods to get specific users, for example users, which are higher than 1,70meters } The User have a ...
1
vote
2answers
401 views

Should a single method in a service class perform multiple operations for its controller?

Let's say I have a controller called MessageReceiverController which is a controller of an API that other services can call and include messages in the requests. For each of the messages the ...
1
vote
4answers
162 views

How to express abstractions?

In a program there is an abstraction from an person to a shape. This abstraction is so that collision detection can be performed. Here is my original class hierarchy: namespace Graphics { class Shape ...
2
votes
2answers
507 views

How to go about calling parent's instance method from child instance?

This question is a continuation of a question originally posted here. I'm trying my hand at creating a Snake clone with JavaFX. One of the requirements for the game is to have a sort of powerup food, ...
2
votes
2answers
197 views

How to design correctly relationships of class diagrams?

I'm learning OOP so I decided to start a new project, a chess tournament manager. Here you can read about chess tournaments https://en.m.wikipedia.org/wiki/Chess_tournament Basically the user will be ...
1
vote
1answer
360 views

Using isinstance() during exception handling for subsequent action

I've read various posts that polymorphism should be used instead of isinstance, and I agree that makes sense when the use of isinstance is checking the subtypes of a class to determine what to do. ...
2
votes
2answers
272 views

In OOP, are all class methods valid?

Some classes have methods that don't match up with procedural data abstraction. Here is an example of a problem hierarchy, the Render() method doesn't seem to be part of an procedural data abstraction ...
1
vote
2answers
75 views

c# template method pattern design question

I'm currently in a situation where I have multiple derived class types(just one is shown in the example below) that need to apply some logic before and/or after calling a method implemented in a ...
-1
votes
5answers
232 views

Designing Entity Objects in OOP

I am newbie to programming and I am confused how to design an entity objects/classes. For example I wanted to create an animal kingdom in my application. Do I need to create a single Base Class (...
1
vote
0answers
187 views

How to use polymorphism in embedded software?

I have been developing a control software in C++. From the high perspective the control task can be basically divided into several subtasks calculate unmeasurable physical quantity based on dynamic ...
4
votes
2answers
175 views

GoF Builder Pattern Applicability

The book Design Patterns: Elements of Reusable Object-Oriented Software says to use the builder pattern when The algorithm for creating a complex object should be independent of the parts that make ...
-1
votes
3answers
137 views

Chain of responsibility look alike but choose handler at runtime

Currently I have an structure of PopUps and I've been thinking to use Chain of Responsibility pattern, but the difference is a popup can back to previous one PopUp and also can go to any other PopUp. ...
0
votes
1answer
108 views

Python: Function pipeline with multiple return/input values, or use OOP? Best Practices?

I have a 'processing' function and a 'serializing' function. Currently the processor returns 4 different types of data structures to be serialized in different ways. Looking for the best practise on ...
2
votes
2answers
206 views

Snake Game design

I am designing Classic Snake game using OOPS.I will have the following classes at top level : Game { Board board, Snake snake; } Board { Cell cells[]; } Cell { int x, int y, ...
0
votes
0answers
18 views

Database Table and Object relationship [duplicate]

I am a Computer Science student and one of my first class was Object Oriented Design (Java). Unfortunately, we never interacted with a database during that class. I am currently working on a CRUD app ...
1
vote
5answers
202 views

Object and Tables

I am a Computer Science student and one of my first class was Object Oriented Design (Java). Unfortunately, we never interacted with a database during that class. I am currently working on a CRUD app ...
1
vote
2answers
94 views

Visitor design pattern usage

I have been implementing a software driver for an external (from my microcontroller point of view) chip communicating with my microcontroller over I2C. From the higher perspective the chip is a ...
28
votes
4answers
4k views

Law of Demeter and over-wide interfaces

The Law of Demeter makes sense in some obvious cases. # better dog.walk() # worse dog.legs().front().left().move() dog.legs().back().right().move() # etc. But in other cases it seems to lead to an ...
-1
votes
1answer
299 views

Is it better to pass self or the specific attributes in Python methods?

I'm trying to understand when it is better to pass explicit arguments to a method and when it is better to just pass self. I created a little example to illustrate the question. Here are two different ...
-1
votes
1answer
607 views

How can I orchestrate multiple business tasks?

I have a WebApi backend with a Blazor WASM frontend. The application is split up into 3 main parts. Core, Infrastructure and Presentation. Basic onion architecture structure. Core.Domain Domain ...
-2
votes
2answers
187 views

Why use private access modifier if we need to access private variables anyway?

Everywhere is said that a private member can only be accessed from inside the same class, but at the same time, we can access the private member using getters and setters, therefore my question is: ...
-2
votes
1answer
155 views

toppings in pizza factory?

Going through Head First Design Patterns, and their Pizza factory example, it seems that there is no room for specifying toppings. In general, if I have a process which contacts different APIs which ...
-1
votes
1answer
149 views

How to avoid cyclic dependency in UI application

I'm developing an UI application where I ran into an issue with a cyclic dependency. Here is the simplified code, to explain the problem. #include <list> class UiStyle; UiStyle* CreateStyle(); ...
-1
votes
3answers
192 views

Object Oriented Programming Benefit

After so many years I started to study again and finally I arrived at the fateful thesis for the three-year degree. I've been working for 20 years as a systems engineer and I haven't studied ...
3
votes
3answers
780 views

Use inheritance to make single child, smaller

We have a relatively big class. One of my colleagues thinks we must split this class into a base & child class to make it smaller and cleaner. On the other hand, I believe when we know this parent ...

1 2
3
4 5
64