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
-2
votes
1answer
44 views

python - class not returning the expected result. I am using function and a class [closed]

I am trying to pass 2 values from a function to the class and get a result from the class. For example, if I send value "dog" I should get the result as "dog runs" as a returned result. Need help with ...
3
votes
1answer
50 views

Android - Simplify ViewModel and Repository classes with OOP

Let's say I have 2 repository classes: ...
4
votes
1answer
75 views

java : jumping caterpillar program

Looking for code review, suggestions for improvement, best practices etc. Given N leaves numbered from 1 to N . A caterpillar at leaf 1, jumps from leaf to leaf in multiples of Aj (Aj, 2Aj, 3Aj). ...
1
vote
0answers
21 views

Faster Google Spreadsheet access and direct use of Named Ranges for code readability

This object structure, that I think might be useful for a number of projects, attempts to: learn the use objects (classes are not available in Google Apps Script) and inheritance minimize calls to ...
3
votes
1answer
44 views

User Class and MySQL Connection Handler

Mainly used Stack Overflow, so first time over here for a code review. I am trying to make some enhancements to a legacy application. I have some minor experience using Laravel, but this application ...
1
vote
0answers
59 views

Abstract vacation time tracker with states

I am writing a program for vacation in a company and the time that is allowed to be in a specific holiday I used an Abstract class with an abstract method: ...
-1
votes
0answers
31 views

making a simple text-based RPG with some combat in python [closed]

I have recently started making a text-based RPG with combat in Python. I wanted to start simple and then make it more complex, but I think I might have started a bit too complex for me. Anyways, this ...
0
votes
1answer
400 views

User class implemented with PHP 7.4 using Active Record

I need some constructive feedback for the working OOPs project which I created to introduce to Object Oriented Programming in a class. Hence is for beginners, I did ...
3
votes
1answer
70 views

Implementing a class hierarchy and instancing the base class in VBA

Objective: Have a single point of entrance to initialize a class that holds instances of "sub" classes Background: I read about inheritance in VBA (or as close ...
1
vote
1answer
40 views

VBA Class instance to simulate a framework

Objective: Simulate namespaces in VBA and access functions like if you had a Framework setup or at least that was what I ...
2
votes
1answer
47 views

Managing Excel Tables (ListObjects) with OOP Approach (Follow up)

This is a follow up to this question Objective: Manage what happens when users interact with Excel Tables (ListObjects) Code incorporates: Greedo's answer suggestions: Listen to an encapsulated <...
2
votes
1answer
43 views

Function to class migration: constructor best practice

I am working on moving some complex script logging from functions to classes. In the functional version I would use a string like this ...
3
votes
0answers
127 views

bowling game score calculator

I'm new to the Developers world and I have project that I've been working on. It's to calculate the Bowling Game Score (similar to the Hdcp Score done by this tool: https://bowlinggenius.com/ ) I'm ...
1
vote
0answers
17 views

Plotting Whether Measured Locations for Components are Within Spec *Revision

I've made this GUI program for my workplace that checks whether measured coordinates on machined components are within spec. It takes in specified coordinates, tolerance and measured coordinates and ...
4
votes
1answer
122 views

Managing Excel Tables (ListObjects) with OOP Approach

Objective: Manage what happens when users interact with Excel Tables (ListObjects) Possible interactions: Update an existing Excel table Add rows/columns to the table Update a cell or a range of ...
1
vote
0answers
16 views

Error handling approach for parameter errors in Typescript modules?

I have been tormented by the question of how to handle parameter errors by consumers of my modules, and also in classes which are extended from base classes. The particular sort of concern I have is ...
0
votes
1answer
44 views

Design practices for an app that interacts with other classes

I am doing a practice project to create a calculator with OOP principles. Below is my CalculatorApp that communicates with Calculator(to calc integers) and StringParser(to tokenize input). For ...
2
votes
4answers
98 views

I'm deallocating objects created but I'm unsure whether my code is leaking memory or not

I have a simple application which requires the user to input details about students and their grades. I have two different classes Student and ...
3
votes
1answer
28 views

Plotting Whether Measured Locations for Components are Within Spec

I've made this GUI program for my workplace that checks whether measured coordinates on machined components are within spec. It takes in specified coordinates, tolerance and measured coordinates and ...
3
votes
1answer
91 views

Elevator Design

I want to design an elevator system, which has functionality for pressing button from outside of the elevator (Not selecting a direction - Only calls the passenger’s existing floor). And also select ...
2
votes
2answers
80 views

Rock, Paper, Scissors completed game

I have just completed my first Ruby OOP project. Fairly simple but still a bit time consuming as I am still learning the language. I would like feedback and ways I can improve on this and make the ...
3
votes
2answers
55 views

Organise method flow

I have something like a shop. It is limited to a checkout page, which will send an email. Nothing big, but a nice thing to learn more OOP. Almost every time I develop new classes I am wondering how ...
0
votes
2answers
71 views

Library app with JavaScript

My Approach The code for the library project is all over the place, how would you code this project using object-oriented programming. For example, would you use ...
4
votes
1answer
80 views

strategy pattern, good practices on how to switch between classes

i'm using an external API that posts products and orders into a marketplace, and it provides a class that in each request i have to specify an endpoint, ...
-2
votes
2answers
106 views

volatile variables and parallel streams in Java [closed]

For the Below code want to know whether the correct procedure is followed for the java code , are there any missing points according to the java standards ? ...
2
votes
1answer
76 views

Python Making Methods Modular and DRY

I'm learning object oriented programming and am still trying to understand the best way to structure a class for modularity and attempting to follow DRY principles. I currently created a class ...
13
votes
3answers
658 views

Basic Blackjack program in Python

So in my quest to learn coding while having very little formal training has got me here. I am trying to learn the OOP concept and this is my first proper attempt at using OOP. Can you guys point out ...
5
votes
1answer
54 views

Class for Switch statements

This is more to get clarity on an implementation that I did. I am working on a React, Node, and Electron application that essentially has a form that a user inputs values that will update some content ...
3
votes
2answers
227 views

Script for Python Hanoi Tower OOP

Is my Python Script to play Hanoi Tower respectful of OOP spirit? I have difficulties to create meaningful classes so I started an easy project. Here is one class at the plateau level and then a ...
3
votes
2answers
52 views

Card-'Drafting' Engine

Here is a functional "card-drafting engine" which runs through pygame. It simulates fliping cards face up on the table, and the ability for two players to draft through the cards.There are two ...
1
vote
1answer
56 views

A calculator with support for large integers and variables

I'm quite new to both Java and OOP. I'm assuming that pretty much everything about my code can be improved and I appreciate any feedback. However, I am particularly interested in what you think ...
1
vote
1answer
22 views

Implementing data sync from multiple source using OOP concepts

I am writing code to implement data sync from multiple sources. I want code to be maintainable to add more data sources if required. Here is the pattern I wish to follow: ...
2
votes
0answers
15 views

Codewars: Remote Control Virtual Keyboard

This is my solution to the Codewars problem TV Remote (symbols). Description In short, you are given a virtual keyboard with 3 modes between which can be switched by pressing the ...
1
vote
1answer
61 views

Java OOP Mental Math Program

I am currently working on an object-oriented mental math program using Java Swing. Since I am relatively new to the object oriented principals of design, it'd be nice to know how well the code ...
3
votes
1answer
73 views

Object-Oriented JavaScript Chess game

I am currently creating a chess game in JavaScript, some aspects are yet to be done such as the computer player and turns, but before I get into writing these features I would like to know how to ...
5
votes
1answer
73 views

c# Factory Pattern Generic Exception Handler using dot net core

My task was to create exception handler on some system that has multiple types of database and big business behavior. At first, I had done a switch/case that handled the exceptions by type using the <...
8
votes
1answer
207 views

Improving Python TicTacToe code with good practice

I'm starting to improve my python skills by learning good code practices, as commenting the code, encapsulating object attributes, using typings, and so on... but I'm a newbie on all of this, as you ...
2
votes
1answer
42 views

Building a JavaScript GroupPicker class that is tightly coupled with HTML structure. Is this an anti-pattern?

I'm building a GroupPicker class that essentially manages an interface that allows the user to move items between two columns "assigned" vs "unassigned". The items ...
4
votes
1answer
88 views

Dungeon and Dragons Text Based Game

I've created a text based game based on D&D as part of exercise No.45 Learning Python the Hard Way v3.0 I've implemented a few features from the game: Character Selection, Fight Scene, Rolling. ...
3
votes
0answers
48 views

First Attempt at Object-Oriented Programming: Tic-Tac-Toe

Began learning python about 3 months ago and this was my first OOP. I was hoping to get constructive feedback! My own thoughts after writing it were that there had to be a better way to: 1) generate ...
1
vote
1answer
128 views

