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.
3,799 questions
-5
votes
0
answers
84
views
Object oriented programming deque implementation (after another second thought)
After another second thought from the second thoughts series Object oriented programming deque implementation (after second thought) it turns out using static methods alternatively to method ...
0
votes
0
answers
61
views
Сreating a digital twin of the enterprise
I am creating a program to create digital twins of enterprises. I am using the Simpy framework for this purpose.
I'm creating a universal system that can model almost any enterprise, but I have a ...
-1
votes
2
answers
186
views
Object oriented programming deque implementation (another second thought)
Another second thought from the second thoughts series Object oriented programming deque implementation (after second thought) led to disposing if statements ...
-7
votes
1
answer
128
views
Object oriented programming deque implementation (after second thought)
The java.util.Deque implementation from Object oriented programming deque implementation that consists of three elements linked arrays, each array holding reference ...
2
votes
2
answers
113
views
Calculation of liquid propellant nozzles
I'm calculating the injectors, and I've added the complete calculation code and tested it using pytest. Can you suggest a better way to structure the code so that I ...
4
votes
1
answer
368
views
Tic Tac Toe Game app design - ways to design or segregate too much logic from UI
I wanted to check my system design and/or object oriented design skills. I started with this Tic Tac Toe WinForms Desktop program. The user couldn't input characters other than O , X . Both players of ...
-4
votes
1
answer
113
views
Deque implementation around strategy design pattern
Implementation of java.util.Deque interface based on string of POJOs, that is plain old java object, encapsulating a field for holding reference to each object ...
6
votes
5
answers
710
views
Basic word search puzzle generator
This is code for a basic word search puzzle generator (also "wordsearch"). The code:
Creates a 10 x 10 grid of letters.
Words are hidden somewhere in the grid, horizontally or vertically.
...
7
votes
1
answer
134
views
Player controlled dungeon creation system
I'm making a game with a system inspired by the PSP Game Dungeon Dungeon maker 2 the hidden war: Visual Reference. I have everything set up but I feel there are ways to make the code more simple and ...
4
votes
5
answers
773
views
Password storage with gatherer plugin in Python
First the PasswordStore, which is pretty straight-forward. It stores title-password association, but it is important that a title can have multiple passwords.
The <...
2
votes
1
answer
89
views
Encapsulating status codes and messages à la absl::Status
I'm new to Lua and thought a decent way of familiarizing myself with the language would be to implement some basic utility functionality around status codes. In particular I've reimplemented a subset ...
8
votes
2
answers
1k
views
Python OOP game of Hangman
I am currently learning object oriented programming in Python.
I attempted writing an OOP program for hangman, and while the program is functional, I just ended up writing a very long class method. ...
5
votes
1
answer
252
views
ReportManager design — ownership via move or unique_ptr, SRP concerns, and O(1) lookup strategy
I’m practicing the Single-Responsibility principle with a small project.
A Report is composed of ...
2
votes
1
answer
148
views
ABC/XYZ business process analysis
I have written a code that deals with ABC/XYZ analysis. I want to use it in my application and would like to find out how the code can be improved, its readability and it will be better to implement ...
-1
votes
1
answer
117
views
Am I overusing classes and/or OOP features? [closed]
I have a very class heavy approach to writing C++ code, which I don't think is necessarily wrong. However, I often use classes without knowing if I actually need them, which I feel leads to making ...
8
votes
2
answers
998
views
A tree of polymorphic types (Crafting Interpreters Book)
I am following the book crafting interpreters by Robert Nystrom using C++. In the book we use an Expr base class to describe expressions in the language lox. ...
6
votes
3
answers
568
views
Menu user interface class in C++
I wrote a menu user interface in C++. What do you think about my code? What can I improve? Am I missing some better practices?
main.cpp
...
0
votes
3
answers
238
views
Java exceptions that show the message when converted to String
I’m working with custom exceptions in Java for stack operations. However, I’m unsure if the exception handling is being handled properly, especially in terms of how exceptions are thrown and caught. ...
0
votes
1
answer
78
views
Bulk conditions evaluation throwing a single RuntimeException exception
Bulk conditions evaluation throwing a single exception of a configurable type for all unfulfilled conditions.
It is developed around several design patterns:
(1) fluent interface to configure the ...
7
votes
1
answer
915
views
Yet another finite state machine in C++
I know there are several implementation of FSM in C++ containing different set of features and written in different styles. Nevertheless, I've decided to write my own.
Here are some key points :
c++...
11
votes
3
answers
2k
views
Computing π(x): the combinatorial method
This is my C++ implementation of Computing π(x): the combinatorial method by Tomás Oliveira e Silva. The math involved is elementary number theory, but fiddly and not the focus here. I have ...
6
votes
2
answers
505
views
OOP Calculator Program
I am building a Calculator in C++ OOP style. I made 3 Classes:
UserInterface, which is responsible for Input and Output of the User.
Calculation, which is responsible for the logic of the Calculator.
...
3
votes
1
answer
240
views
Simulate an Automated Teller Machine (ATM)
(Game: ATM machine) Use the Account class created in Programming Exercise
9.7 to simulate an ATM machine. Create ten accounts in an array with id
0, 1, . . . , 9, and initial balance $100. The system ...
6
votes
2
answers
132
views
ADT vector in C++
I have created a vector ADT, and this is a brief code for all of you. I will further add some more methods in it.
Kindly review my below code:
...
8
votes
4
answers
1k
views
7
votes
3
answers
501
views
First Java Program: A Basic GUI Library Management System with JavaFX
Requirements:
Add/Delete member.
Add/Delete book.
Issue/Return book.
Review Request:
General coding comments, bad practices, style et cetera.
Code:
Main.java:
<...
4
votes
2
answers
217
views
Swift String-extension 'countOccurrencesOfChar'
Loosely inspired by Ruby's String.count-method I wrote a similar Swift-method myself as an extension to the String-class. Then I had the idea to use a second parameter with which you can control if ...
3
votes
1
answer
120
views
Merge discrete integer intervals
What it does
The code starts with a set of integer intervals, and can add new intervals (possibly by updating existing intervals). Essentially, it is a bit array whose index starts at ...
3
votes
2
answers
181
views
Object Oriented WinForm App
I have started my first foray into object oriented programming and I wanted to find out if what I have done here makes sense:
Pokedex.cs
...
3
votes
1
answer
169
views
Amount Transfer Between Different Accounts - Improved Version
This is an improved code version for Amount Transfer Between Different Accounts
Welcoming any further improvements for this.
...
4
votes
1
answer
126
views
Sequentially bidirectional find the indexes of an element into a collection (after second thought)
The util class to find all the indexes on an element into a Collection supports forward and reverse lookup starting from a given index along with changing the ...
4
votes
1
answer
268
views
Amount Transfer Between Different Accounts
I implemented the below classes for transfer amount between different accounts. Used ConcurrentHashMap and Stamped Lock to handle concurrency.
Am I missing any important concepts here? Are there any ...
7
votes
4
answers
2k
views
A simplified Blackjack C++ OOP console game
This is my first time writing something bigger with OOP. A simplified version of the card game BlackJack. Hand splitting currently isn't implemented.
File tree
...
5
votes
2
answers
960
views
Reduce String Length With Thread Safety & Concurrency
I implemented the below URL Shortener class. Used ConcurrentHashMap to handle concurrency.
Short URL building logic may not be optimal, but it ensures that only ...
4
votes
1
answer
156
views
Advanced Python Calculator using OOP
I've been into computer science fundamentals (proper data structures/algorithms/etc) including Object Oriented Programming. Therefore, I decided to reformat my old traditional Python Calculator into ...
2
votes
1
answer
96
views
Handler for YAML file settings values
I am writing a program for calculating rocket engines and for its operation I store all the settings in files with the extension .yaml . To do this, I wrote this code and I want to get feedback and ...
6
votes
4
answers
218
views
Deck Value Bet-Like Game
I have just gotten into Object Oriented Programming and I've been practicing it through Python. But I think I still haven't clearly grasped how it should be used effectively. I've created a game Using ...
2
votes
0
answers
311
views
Simulating Objects with Collections in VBA
Update
I have released a prototype (v0.1.0) of my SOb project, which is a generalized framework for easily simulating objects.
Background
I am writing a VBA module ...
-2
votes
1
answer
116
views
Initializing an object using a staticmethod
I've an object that looks like this, and users have been populating the attributes post-initialization, e.g.
...
6
votes
2
answers
725
views
What is the best way to set a class value to a variable in Python if it exists in a dictionary?
I have this code which sets values in a location class from values from JSON data.
...
1
vote
1
answer
301
views
Rules-engine to be improved/simplified for Efficiency (performance), Extensibility and Maintenance?
This is a simple implementation of a rules engine. I am really hating the very long MATCH/CASE function. I am wondering what kind of Design Patterns could be used there to make this code more ...
4
votes
3
answers
371
views
Calculation of centrifugal liquid propellant injectors
There is this code in which the calculation of the centrifugal nozzle of a liquid rocket engine is performed. All basic calculations take place in the Injector ...
2
votes
1
answer
118
views
Semi-generic data loading utility class
The following implements a relatively generic and modular data loading utility. It loads images from a local storage given a lookup table. The data loader is parametrized via dependency injection to ...
7
votes
2
answers
657
views
Advanced Python Grade Calculator
In this project, I've developed an Advanced Grade Calculator that not only calculates the average grade but also accounts for credit hours and predicts future performance based on historical grade ...
2
votes
0
answers
80
views
Classes for Config and logical operators
I have a spring cloud gateway application with this yml structure for request validation:
...
5
votes
2
answers
440
views
Poker bets on Python
I'm writing poker for my bot in discord. So far I'm presenting an incomplete version of the project, which is only a betting system. The development took a lot of time, so I decided to ask for help. ...
3
votes
2
answers
208
views
BlackJack in python
I began creating blackjack in python; however, I'm looking to simulate it, so I'm thinking I'm going to need to optimize it so that I don't just leave my computer running for three hours waiting for ...
3
votes
2
answers
324
views
Tic-tac-toe OOP Minimax Algorithm
I wrote a module that I intend to use in my next tic-tac-toe project. All it is is a class that stores the boardstate along with some methods/properties. The biggest thing is the minimax alg. As shown ...
7
votes
3
answers
1k
views
Is this Python/Pygame that draws a maze well structured?
I'm not very confident about this piece of code I created, it basically takes a file like this:
## #
## ## #
#B # #
# ## ##
##
A######
Then proceeds to ...
4
votes
2
answers
370
views
Optimizing Multiple Subplot Visualization and Navigation in Matplotlib
I have implemented a class in Python using Matplotlib for visualizing multiple subplots along with navigation buttons to move between different subsets of data. Each subplot displays a contour plot ...