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
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [object-oriented]

Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.

2
votes
2answers
36 views

Remove and Add items from array in nested javascript object

I have the following object at React state: ...
1
vote
2answers
26 views

Secure a class for an hydratation from ma form POST

I use PHP classes for managing users accounts and I wonder if what I'm doing is correct. I directly use the $_POST['form'] for hydrate ...
1
vote
1answer
39 views

Simple MySql or MySqli Class

Which one of these methods is better/safer to use? And what benefits could I get using one or other? Simple mysqli: connection.php ...
-1
votes
0answers
18 views

When to couple output from one class as the input to another class? [on hold]

I am trying to better plan the class structures of a large code base in python. The project is a data science project involving data cleaning, data analysis, etc. I model all the data cleaning tasks ...
1
vote
0answers
36 views

Controller and Model Session handling classes (MVC OOP PHP)

Models/Session.php This file performs basic conditional checks and defines a function for each distinct action regarding Session initialization and ID regeneration. Is it OK, in this context, to ...
3
votes
0answers
67 views

Java game: select numbered tiles to form a goal sum

This is a homework project (Soft. Eng.) which I have completed. My teacher gave me a 91, but I am unhappy with this grade because my code is quite messy. (Please excuse incomplete Javadoc, the code is ...
2
votes
0answers
54 views

Matrix class with space-optimized triangular (lower and upper) variants

I've written a class for square numerical matrices (of doubles, in this case), in C++11. Since I intend to use this class later ...
6
votes
2answers
105 views

Simulation of a banking system with an Account class in C++

I have been learning C++ and recently I have started practicing classes. I made this simulation of a banking system with an Account class. I would like to hear feedback on my code, what is good - what ...
4
votes
0answers
48 views

Data Model Design and Inheritance in Python

I am implementing a data model in python and would appreciate any feedback. Model My data structure can be reduced to the following: ...
1
vote
0answers
65 views

Commission calculation using PHP

Task is to read file(input.csv) and calculate each operations commission depending of operation type(cash_in or cash_out). I dont have any specific questions, just want overall feedback, like code ...
2
votes
1answer
53 views

Player's scoring using JavaScript

Description: The questions are being showed in the console tap with player's score. It's questioning by prompt continually until the prompt input gets 'exit'. If the answer for each question is ...
2
votes
0answers
30 views

Polymorphic DBConnector class exercise

GitHub GItHub if it's easier I'm in the process of doing a training course in C#. I've just gone over covering Polymorphic OOP / composition over inheritance etc... The latest exercise I completed ...
2
votes
1answer
77 views

Stopwatch exercise from training course

Github Github for easy testing I'm currently undertaking a training course to try & further develop my skills in C#. The latest exercise was to create a basic stopwatch class that meets the ...
3
votes
0answers
25 views

Feedback on Object-Oriented ETL Class Structure for Computing Profit Summary Data

I am using Python 3 and pandas 0.24.2 to do some data processing and ETL flows. I have followed this pattern a couple of times and it is really bothering me but I am not sure which direction to go to ...
6
votes
1answer
37 views

List subclasses of a class

Description Given a class, return all its subclasses (recursively). As you can see I've eliminated recursion using a stack. What I want reviewed Is there a better way to do this? How can I make ...
1
vote
0answers
38 views

Card Game using pygame module

I implemented a card game using pygame, the game is a game of war and using png files that I made in Microsoft paint. I tried to keep the object classes as separated from the pygame module as possible....
2
votes
1answer
88 views

PHP Mad Libs with OOP and SQL

I've been learning PHP and I've just gotten into using OOP. Classes/objects/methods etc. My end goal is to take an old Mad libs program I did with PHP, and convert it to OOP. The gist of the project ...
6
votes
1answer
119 views

Implementing a queue: questions and clarification

Im trying to teach myself some computer science (and c++). I am relatively new to this (and to code review). I have attempted to implement a queue. I have copied the code below for reference. ...
3
votes
1answer
68 views

Implementation of Strategy Pattern (photo gallery example) [closed]

I'm learning design patterns and I thought that it would be a good idea to make my examples of each pattern. This is my example of the Strategy Pattern. Can you tell me is it good and what to improve? ...
3
votes
1answer
35 views

Logging with decorators (passing log file name as argument)

This is for some quantum mechanics software so there will be references to molecules/atoms etc but the core issue is a python logging one, unrelated to all that. I have a couple of logging decorators,...
0
votes
1answer
49 views

How to observe multiple Observables? [on hold]

About the Program It's a simple implementation of Observer Pattern. The choice of different NotifyMethod will affect how those observers are notified. The ...
2
votes
0answers
34 views

Dispatch different parameters to different classes with single interface [closed]

I have a set of classes that have similar funcionality but very different interfaces. I created two interface classes with polymorphic methods so I can operate over then. When creating calling the ...
5
votes
2answers
147 views

SOLID principles breaking in interview task (file parser)

Originally asked on Stack Overflow I recently had an interview where interviewers asked me to Rewrite following code with SOLID principles. Add a new file handler (...
2
votes
2answers
51 views

Immutable employee class

I have created an employee object to be immutable. ...
3
votes
1answer
47 views

(Follow-up) Project Euler #11 Largest Product in a Grid | Cache-optimized + sliding window (C++14)

Original code review: Project Euler #11 Largest Product in a Grid | Cache-optimized + sliding window (C++14) Source: HackerRank & ProjectEuler.net Problem: Largest Product in a Grid In the 20×...
2
votes
2answers
56 views

Project Euler #11 Largest Product in a Grid | Cache-optimized + sliding window (C++14)

Source: HackerRank & ProjectEuler.net Problem: Largest Product in a Grid In the 20×20 grid below, four numbers along a diagonal line have been marked in red. ...
3
votes
0answers
57 views

Tetris game for Windows

I'm a student and this is my first application/project that I made and finished today in C++ using OOP and I want to hear your opinions and suggestions, what I did wrong, what I did good, what should ...
5
votes
2answers
143 views

Parking Lot OO Design (Python)

Please review my code for parking lot design. I am new to OOD concepts, It will be great to have some feedback on OO Structure of the solution. Requirements considered: The parking lot can have ...
6
votes
3answers
186 views

Rock Paper Scissors coding challenge

I did a job application to a Unity developer position and i was given a coding challenge which was implementing a Rock Paper Scissors game or a variation of it. I have implemented the game using Unity ...
1
vote
0answers
46 views

PHP library that can use different authentication mechanisms

I am making a library which can use different auth mechanisms. I have abstracted the code within an interface: ...
3
votes
0answers
64 views

Writing Go object code that respects Go guidelines

I'm learning Go and I wrote this for a programming challenge. It is working (building and running) but I feel the code is not what Go code should be: Am I using the ...
8
votes
3answers
101 views

Stack as a Persistent Data Structure Implementation

After reading some articles about immutability, I found out that there are persistent data structures. In the following, I implemented a stack as a persistent data structure. What I like about the ...
1
vote
2answers
74 views

A simple card game simulator

This is a homework question, and I have written the code but wasn't sure if I had picked the right data structure for this job and minimised time complexity. Can anyone give me some feedback, anything ...
-3
votes
1answer
46 views

C++ writing object data to file [closed]

I'm trying to write a program that stores usernames and passwords. So I have created a Record class. Each record has an id, title, username, and password field. I want to write each record to a text ...
1
vote
1answer
112 views

Command pattern for simple text editor

I was asked to code a TextPad with following functionality: display() – to display the entire content display(n, m) – to ...
1
vote
1answer
219 views

Equity data processing: Fast and/or efficient file writing using PHP

Problem This project gets the past ~20 days of an equity data (such as $AAPL, $AMZN, $GOOG) plus the current equity "quote" (which comes every 60 seconds using a free API) and estimates seven "real-...
0
votes
0answers
32 views

ROR - Point of Sale (POS)

I've the following scenario: the user clicks the "Sales" button which redirects to the creation view of the Shopping Cart. Then, the user enters the EAN code and the Quantity, presses "Add" and the ...
1
vote
0answers
39 views

updatePositions() Laravel controller method

I have been trying to implement good 'OOP' and coding standards, but I always end up with bloated controllers. How could I clean this controller method? ...
7
votes
1answer
192 views

Scraper to grab a Stack Overflow profile name

I've created a script in Python to log into stackoverflow.com using credentials and fetch the profilename once logged in. I've tried to do it using class. I created the methods within that class in ...
1
vote
3answers
63 views

Class constructor with async properties set from poke-api

So, this is for a clicker game I'm trying to build with Pokémon data drawn from the PokéAPI. Since I'm using Vue.js for the project, ...
1
vote
1answer
88 views

Import class using OOP

I'm starting to code in the OOP way, but I have doubts with the following example. I have a Product entity and I want to import & create instances of this ...
3
votes
1answer
89 views

Java simple game - guess the word

I developed a simple and short java game in which a random word is selected and the user needs to guess it's letters one after another. I'm a java beginner so I'll be glad to hear your thoughts. ...
0
votes
0answers
50 views

Basic Connect Four Game [Follow Up 1]

Here is an updated version of a basic connect four game I had posted previously. Changes include: an overhauled validator, simplifying the process by knowing where the last move was made Utilized an ...
6
votes
1answer
189 views

Designing yet another a state machine

I wanted to design a state machine with a few goals in mind: Encapsulate state logic within individual classes to keep them decoupled. (I'm very curious what the community thinks about this in ...
3
votes
2answers
71 views

A HashTable optimised for a large in-memory storage

I've been making this pet project of mine which is an implementation of a HashTable for a very specific purpose: storing huge amounts of objects in-memory (think Redis). I ended up with this ...
0
votes
0answers
54 views

Forgot password / Reset password

I have a working example of 2 methods: Forgot password: A user inserts an account number and an email => An email is sent to the user right after it creates a token in the database. Validate Reset ...
5
votes
2answers
217 views

OOP bank account program in Python 3

Python beginner here. Building an OOP bank account program with SQLite and starting to struggle a bit with its design. From a design standpoint I have a file (bank) which calls ATM. ATM simulates an ...
0
votes
2answers
83 views

Binary Search Tree implementation with unique pointers

I have implemented a binary search tree using templates and unique_ptr in C++ 11. At present, only insertion and deletion are implemented. Please provide your feedback for improvements. ...
3
votes
2answers
74 views

Constructing a cumulative distribution function from a histogram

During some running process, a histogram of values shall be build up. When done, the CDF shall be derived from it and used to get the quantiles for some values. My current implementation looks as ...
0
votes
1answer
130 views

Enhanced C# Enumeration / `enum`

I am developing my own kind of Enumeration like SmartEnum but trying to prevent the user to provide a recursive-ish type definition like below: ...