Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
91 views

For various reasons, I am currently refactoring some code to a more OOP approach. I am immediately having the following problem: When the Create method of the class module creates the new Word ...
Anna Burlingsby's user avatar
Best practices
0 votes
1 replies
35 views

I am trying to understand how Low-Level Design (LLD) should be approached in interviews. My confusion is that the design changes depending on the perspective I start with. For example, if I design ...
imssuthar's user avatar
-4 votes
0 answers
83 views

I'm working on a text-based RPG to improve my coding skills. To better differentiate between enemies with the same name in battle, I feed a list of enemies into the function below which returns the ...
Glass.Moth's user avatar
0 votes
2 answers
57 views

I am making a vector utility class for a ray tracer and was unsure of where I went wrong with my code below; it returns this error message: ERROR: syntax: "vector_one.x" is not a valid ...
I.Inferno's user avatar
Advice
1 vote
12 replies
162 views

I am a begineer and i want to learn c++ by doing projects please suggest me any project that i can do to increase my experience of c++ my old projects are: hang man game bank management system has ...
hassan ali's user avatar
0 votes
3 answers
149 views

The Problem: I am building a simple data processing tool. Depending on the file format (JSON, XML, or CSV), I need to apply different parsing logic. Currently, I’m using a long chain of if-elif ...
Yevhen Ivashchenko's user avatar
4 votes
2 answers
157 views

I am working on a Tic_Tac_Toe project. I have an object (gameBoard) that contains an array, then I have another object that i want to create a player from to play on the board, then I have a function ...
Blazing Jas's user avatar
Advice
2 votes
8 replies
148 views

When writing C# applications, it often feels like we’re encouraged to make methods instance-based even when they would naturally be static. Of course C# is an OOP-first language and patterns like ...
Alessandro Rizzi's user avatar
Advice
0 votes
10 replies
206 views

Given a class Child which is derived from class Parent. When creating an object from class Parent, select the correct type for the variable dan which will be assigned the reference to the Parent ...
HARSHA VARDHAN PAMPANA's user avatar
Best practices
0 votes
3 replies
54 views

Suppose we have two classes A_class and B_class. We want to connect them in a way that allows to access methods and data of B_class from A_class . We can do it through inheritance: class A_class : ...
Drake Vimes's user avatar
Best practices
0 votes
6 replies
113 views

I lately learned about the toString method and its uses. From what I've been taught, the toString method is used as a concise representation of an object as a string of characters, usually used as a ...
CS Student's user avatar
0 votes
1 answer
115 views

