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.

Filter by
Sorted by
Tagged with
3
votes
4answers
56 views

Generates barcodes using iterator objects and an iterable objects

first allow me to explain the what the purpose of this program is: a "barcode" as I'm calling it consists of three parts: plant_id=['ATX','HOU','CHS'] Serial Number: a string of 9-digits ...
2
votes
1answer
94 views

Builiding a Model from Stored Procedures

After reading that Data Classes can be considered a code smell, I am shifting from a pattern with many data classes and a single manager class that handles all the instantiation of the classes, to a ...
7
votes
2answers
132 views

Object Attribute Stored in New List from Existing List of Objects

For my CS class I the task given was to take a given Person Class with a name and age attributes. Then, with an existing list of Person Objects, create a function that returns a tuple of (mean, median,...
2
votes
2answers
90 views

C++ switch-like code structure

I'm developing a class for connection to LCD (Liquid Crystal Display). It can connect in two modes: 4-bit and 8-bit. And the number of modes may be increased. The mode can be configured in the ...
0
votes
1answer
124 views
1
vote
2answers
190 views

Create a simple hangman game using OOP and Javascript

I had a task to create a simple hangman game using O.O.P. with Javascript. It had to render the puzzle and remaining guesses to the DOM but didn't require any C.S.S. This is what I created. This is my ...
1
vote
1answer
89 views

Text-based console game

I'm currently learning C# in hopes of making games on my own using Unity. I'm using the Udemy class by Denis Panjuta and followed 8 sections before making my first app by myself. The 8 sections ...
2
votes
1answer
2k views

Python code for simple Vending Machine simulation implementing OOP principles

I am recently learning OOP concepts and thought that implementing a simple workflow simulating a vending machine would help me put what I've learnt into practice. I am open to criticisms and feedback, ...
2
votes
4answers
108 views

statistics classes with number and object inputs

I want to create two classes that accept values and perform operations on them. However, one of them is accepting numerical values - RollingStatisticsNumbers; and the other objects - ...
1
vote
0answers
58 views

How do I create an "Environment Variable Setter"?

I have a NodeJS/Typescript project. In server.js, I want to set my environment variables from a .env file. To achieve this, I am ...
6
votes
3answers
629 views

Double Linked List with smart pointers: problems with insert method

I'm trying to implement a Templated Double Linked List, following Stroustrup's book "Principles and Practice using C++", Chapter 20.4. Instead of raw pointers, I want to use unique pointers. ...
2
votes
0answers
220 views

Python metaclass for inner classes

This is a metaclass for facilitating the concept of "inner classes" (as opposed to simple nested classes) in Python. I define an inner class as a nested class that expects an instance of the ...
3
votes
1answer
117 views

Golang Rest API

I want to ask if there is a better way to arrange this. Main concern is whether the store is set up in a good way and if passing Pointer to ProductRepository is a good idea or there are better ways ...
2
votes
0answers
30 views

AVL dictionary implementation

I have implemented a dictionary with an AVL tree, and here is the code and I need help improving it. ...
0
votes
2answers
540 views

struct,template arguments, C++ [closed]

I am writing color model logic in C++. I ask review in defining limits for the color model, by saying Limits I mean this. Consider a struct which represents ...
6
votes
2answers
563 views

Enum union in Python

This is a snippet of code written in Python 3.9 to implement the concept of "enum unions": an enum made up of several sub-enums whose set of members is the union of the sub-enums' members. ...
3
votes
1answer
79 views

Cyclic generator with access to current local state and executes callback after each cycle

I'm working on a Python class that is a cyclic generator, like itertools.cycle, but it offers access to its current state and executes a callback after the ...
0
votes
1answer
84 views

Account class design using OOP paradigm [closed]

I have a class Accounts with an array of account numbers and an array of balances I have a member function add_acc that adds an account. But before adding an account, I want to check if the account no....
2
votes
0answers
32 views

Python - preprocessing dataframes data in a class

Context I am building an algorithm that automatically assigns a planning to drivers. However there is a lot of pre-processing and reused outputs. I try to structure it in a maintainable way. Questions ...
0
votes
2answers
49 views

on using the strategy pattern to switch between database layers

I'd like to build an app in Flask that can switch between talking to a PostGresql and a Mongo DB. As I understand it, the Strategy Pattern is about being able to switch algorithms that are referred ...
5
votes
3answers
208 views

Basic modelling of a player in Fantasy Football via classes with inheritance

My program represents a basic model of a player in Fantasy Football with players playing in different positions and having different scoring systems for the actions on the pitch. A particular usage is ...
2
votes
0answers
108 views

Movement of the elevator inside the building

The project is about simulation 5 elevators in 5-storey building. In the real world example, an elevator is going up then going down. Example going up ...
2
votes
2answers
71 views

Software driver for digital inputs expander communicating over SPI

On this platform I have been developing a software driver for two digital inputs expanders communicating over the SPI. My C++ code is based on the SPI driver which accompanies the SDK offered by the ...
-1
votes
1answer
30 views

avoid inner classes [closed]

I'm trying to implement method chaining with classes, but struggle to make it without inner classes. Specifically, I have three classes: a class for different data loading a class for computation of ...
2
votes
1answer
160 views

A program to check the age of a movie attendee (C# Yellow Book excersize)

I am currently working through the C# Yellow Book, as a first step in self directed learning. I'm supplementing that with C#8 In a Nutshell, and general searches of the Microsoft C# language ...
0
votes
0answers
48 views

Implementing an RSVP Event App in C#

I'm creating an RSVP-type application which will later be implemented in a mobile application I'm making. In this mobile application the user can select different events around their area and can ...
0
votes
1answer
32 views

Avoiding verbose compositional class design

I've written some code which features Eric Elliot's javascript factory function mixin composition (https://medium.com/javascript-scene/javascript-factory-functions-with-es6-4d224591a8b1), but since ...
1
vote
0answers
42 views

ViewModel Format Function

I had to create this method GetModelFormat and wanted to see if there is a better way to format the view model that is being return. I would be happy for any kind ...
2
votes
1answer
192 views

A BigInteger class

I made this project to practice object-oriented programming. I have implemented operator+ and operator+=. The rationale behind <...
2
votes
1answer
142 views

Noughts & Crosses (Final Version)

I've made a major update to my Noughts & Crosses program, this ISN'T a duplicate! I know it's not good to use system("pause") and system("cls"), however, I just wanted to make ...
4
votes
0answers
166 views

Reading sensor data from serial device and publishing on MQTT

I have a weather station with a data logger which accepts commands (specified in user manual) and sends back the respective data over a serial interface. In my case, I want to read the current data ...
4
votes
2answers
349 views

API for SQL queries with PHP PDO

I'm writing a very simple CRUD application, and I'm wondering if the way I'm using static methods throughout the code makes sense. I'd very much like to simplify ...
11
votes
8answers
3k views

OOP implementation of Rock Paper Scissors game logic in Java

What is your opinion on my solution for Rock Paper Scissors game logic in Java? Round outcome enum class ...
3
votes
1answer
55 views

Design pattern for creating similar but different classes

I have a main-class that takes a list of sources and returns two objects for each source; one with the required data and one analytics tool. The Analytics-class has ...
3
votes
0answers
72 views

Modeling data from Excel sheets to parse to Excel sheet

Background: I have close to 50 excel files - I cannot change the data source - and I steadily get more. My task is to make sense of all that data and, lo an behold, save that as another excel file (I ...
4
votes
1answer
82 views

Matrix template Class

This is my 2nd shot at dynamic memory allocation. This project is for practice purposes. So many things were considered whilst writing this minimal project. I considered using placement new to ...
1
vote
2answers
101 views

Repeated DB connection at max user connections

I am trying to create class with connect to mysql database. And if there is max number of connections I want to wait and try it again. I figured out, how it can works, but I am not sure, if its the ...
2
votes
1answer
91 views

Is this an excessive abstraction using objects?

We have two physical AWS S3s called in the code s3Legacy and s3Cache. They store the same data but with different S3 key ...
3
votes
2answers
576 views

Chess game object-oriented

This is an object-oriented Chess game. So far, I have implemented the pawn and board functionalities and I would love to get a ...
1
vote
1answer
78 views

JavaScript, looping, and functional approach

Data Structure coming back from the server ...
2
votes
1answer
67 views

Revised console-based quiz application

This question is a follow up to my previous question, link to the post can be found here. I really appreciate the reviewers especially @Edward's review. They highlighted great points which were ...
8
votes
3answers
1k views

A* (shortest path) with the ability to remove up to one wall

Problem You are given an HxW matrix. Each element is either 0 (passable space) or 1 (wall). Given that you can remove one wall, find the shortest path from [0,0] (start) to [width-1, height-1] (end). ...
4
votes
0answers
215 views

Simple target shooter game using Windows Forms

Currently, my game is a basic target shooting game. The targets rise to the top, if the target reaches the top an end screen is shown. If you shoot a target you get more score, and the speed in which ...
5
votes
2answers
831 views

OOP concepts In a console application

I'm currently trying to improve my skills in Java. I have created a simple console-based bank system with four classes. A user interface, account holder, abstract bank account class which account ...
6
votes
4answers
382 views

Console-Based Quiz Application

I wanted to practice more object-oriented programming and decided to write a console based Quiz Application. In one of my previous question, a reviewer left some links on SOLID design pattern, I went ...
1
vote
0answers
130 views

Rock paper scissors in C# using more efficient choice comparison

I decided to create a rock, paper, scissors game in C#. I realised early on that standard if-else evaluation in rock-paper-scissors would take up a lot of code. So I decided to use more efficient ...
9
votes
3answers
1k views

Machine Language Simulator

Simple Machine Translator(SML) is a simulator that executes code written in hexadecimal. It supports features such as read, write, add, subtract and many more. My previous question concerning this ...
3
votes
1answer
48 views

Match users to their preferences by ID

I am using Java, but coming from a JavaScript background. I have two objects: a list of users an Iterable of users preferences I am joining them into a new users object that I call ...
5
votes
2answers
2k views

C++ OOP Tic Tac Toe

This is a follow up to my question here. Well, it ain't exactly a follow-up, but more like my next project after the last one I created a tic tac toe game using object-oriented programming You all ...
6
votes
2answers
216 views

RPG item, character, and display

Question description I am currently developing an RPG to gain programming experience. An RPG consists of many individual components such as the combat system, quest system and the item system. I ...

1
3 4
5
6 7
74