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
0
votes
2answers
56 views

The bulls and cows game

I have implemented the bulls and cows game in C++. The code: ...
0
votes
0answers
31 views

Object Oriented Routing using Python's FastAPI

I created a BaseRoute class route handling. The BaseRoute class takes the following parameters: ...
1
vote
0answers
31 views

Resolving circular references in VBA via ObjectStore class and CleanUp cascade

Resolving circular references in VBA via ObjectStore class and CleanUp cascade I have been working on a VBA database library and realized I had a few circular reference loops in my class hierarchy, as ...
1
vote
1answer
61 views

Predeclared class instance tracks the number of regular instances

Predeclared class instance tracks the number of regular instances In VBA, predeclared class instances can act as object factories, and in general, it makes sense to keep this instance stateless. ...
3
votes
2answers
134 views

TicTacToe Objects calisthenics OOP

I'm learning Objects calisthenics and I was practicing with the typical Tic Tac Toe game, I was wondering if you could gimme feedback about my mistakes (Algorithmic problems, logic, and especially OOP ...
14
votes
4answers
1k views

Numerical integration in C++: Newton-Cotes formulas

I have tried my hand with implementing simple quadrature formulas in C++. Definite integral: $$\int_a^b f(x) dx$$ Domain of integration \$[a, b]\$ divided into \$n\$ intervals of equal length \$h = (b ...
2
votes
2answers
78 views

Fractions in C++

I started learning classes and operator overloading in C++. To test my skills I decided to make a Fraction class with all necessary operations. I would appreciate improvements and suggesstions on my ...
2
votes
2answers
65 views

Setting instance variable for salary bonus based on academic position

I have a class Scholar which is basically a teacher in a university. I have to calculate the yearly salary of a scholar instance where the formula is ...
2
votes
1answer
79 views

Evaluating postfix expression on multidigit numbers

This is my solution for evaluating postfix expression using a stack. It does work on multidigit numbers, the problem I was struggling with last time. Now it works completely fine. This is the stack ...
10
votes
2answers
2k views

Is my PHP login system following best practices? Is the code really OOP?

I'm learning about OOP and putting my knowledge into practice. I created a login system in PHP, so I wish someone could tell me if I'm on the right track. I feel like I'm getting better at coding, but ...
2
votes
1answer
85 views

Simple Lagrange interpolation

I wrote a Lagrange polynomial interpolation class. It works fine. At the beginning some definitions: $$ \begin{align} &nodes:\qquad x_0, \dots, x_n \\ &values:\qquad f(x_0), \dots, f(x_n) \\ &...
1
vote
2answers
105 views

Card deck for Blackjack in an OOP style [closed]

So far I have made a class called Deck, to create and shuffle a deck of cards, and a class called Player, which I want to use to create the gambler and the dealer. My Player class inherits from the ...
0
votes
0answers
34 views

Implementing a programming language with objected-oriented programming in EcmaScript 6

I am trying to implement the Dis language as a webpage in order to reproduce Dis programs for code golfing easily on browser. Since a famous online environment tio.run is not accepting new languages, ...
1
vote
0answers
24 views

Android Kotlin: Main Concept: Nested RecyclerView Handling Clicks; Secondary Concept: Appropriate use of OOP concepts

Brief Background: I just started learning Android Development recently. I have some experience with programming and understand the basics of OOP but am not confident that I am using principles of OOP ...
0
votes
1answer
38 views

React code that controls user permissions

I have this code that controls the user permissions provided to a user. In my case, I constructed a simple example of CRUD. When the admin checks the boxes, it will grant the user access to perform ...
0
votes
1answer
34 views

Stream that computes running median value

I was solving a DSA question, running median in a stream. And I decided to design my own stream class with additional features. ...
7
votes
7answers
2k views

DnD Die in Java with regex

For my game I need to roll some values with a die. A die is formally described as: nDs[+a] n amount of die (optional, 1 of not set, zero must be set explicitly) D ...
4
votes
1answer
95 views

Code to scan filesystem, store every path into sqlite and update only when something has changed

I have made a program that does what the title explains. It also hashes the file to check for changes. I will be doing this for a project to keep track of files that has been changed when doing ...
9
votes
1answer
197 views

Minesweeper implementation java

I'm writing Minesweeper implementation in Java. I have little experience yet, so I need some advices: about improving code, making it more readable and flexible about coding style about common ...
3
votes
0answers
53 views

Sudoku sequence solver for non-standard constraints

This script is designed to help solve sequences in Sudoku puzzles with variant constraints (ex: Thermometer, Renban, etc.). Summary The user specifies the constraints they want applied as well as the ...
6
votes
2answers
207 views

ASCII-based OOP blackjack game in Python

I'm new to programming and have been teaching myself to code for about 6 months. Since I have no one to ask about any of coding-related questions, I may have developed bad habits in the meantime, but ...
1
vote
1answer
87 views

Model animals using inheritance in Java

I was assigned the following problem: You've gone back in time to 500BC Athens and Socrates wants you to build him an app to help classify animals. Build the classes ...
3
votes
2answers
73 views

Finding Number of Objects in Image

I wrote a program that, given a 2D array representing pixels in a birds eye view image, it returns the number of Objects in the image. Pixels that are connected in the up, down, left, and right ...
2
votes
0answers
73 views

Arcade Stacker Game - Core Logic

This is my first post here, so I apologize if anything is incorrect. I have created an endless arcade stacker game (like the stacker games at the arcade, but when you hit the top the grid resets and ...
0
votes
2answers
75 views

Separating odd numbers and even numbers into two vectors in C++

I'm learning C++, and would like some guidance. I'm pretty sure I'm doing something wrong. This algorithm runs in O(n) time and uses O(n) external space. Could I make a more efficient algorithm for ...
4
votes
1answer
83 views

PHP object oriented programming

I'm trying to learn OOP with PHP (I know it's hard because It's not an OOP language). I'm rewriting my procedural code to OOP.Please provide any feedback on my code, naming and file/folder structure. ...
3
votes
2answers
218 views

Snakes and Ladders OOP

I've created a simple Snakes and Ladders game. The goal is improving my knowledge about OOP.There are some basic rules. I need to be able to move my token. The token starts in the square 1. If the ...
0
votes
3answers
71 views

What is the elegant way to merge collection of entities with a duplicate field?

I have the following entity, I am getting it in response of REST API. class Account { private String ownerId; private List<String> coOwners; } REST ...
1
vote
1answer
70 views

Prevent Column Name Collision

I have been working on a series of posts about a library to connect to databases but most of the scenarios I have to resort to some "JOIN" the problem arose when two or more tables had some ...
3
votes
2answers
162 views

Print a Menu in the Command Line following SOLID

Problem Description I am building a library that helps me building TUI Apps more faster, for example printing TUI Menus and other components. I would like to get feedback on my design decisions to see ...
8
votes
3answers
3k views

Calculate evapotranspiration

I am trying to create a code for the Basic evapotranspiration equation by Hargreaves. I have attached a screenshot of the equation to be replicated. I want to create a class wherein I can input data ...
3
votes
0answers
122 views

VBA class managing loading DLL libraries

I am playing with a custom-built SQLite library intending to access it from VBA via the C-language API. I keep the library within the project folder, so I load it via the LoadLibrary API. To make the ...
1
vote
2answers
49 views

optimization csv from url analyzer

I was messing around with the csv package and I tried to implement a class that returns csv objects whenever I need to open a csv file directly from a url(and occasionally prints out something).I am ...
1
vote
2answers
35 views

Refactoring Ruby recharge REST API wrapper by using class variables

I am trying to create an API wrapper for recharge (A Shopify subscription service), I am using the HTTParty gem ...
0
votes
1answer
32 views

Refactor typescript long switch case that run different code in according to property value

I have a typescript function that executes an array of actions on a given string value. This is the code: ...
1
vote
1answer
94 views

Rock paper scissors coding assignment

I had a coding assignment to write a Rock Paper Scissors game. The main task is not to show a solution but rather to test the coding style. The rules are such: Problem: rock is "O", paper is ...
0
votes
1answer
44 views

DbRecordset: Updatable recordset with transaction and affected rows count check

DbRecordset is a new class added to a fork of the SecureADODB library, which wraps the ADODB.Recordset class. It complements the functionality of the DbParameters class from the previous post and ...
0
votes
2answers
83 views

Inventory maintenance for a company

This code was done to allow a user to input, edit, search, delete and print a report of all the products in the company. Is there any way to improve my code? ...
7
votes
2answers
96 views

Connect to MYSQL database in PHP with prepared statements

I have recently learned about using PDO. I created a db class which could handle common actions like create, update, delete and select. Is this method a correct way to connect to the database using ...
0
votes
1answer
114 views

Writing data to CSV, checking for duplicates

I am writing a program that takes user input and writes it to a CSV file. I am also checking to see if what they have input is a duplicate of whatever is in that CSV file. So far, the flow of this ...
0
votes
0answers
45 views

Two sets of scripts for a Katamari Damacy-style game

I would like some feedback on trying to implement SOLID principles to my Katamari Damacy-style game, I have provided below the 'original' script which accomplished a variety of tasks, and then the '...
2
votes
0answers
54 views

Extending the SecureADODB library

SecureADODB is a very instructive VBA OOP demo. I have played with SecureADODB for a while and plan to integrate it into the prototype of my database manager application. In my previous post, I showed ...
0
votes
1answer
37 views

Is there any way to make my JavaScript code more logical and efficient? How to convert functional to OOP in JS? [closed]

I created some tooltips using javascript but after writing the code I found it a lot more complicated and hard to read/understand is there any way to shortened my ...
1
vote
1answer
69 views

Best way to cherry pick objects from array of objects

With this data I am returning one object per keyword prioritising preferedDomain string on domain and then its higher ...
4
votes
2answers
190 views

Simple password generator with a GUI

I made a simple password-generating app with a GUI written in Python and the tkinter library. Here's how the GUI looks like: The passwords are strings composed of ...
0
votes
0answers
62 views

React Typescript Project Using Traditional OOP Patterns

I'm writing an app meant to have similar functionality to LucidChart - drawing shapes/diagrams. I'm using React with Typescript (Create React App) and am trying to follow OOP/polymorphic patterns I've ...
2
votes
2answers
67 views

Complex Filter in one Opration

I am working on a Data-based application. I wrote a code to filter the table. The table has String and Numbers. I some filter ...
1
vote
0answers
73 views

VBA OOP design patterns: factory, constructor, returned interface

While working on my demo database manager app, I have coded a previously presented Storage Library. The structure of the library's code and employed design patterns partially follow that of the Secure ...
1
vote
2answers
94 views

Java dependency injection and hiding details of methods in "Database"-class

I recently posted a bunch of code of my to-do list application and after getting some very helpful and good suggestions on how to improve, I took a shot at it! Here's a link to the former post I made -...
5
votes
1answer
61 views

I'm writing a python chess UI+backend and I would like feedback on where there are issues before I continue to expand it

Firstly, the code relies on importing images, so I'll link to the repository as well as including the code here. If it's an issue that images need to be downloaded OR there is another solution please ...

1
2 3 4 5
74