C# Simple Poker Game - Is a good Design?

I want to make a simple poker game. What I pay particular attention to is design: I look for suggestions to improve the quality of the design and also suggestions on possible improvements in style ...
5
votes
2answers
110 views

c# oop, is that correct?

I have kinda problem with oop in c#, I need to do a task to school but I completely new in oop. At this moment I have no idea how I can even start this, I mean I don't know how to make that program ...
0
votes
1answer
39 views

Functional vs Object Oriented Approach for UI codes

I have the following snippets. which formats error messages based on a map. I can do it as a simple function call the function for transforming the error. or create a class and handle it in that way. ...
3
votes
0answers
60 views

Source Control and Unit Tests

Context This post will be related to the code request I asked for, some time ago. I would like to focus this time not strictly on the implementation of the ...
2
votes
0answers
42 views

Immutable-Object-like Structure in PHP

I made a closure-based PHP structure that behaves mostly like a classical object. To change the object's state, one must derive a new copy by passing the altered state to the ...
1
vote
2answers
66 views

Class for User-defined Binary data type

I have written a program for a user-defined binary data type in JAVA. It has static methods for purposeful usage methods for binary arithmetic methods for bitwise operations It's ...
0
votes
1answer
46 views

Use of Factory pattern — how to implement it

I am trying to figure out how Factory pattern works. I implemented it with TypeScript in this github repo: https://github.com/emilecollin/factory_pattern Basically this is emulating spaceships gaming ...
15
votes
7answers
4k views

Java OOP Temperature Converter

I am doing a college exercise and would like to know how to improve the execution of the idea. The idea is to create a program that converts temperature measurements. Main.java ...
4
votes
2answers
86 views

Human Jug and Glass

I am a beginner in Java. I have created this small project in Java with the inheritance concept. Here the Human will fill, pour and drink water. There are three classes: Glass, Jug and Human. Let me ...
0
votes
0answers
27 views

Little Multilanguage site with modifiable words in a table.( Code improvement )

I have written a code for my little little website to make it multilanguage. It is a simple "developer" page where you can select from four different languages. Hungarian, English, Deutch and Roman. ...