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
0answers
86 views

Was this an idiomatic and prudent way to extend R's matrix multiplication syntax? Should I have used R's object system?

After reading one too many Lisp books, I decided to try extending R's syntax. My goal was to implement repeated matrix multiplication in a way such that I could write ...
3
votes
1answer
95 views

Game in Python3 using OOP

So iam making a game using OOP in python however is this the best practise when defining your objects? are you meant to define them all at the end of the script like I've done, or are you meant to ...
1
vote
1answer
77 views

A Paragraph Merger with Removing Overlapped Duplicated Lines in C#

I am trying to make a paragraph merger that takes multiple paragraphs and output a concatenated result with removing the duplicated overlapped lines due to redundancy. Each input paragraph is with the ...
1
vote
1answer
88 views

C++ matrix class follow up

This is a matrix class with addition and multiplication. I tried incorporating all the helpful advice I got on my previous attempt C++ matrix class , specifically using std::vector for memory ...
0
votes
2answers
853 views

Javascript + Filter object of values

I have the object with values. I trying to filter based on values. ...
6
votes
2answers
261 views

C++ matrix class

I wrote a matrix class in C++ with an addition and multiplication method. It works fine, but I don't think a C++ programmer would enjoy reading this. I would love some help with that. ...
7
votes
1answer
155 views

Java service to convert xls files to HTML

I have a service that converts an Excel spreadsheet file into HTML. It is working just fine, but it is quite a big method that doesn't follow any SOLID principles. Therefore I would like to improve it ...
7
votes
1answer
182 views

Blackjack game in Java

So this is a blackjack game, any feedback or tips on what I should remove from the code that is not needed is very appreciated. Note: some of the names of classes or variables are in Swedish but it ...
3
votes
1answer
75 views

Is this usage of the dynamic keyword an indicator of a design fault?

I feel like I'm likely violating a design principal or two here so I'd appreciate any mistakes or antipatterns being named and pointed out. I'm attempting to map a system in code which represents a ...
1
vote
0answers
18 views

How to code a minimization problem with constraints and indices into PSO within MATLAB? [closed]

I have a GAMS code that represent a mathematical model which depends delay (i,p) for each job i and the period of day p. So, I have indices for represent delay and objective is minimizing of summing ...
1
vote
1answer
123 views

A Generic Two Dimensional Data Plane with SubPlane Method in C#

This is a follow-up question for Generic Two Dimensional Data Plane with Manipulation Methods For C# and A SubPlane Method for Generic Two Dimensional Data Plane in C#. Based on iSR5's suggestion, in <...
2
votes
1answer
91 views

Software driver for analog to digital converter

I have been developing a software driver for the internal a/d converter on this platform. The a/d converter peripheral is described in following document. The driver is written in C++ and is build ...
4
votes
2answers
624 views

JavaScript: Parking lot simplified OOD

I was trying to designing a simplified parking lot management system. It has three types of slots (s,m,l). The goal here is that we want to make the placement/release of cars as efficient as possible, ...
2
votes
1answer
210 views

Implementation of a ticket queue system in JavaScript

I got this question during an interview. The question itself was very open-ended - it asked me to implement a ticket queue system, where by default it would have 3 different queues to hold tickets ...
2
votes
2answers
58 views

How to convert traditional code to reusable function

I have different function for different task below this function. To reduce the code, I have written following function. Is this the best way to apply OOPs? or any better way to do? Function ...
3
votes
1answer
115 views

Simple Hangman game in Python3

I made a simple Hangman game in Python: ...
4
votes
2answers
233 views

Modifying __getattr__ to return a nested attribute instead of the named object

I'm writing an application with two basic class types: DocumentObject Property (of document object). Property instances are attributes of the ...
1
vote
1answer
42 views

Transform Data from JSON and CSV to another JSON format

I have 2 files wholesaler_a.csv ...
1
vote
2answers
91 views

Create a Card game called match

For an interview, I had to create a card game called match. The rules were the following: Players can choose a number of packs of playing cards and combine them ...
3
votes
4answers
55 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
81 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
129 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
107 views
1
vote
2answers
159 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
83 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
1k 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
105 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
55 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 ...
7
votes
3answers
608 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
187 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
95 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
323 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
396 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
74 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
83 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
31 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
43 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
206 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
105 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
68 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 ...
3
votes
1answer
127 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
44 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 ...
3
votes
1answer
187 views

A BigInteger class

I made this project to practice object-oriented programming. I have implemented operator+ and operator+=. The rationale behind <...
3
votes
1answer
139 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
137 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 ...

1 2 3
4
5
73