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]

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

2
votes
2answers
242 views

Java converter from Arabic to Roman Numerals

I am learning Java and would like to get feedback on the code I wrote. I have written an implementation of an algorithm (found here) for converting any decimal Arabic number to Roman numeral string. ...
3
votes
1answer
68 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 ...
-2
votes
0answers
14 views

Ordered List insertion [on hold]

I am having trouble making the numbers that I put in the list go in order. I am making a program with a list where I can insert 3 numbers into that list. The 3 numbers should be sorted after inserted ...
0
votes
1answer
48 views

Design a sustainable home tracker and calibrater for power, water, gas to minimize the expense

Problem Statement Following are the various scenarios to be considered Track energy - Track consumption of water, gas and electricity. We should be able extend to capture other type of ...
4
votes
2answers
54 views

Configuring an editor for various languages using Factory Method Pattern

I need to know if my code is a valid implementation of the factory method pattern. Also, if the Configuration and Editor were interfaces would this still be a valid implementation of the Factory ...
1
vote
0answers
23 views

“Detailed” exception class hierarchy

I'm designing an modular exception class hierarchy to use in various projects. I intend to inherit from std::exception in order to be maximally compatible with any ...
-4
votes
0answers
17 views

Linked list with memory leak issues [on hold]

The nodes seems to connect just fine until implementing my getName() function for variable assignment: ...
1
vote
2answers
47 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
2answers
57 views

Initiating an action based on product type

I am starting my studies with Ruby and OO and I have received a test to do about OO. I am looking for new ways to improve the scenario following object-oriented concepts. Is there a better way to ...
2
votes
1answer
49 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 ...
3
votes
1answer
141 views

Java console banking

So I wanted to write a basic console based banking app to practice my skills. It makes use of BigDecimal to ensure accuracy. Here is the MVP I plan to enhance it with all banking features soon. I ...
3
votes
1answer
79 views

Custom serialiser with object factory

A couple of years ago I wrote a serialisation library for my project. By the time it worked well, but recently I thought it could be modernised. Back then I needed something that looks similar to ...
5
votes
1answer
11k views

Shopping cart in pure JavaScript

I need help in making this shopping cart adhere to the W3C rules. This is already 100% functioning. I just need help in making this code as clean and as short as possible. I want it in pure ...
0
votes
1answer
1k views

Java MongoDB client as a singleton

Is below code a valid Singleton design pattern for Mongodb in Java? Please suggest any improvements. ...
2
votes
2answers
41 views
2
votes
1answer
81 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 ...
1
vote
1answer
52 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 ...
2
votes
1answer
295 views

Simple Java OOP calculator with GUI

I'm learning Java and I've tried to write my own calculator with GUi based on this post. Here is the repo: https://github.com/MurDaD/java-calculator Could someone check my code and tell me how to ...
-1
votes
0answers
19 views

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

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
38 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
1answer
129 views

Initializing a controller that uses Selenium

I've outsourced the setup functions from my class to another file, I outsourced initDriver from the class PortalController to ...
3
votes
0answers
69 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 ...
1
vote
3answers
67 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, ...
4
votes
1answer
142 views

Bill settlement for multiple users

I want to improve the logic for bill settlement and calculation of amount due. I managed to write code with T.D.D., but I think those loops could be improved somehow. Do you have any ideas on that ...
6
votes
2answers
108 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 ...
3
votes
1answer
2k views

Custom ResponseModel for Spring Controller - ResponseEntity<?>

I created a custom responseModel to have a standard json responseModel for some of my different RestController. Superclass TransactionResponseModel: ...
1
vote
0answers
70 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 ...
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: ...
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 ...
3
votes
1answer
1k views

Laravel controller for a commenting system

Can someone review my Controller? I should follow these guidelines: Code should be written with MVC pattern and to use OOP. The code now works fine, but I need to improve it. Also, should I use ...
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 ...
5
votes
1answer
75 views

Implementation of Singly Linked List

I'm a data scientist attempting to build stronger CS fundamentals, particularly in Data Structures & Algorithms. Below is my attempt at implementing a Singly Linked List. Looking for advice ...
6
votes
1answer
124 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. ...
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
41 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
91 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 ...
5
votes
4answers
2k views

Messages with status codes

I need to refactor following class: ...
3
votes
1answer
70 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? ...
0
votes
1answer
49 views

How to observe multiple Observables? [closed]

About the Program It's a simple implementation of Observer Pattern. The choice of different NotifyMethod will affect how those observers are notified. The ...
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,...
1
vote
1answer
222 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-...
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 ...
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 ...
5
votes
2answers
148 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. ...
5
votes
2answers
152 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 ...
3
votes
1answer
49 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. ...
6
votes
3answers
193 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 ...