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.

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

0
votes
0answers
10 views

How do I correctly separate the code that does three things and when to use events?

I have in controller: (pseudo code) public class MainController { public void accept(RequestData requestData) { Ticket ticket = this.generateTicket(); DB db = this....
0
votes
0answers
11 views

Would you implement an interface to connect to a database?

I found in a book (Learning PHP Design Patterns, Chapter 2, page 25) a text explaining the importance of interfaces in OOP design. The author ended up by giving this example: <?php interface ...
3
votes
1answer
32 views

Auto-Initializable Objects Pattern

I'm working on a system where we consistently apply "patterns" or approaches such as Dependency Injection. I'd rather not expose the current underlying technology as not to get biased solutions, ...
-1
votes
0answers
16 views

Express downloading file process in Sequence Diagram

I'm trying to make a sequence diagram for downloading file process, but I get confused to expressing it. In my current sequence diagram, the download file from control is directly send to actor as ...
0
votes
0answers
80 views

Architecture / Design Pattern for Login Signup

I have a multi-seller ecommerce platform, derived out of Opencart 2.3. We changed quite a bit of the core code of the Opencart to add our own customizations, including features such as Seller ...
1
vote
4answers
381 views

What do OOP languages gain from having constructors that always return an object?

In what seems like a deliberate design decision, C++ does not have a null value for objects and references. This makes using objects and references very elegant since we don't have to perform null ...
4
votes
1answer
89 views

Best practices when designing a workflow engine using timers?

I'm working in a OOP language called Fantom, similar to Java, to create a workflow engine. My code sends emails to users, and it awaits for users to click a button within the email. In my current ...
-2
votes
0answers
49 views

OOP in Computer vision project

I am trying to understand how object oriented programming works. Until now I used functional programming in a computer vision software but while the project is growing, I realized it's limitations (...
-2
votes
0answers
115 views

Which OOA&D methodologies are prominent today? [closed]

Several OOA&D methodologies exist, e.g the ones involved in the method wars of the 90's (Booch, Rumbaugh, etc) culminating in the creation of the UML notation, among others. I see (in Brazil) ...
3
votes
4answers
574 views

C# has no friend class - what are better options

I return to this question every couple of years, so now i decided to solve it once and for all, by asking here. So, the sequence: I'm writing a simple application that parses Json file (...
0
votes
2answers
207 views

If a instance method is used in one place only, should I move that method to that place?

For example, suppose I have a ZipCode class: public class ZipCode{ public value String value; public boolean validateFormat(){ ... } public otherMethod1(){ ... }...
2
votes
1answer
68 views

How do I refactor a graph service to where I can encapsulate if/then/else statements?

I have a graph service where I use if/then/else statements. class GraphService { function getGraphData(array $products) { foreach ($products as $products) { $...
3
votes
2answers
133 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 ...
0
votes
2answers
213 views

Avoiding vtable pointers in objects in C++

In my previous question, it was highlight that implementations of C++ such as GCC must store a vtable pointer in every copy of a class for each parent class which has a virtual function. So a class ...
3
votes
2answers
210 views

Does composition increase or decrease the coupling

We know that composition is a synonym of loose coupling. From here I read coupling becomes stronger between the classes A and B when: A has an attribute that refers to (is of type) B. To ...
2
votes
2answers
83 views

Should methods be part of your persisted entities?

We are coding a small game and have a Player class. This Player class has certain properties which you would persist in a database like Id, Level, Health. We would like a Player to be able to kill ...
-2
votes
0answers
30 views

Sharing POJO's on different project modules

Given five modules (Core,Bootstrap, WebServices, Persistence, Framework) on a Maven ORM based project Both Bootstrap and WebServices depend on core module, since core module has a application layer ...
0
votes
1answer
90 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 ...
0
votes
1answer
152 views

Is there a programming language with objects and generics, but without inheritance?

The GO programming language has objects but no inheritance. It also has generics for the built-in types Array and Map. Is there a programming language with objects but no inheritance and with generics ...
1
vote
2answers
123 views

DDD Best practices

I'm developing some test web-project for my self to learn DDD and good architectural practice at all. So application, basically, is a simple photo manager. I'm developing 3-tier architecture and for ...
3
votes
1answer
271 views

NodeJS (ES6): Design Pattern with bind usage

The question is related to the resolution of the this operator in Javascript classes. NodeJS now supports ES6 classes. The problem faced during this is that when a new instance of the class is created ...
-1
votes
3answers
176 views

Should a simple factory method include the “new” operation?

For example, suppose I have a class to create a button with specific styles common to my app, I can have either Return a new modified object: public class ButtonFactory { public static Button ...
3
votes
5answers
214 views

Does deciding about Liskov sub.princple compliance require a contract?

I have read two opinions on the subject. Let's assume the following simple code: class Enemy { public virtual void CheckHealth() { if (Life <= 0) Dispose(); } } ...
0
votes
2answers
139 views

Get data from the byte array

I have a byte array and a value defining the type of the data stored in it (string, int, ...). What is the best way to get this data? I have two options in my mind: Call a method which gives the type ...
0
votes
2answers
69 views

Base class with common properties

I have multiple classes that have the same properties to be exposed. Is it normal to create a base class, which will expose those properties, to be used with descendent classes? By properties I ...
0
votes
4answers
132 views

Should a class which has a method to create object A also implement a method to delete A?

For example, suppose I have a class to create a button with specific styles common to my app: class ButtonFactory{ public: static Button* createAppButton(std::string st,int font size){ Button* ...
2
votes
4answers
141 views

Object Oriented Game Programming Board Class decision

I am writing an object oriented game for fun where players from two teams fight. I need to implement move function for players on a maze. Maze sohuld have location information with some features like ...
17
votes
9answers
2k views

How is polymorphism used in the real world? [closed]

I am trying to understand how Polymorphism is used in a real life project, but I can only find the classical example (or something similar to it) of having an Animal parent class with a methodspeak(), ...
2
votes
2answers
115 views

Pattern Matching in OO code

I have a situation where I need to model objects that don't share common attributes but represent same logical entity. Now, based on their type they will have different attributes (properties). To ...
1
vote
6answers
319 views

Is it okay to have a parent class that doesn't represent an entity and doesn't have an “Is-A” relationship with its child classes?

I want to have an array that can hold elements of many classes data types, and each of these classes have a method called printInfo(). The way I can do that is by having a parent class called ...
4
votes
5answers
473 views

What is the “killer feature” of OOP? [closed]

I don't have much experience working with OOP, so I'm trying to understand what is the feature (or features) that would give you a great motive not to write some program in a procedural language, but ...
2
votes
4answers
274 views

Is there an object-oriented language that doesn't allow you to have private member variables? [closed]

I know that JavaScript doesn't explicitly allow you to have a member variable of an object as private, but you can do that implicitly by using closures. But is there an object-oriented language that ...
0
votes
6answers
111 views

How to restrict method's parameter to the class, where the method is overridden

I have quite simple class hierarchy: public class Base { //... public virtual void AssignFrom(Base baseObj) { //DoSomeStuff } } public class DerivedA : Base { //... ...
0
votes
1answer
44 views

PHP MVC controllers using ajax

I'm learning to use the MVC pattern to design my PHP's software. I always use ajax to send requests to my controllers so often I've a code structure like this: <?php if(isset($_POST['action']) &...
0
votes
0answers
56 views

Compute and assign value to an attribute during class instantiation python

I am new to OOPs and don't have software engineering/computer science background. I am trying to define a class where I want to compute and assign a instance attributes under def __init__(): as ...
45
votes
8answers
12k views

Before OOP, were data structure members left public?

When a data structure (for example, a queue) is implemented using an OOP language, some members of the data structure need to be private (for example, the number of items in the queue). A queue can ...
1
vote
0answers
52 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 ...
0
votes
1answer
68 views

Should I print to the page from a javascript object, or only render from PHP?

I have a complex app on the Javascript/PHP/SQL stack which manages different domain objects. The Javascript layer contains classes which manage the data on the client side. I am currently baking a ...
0
votes
1answer
55 views

Adapting third party conversions

I have a couple of pieces of functionality that are similar but not quite the same. They both involve converting a type that I own to other types that are owned by a third party library, so out of my ...
0
votes
1answer
73 views

Where should the domain rules be applied on user input?

The application is an API. Users can post data to the API, which is then transformed to a domain object. I am wondering where to apply the domain rules, in the domain object. Let's make it more ...
2
votes
1answer
229 views

Is 'Keep it looks similar to sample code' a valid reason to prefer WET over DRY principle?

For example, for oauth, I may need to copy and paste oauth and oauth callback code like it (assume Client is the framework I use, I don't use real framework like google because I want to simplify the ...
0
votes
1answer
109 views

When doing oop in python where should I add the logger

When doing oop in python where should I add the logger. Should I add it: before the class Rocket(): and give it a file global scope or after the class Rocket():  and give it a class scope. Syntax ...
3
votes
4answers
179 views

C++ Preferred method of dealing with implementation for large templates

Typically when declaring a C++ class, it is best practice to put only the declaration in the header file and put the implementation in a source file. However, it seems that this design model does not ...
2
votes
3answers
160 views

Is there a pattern to describe a class that symbolises an instance of an instance of another class?

I am currently working on a project that generates videos from templates (a template being a collection of JSON files and assets). It seems natural to have a Template class that contains all the info ...
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), ...
1
vote
2answers
239 views

How is usually named a non-const getter?

Quite often you need to define a getter returning a reference to a member, and a corresponding setter. They usually look somewhat like this : class Foo { Type member; public: const Type& ...
2
votes
0answers
58 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
2answers
120 views

Is this Aggregation or Composition?

As far as my understanding for composition, the children cannot exist without the parent. But my instructor is suggesting that the following example is an aggregation, I just want another opinion. ...
9
votes
6answers
559 views

Is separating most classes into DTO and helper classes (if possible) a good or an anti-pattern?

For example, a class usually have class members and methods, eg: public class Cat{ private String name; private int weight; private Image image; public void printInfo(){ ...
-1
votes
1answer
104 views

Does Interface Segregation Principle apply to parameters/request objects?

I have recently seen an example of what I think is a clear violation of ISP, but my colleague argued it is easier to use. This is what happened: We had Options class that had 2 fields sent as a ...