I am getting this error while implementing a stack by myself. Here is my code interface IStack<T> where T : class { void Push(T item); T Pop(); T Peek(); bool IsEmpty { get; } ...
Md. Maruf Sarker's user avatar
Advice
2 votes
4 replies
143 views

I'm trying to create a game in HTML, CSS, and JavaScript. I started following the tutorial by FreeCodeCamp: https://www.youtube.com/watch?v=7BHs1BzA4fs. The tutorial was on a side-scrolling game(...
human computer's user avatar
Best practices
0 votes
3 replies
137 views

I've read quite a bit on SO and elsewhere on Singleton being anti-pattern (hard to test, thread unsafe etc), e.g.: https://www.michaelsafyan.com/tech/design/patterns/singleton However, there still ...
LetMeSOThat4U's user avatar
Advice
0 votes
10 replies
268 views

I am still a beginner, and I am trying to understand what is a good practice and what is not. Saw a YouTube video on a little project about making a turn-based game in C# in the Console while also ...
KH 1111's user avatar
Best practices
0 votes
5 replies
107 views

I am trying to implement password manager on Java right now. I am implementing the vault. I have VaultEntry and VaultFolder classes. VaultEntry has fields id, parentId, name, username, email, password ...
gth-other's user avatar
2 votes
1 answer
182 views

I have a hierarchy of classes which should compare for equality by the following rules: objects of different classes are not equal; objects of the same class are compared using logic specific to ...
Ivan's user avatar
  • 645
Advice
0 votes
2 replies
147 views

I'm learning for my Introductory Programming Course in uni and I don't have an overview over the different cases when it comes to Setters and Getters and the slides are not quite helpful. So for ...
alex thyo's user avatar
Advice
0 votes
11 replies
207 views

I am a beginner C++ programer and I am trying to make a very simple random number generator for my program. I started doing this by creating a struct in a header file but I am wondering if this is a ...
user23304450's user avatar
Advice
0 votes
5 replies
101 views

I'm struggling with the following code: class Esempio(): def __init__(self, a, b, c): self.a = a self._b = b self.__c = c def __str__(self): return f"a={...
Quousque tandem abutere's user avatar
1 vote
1 answer
97 views

I am working on some simulation code in Fortran. Part of that are potential cells that induce velocity. Here is the definition for the cell type: type CELL doubleprecision :: xmin,ymin,...
byl's user avatar
  • 107
-3 votes
1 answer
120 views

I only know that setattr is built-in function that allows us to change value of attribute of object and __set__ is descriptor. This is all knowledge. What are the differences?
omersimsir's user avatar
2 votes
3 answers
260 views

This question is about the singleton pattern in modern C++ and one of its limitations in particular. I can implement the singleton pattern like this: class Logger { public: static Logger& ...
Hendrik's user avatar
  • 806
0 votes
1 answer
99 views

using System; using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MonoGame.Extended.Graphics; namespace GameCore.Core; #...
Witold Wojcieszko's user avatar
0 votes
1 answer
76 views

I’m learning Object-Oriented Programming in JavaScript and got confused by the following code: class Animal { constructor(lg) { this.legs = lg; } } class Dog extends Animal { constructor() {...
sylvesterChase's user avatar
2 votes
1 answer
638 views

When I write obj.attribute in Python, what exactly is the sequence of operations and lookups that Python performs to resolve this attribute? I want to know when and how methods like __getattribute__ ...
brief code's user avatar
Best practices
0 votes
1 replies
95 views

I have been working on a game engine and have come upon a design that is challenging for me to implement. In particular, I need two mutable objects, that themselves contain mutable properties, to ...
Notebooked's user avatar
4 votes
1 answer
139 views

I am processing excel sheets with pandas, and here's an abbreviation of what I have so far: class DataLoader: """ Loads excel sheets & convert them into CSV ""&...
merter's user avatar
  • 43
Advice
1 vote
6 replies
108 views

I know we can have: <?php abstract class ExtendMe{ abstract public function implementMe(){} } Can we enforce trait usage? <?php trait MyTrait{} abstract class ExtendMe{ abstract use ...
MonkeyZeus's user avatar
  • 20.8k
Best practices
1 vote
1 replies
38 views

In designing a language from scratch, should methods use a self variable to access properties and other methods? Or should they imply their target with .prop? Or should they treat properties as local ...
Armin Repsold's user avatar
Best practices
0 votes
0 replies
37 views

My question is not Android specific, it is rather more design-specific. Previously I had a BaseFragment that many child fragments were derived from. base fragment had objects of mapbox map to handle ...
Reza's user avatar
  • 885
0 votes
2 answers
130 views

I am trying to build a small scale deep learning framework. I defined my tensor class as follows class Tensor: __slots__ = ( "_backend", "_data", "...
Featherball's user avatar
0 votes
1 answer
104 views

I have two classes: Student and Group. Student attributes: private String registrationNumber; private String firstName; private String lastName; private Date dateOfBirth; private String password; ...
Mohamed Selmi's user avatar
Best practices
0 votes
3 replies
78 views

Our application is somewhat of a middleman that transforms data from numerous APIs. Initially to simplify things, we wrote a bunch of specific clients which wrap an instance of HttpClient created in ...
MetallicHydrogen's user avatar
0 votes
1 answer
88 views

import Vector class Ball: radius: float color: str position: Vector.Vector velocity: Vector.Vector acceleration: Vector.Vector def __init__(self, radius, color,position, ...
CJ Uldrich's user avatar
Best practices
2 votes
4 replies
90 views

This question is about when to use and inject delegates vs intantiating objects. Say I want to model a card game, I might want to inject the behavior for building the deck and shuffling. Since these ...
Alessandro Rizzi's user avatar
Best practices
0 votes
3 replies
60 views

I’m working on a NestJS + TypeORM backend and ran into an architectural question as my codebase evolved. Initially, I had a simple setup: InvestorProfileController handles PATCH /investor-profile ...
bugsyb's user avatar
  • 6,171
Advice
2 votes
4 replies
142 views

When using setters/getters on arrays, does your set() override the entire array or just the key? What is the accepted or best practice for this? Would you use set() for something like this or would ...
germanshedder's user avatar
1 vote
1 answer
99 views

Could you tell me how to write type-bound procedures for parameterized types? For example: module parameters type :: sinx (kind) integer, kind :: kind=4 real(kind) :: x contains procedure,...
Stanislav Fyodorov's user avatar
-2 votes
3 answers
210 views

I'm playing around with OOP in Python, and I have something like this: class Person: def __init__(self,name, age): self.name = name self.age = age self.hobbies = [] ...
Ranao's user avatar
  • 23
-1 votes
2 answers
168 views

I complete the implementation of a VM (ALU part) by adding operations to a Coprocessor. In this sense, I'm looking for a C++ design. Through a template, the VM is instantiated in 2 ways : A first ...
bitmap kid's user avatar
2 votes
6 answers
161 views

I want to write a method that converts a collection of generic type elements into a human-readable string. This method should also work with nested collections. I haven't found a better approach than ...
Human's user avatar
  • 63
0 votes
1 answer
87 views

As a coding test I've been tasked with developing a toy three-layer architecture DBMS project, involving OOP principles. The three-layer stuff isn't strictly my background so I've been trying to study ...
GokuToucher's user avatar
0 votes
1 answer
209 views

An exception occurred while iterating over the results of a query for context type 'MyProject.Data.SQLServer.SQLServerContext'. System.InvalidOperationException: The required column 'img' was not ...
DevQt's user avatar
  • 2,014
-4 votes
4 answers
173 views

I'm trying to use a for loop to iterate through a set of objects, check if those objects store string data (specifically their 'Pokemon.evolution' variable) which is the same as a the name of one of ...
mycode.exe's user avatar
0 votes
0 answers
39 views

Is this possible? How? Basically I want to create a class or an 'blue print' object with properties that can hold individual values? How would I write a 'blue print' that has property of color, name ...
Michael's user avatar
  • 313
0 votes
1 answer
69 views

I’m a PHP programmer looking to deepen my theoretical understanding of computer science concepts, specifically Abstract Data Types (ADTs) in the context of object-oriented programming (OOP). And my ...
Redgard's user avatar
  • 45
3 votes
2 answers
116 views

I have in an F# an abstract class and some derived classes. When instantiating derived classes, I would like to initialize a mutable property defined in the abstract class in the respective ...
bookofproofs's user avatar
0 votes
1 answer
71 views

I would like that method redefenition would result in failure and script execution stop. Like any other common error. In the following example I want to see that method print cannot be redefined. oo::...
Sterling7135's user avatar
0 votes
2 answers
65 views

I'm trying to create independent modules in JavaScript where I can add new functionality without modifying the original class. My simplified version: class adminMenu extends contextMenu { ...
EpicFrog2000's user avatar

1
2 3 4 5
1246