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.

0
votes
0answers
8 views

Node.js DataBase class for adodb databases

A while ago I was working on a multipurpose database class (an es6 javascript class) that works with any database supporting adodb. This class is a wrapper on the "node-adodb" npm library. This ...
2
votes
0answers
27 views

X, Y Coordinates class in Lazarus (Delphi-like)

After I've now officially announced, that I'm discontinuing my color picker for Windows, I'm about to embark on a journey through Linux development. I was quite strong in Delphi on Windows, and see ...
0
votes
0answers
22 views

Yatzee game control [on hold]

I'm writing an Implementation of the Yatzee game. when the AI Players turn is made i'm a bit in trouble because i don't know how best controll the flow: ...
-4
votes
0answers
20 views

Design of Concept Class for java [duplicate]

I need to find the flaws in this design. Can you think of anymore flaws? and how to fix it Concept.Java ...
2
votes
2answers
62 views

Design for a simple a shop

As a continuation to my question Design for a very simple e-shop I made some of the changes proposed but not all of the proposed for example I was not able to make a factory for the setAttributes. ...
-1
votes
0answers
20 views

Both my functions act on a slice of strings, should i use one loop and pass in the appropriate function each time? [closed]

My plan is to use a similar approach for other loops but not sure if it's the best way to go. I am new to higher order functions and this does seem like the right approach to me. My get left ...
4
votes
3answers
107 views

Design for a very simple e-shop

I had to design a very simple e-shop in C++ but I don't know if my design is the correct one. I mean in sense of re-usability. How can I find out if I have done a good design and how can I further ...
-2
votes
0answers
46 views

Factory Pattern [closed]

I'm reading the following document about Factory Pattern : Link I don't quite understand the following lines of code: ...
6
votes
0answers
42 views

Todo list using pure JavaScript

I watched a YouTube video and completed the Todo List using Pure JavaScript. Below is the code I wrote. I want to improve this code, but it 's not clear how. I want to change this code to ...
1
vote
1answer
38 views

Convert query string into object in JavaScript

Suppose I have this query and want to convert into an object a1.b2.article1=0&a2.article2=1&c3!article3=0&article16-abc=2 output for this should be ...
1
vote
0answers
56 views

Way to hide logic behind class for better readability of method and refactor class to follow SRP [closed]

I have an algorithm to create a version for an entity and then I save that version against below 2 entity: 1) Variant 2) Category ...
3
votes
1answer
36 views

Subject group creation/selection using multiple filter tags derived from multiple databases

This is part of my research project with the main objective to select patients from various characteristics that are modeled as filters. The main filters include ...
4
votes
1answer
59 views

Beginner c# snake game

I just started using c# and I made this snake game in a console application . It is a bit jittery when i run it in visual studio. How could I improve it to be cleaner and less jittery. ...
11
votes
2answers
125 views

HTTP C++ Implementation

this is the first time I've requested a code review. I'm writing a piece of software in C++ that will use HTTP for communication. I wanted to do it myself to learn and then have someone review it and ...
1
vote
0answers
24 views

Go - avoid result reassignement in OOP [duplicate]

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: The code implements the steps a podracer takes to ...
1
vote
1answer
46 views

Simulating pod racing over a 2D map : am I implementing OOP in a GO-like fashion?

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. I used an OOP design. Is it correctly implemented ...
0
votes
1answer
127 views

Simple calculation of sector coefficients using PHP

Function This class extends the key class, called EQ, and does basic calculation based on minutely data. It then calculates weight coefficients (e.g., [0, 1]) for ...
1
vote
1answer
64 views

PHP class for scanning filesystem

I have a modelScan.php file, as you can see, I have codes that repeated within the function/method. How can I make this code more readable? ...
3
votes
2answers
58 views

Add three integers and report the sign of the sum

I am in my first high school programming course; the assignment is: Write a program that asks the user to input three integers and outputs a message indicating their sum and whether it is ...
2
votes
0answers
74 views

Total steps of of long process, track completed steps, reuse query [closed]

I have some long-time method (PrintInfo). I need to know total steps of that method and track completed parts. How to reuse same filtered query in: TotalSteps (ex, Program: progressMonitor....
0
votes
2answers
73 views

Custom Error Classes in OOP

I have a class which parses a .csv file and converts it into successful rows and errors. Currently I have 12 different kind of errors (mail is not valid, missing column x, row is duplicate etc.). ...
4
votes
2answers
98 views

Defining a class that behaves exactly like an `int` [closed]

This is an exercise to create a class that behaves exactly like an int. Questions Am I missing anything? Or did I going about this about this the wrong way? Is ...
7
votes
2answers
299 views

Combinable filters

I have an initial pool of subjects, then I need to apply a set of general criteria to retain a smaller subset (SS1) of subjects. Then I need to divide this smaller subset (SS1) into yet finer subsets (...
4
votes
0answers
63 views

Straightforward tax calculator OO design

Similar questions have been asked here before and my solution is pretty much in line with some of the answers. I wanted to work on this a bit. Scenario Basic sales tax is applicable at a rate ...
6
votes
0answers
48 views

Document classfier

Description: I am working on a classifier which categorizes the text based on some criteria, at present, it is a map of category and list of words if any of the words appear in the text, a category ...
5
votes
1answer
58 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 ...
3
votes
2answers
83 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 ...
2
votes
2answers
41 views

Remove and Add items from array in nested javascript object [closed]

I have the following object at React state: ...
1
vote
2answers
53 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
64 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 ...
3
votes
0answers
80 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 ...
6
votes
1answer
110 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
118 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
0answers
50 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
87 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
57 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
1answer
53 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
84 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
26 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
39 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
55 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
92 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
141 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
85 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
46 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
56 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 ...
2
votes
0answers
35 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
157 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
52 views

Immutable employee class

I have created an employee object to be immutable. ...
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×...