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
1answer
106 views

Unit tests for User class with JUnit 5

This is a follow-up question for Android app class serialization. Some problems have been mentioned in forsvarir's answer. Then, I am following JUnit 5 User Guide to redesign the test cases for ...
3
votes
1answer
102 views

New in PHP OOP and need opinion am I doing it the right way

I am new to using PHP OOP and decided to start learning by converting something I wrote in procedural PHP. So now I need your opinion and recommendations for my first work. One of the main reasons I ...
1
vote
2answers
106 views

checking is ellipse is filled or not

following code below works fine but feels kind of a mess. Any one has a better way to do this? I am creating a basic "Enter Pin" to unclick screen on an app. So if the user enters the 1st ...
2
votes
1answer
64 views

Android app class serialization

I am attempting to build an Android APP with the custom serializable class User. The public method Save is to save class ...
1
vote
1answer
139 views

C# Coffee Machine

I saw this post and tried to do my attempt. This is the requirement of task: Design a coffee machine which makes different beverages based on set ingredients. The initialization of the recipes for ...
0
votes
1answer
84 views

Robot OOP Class in Python

Hello everyone! Here is the thing. So I wanted at first to create Robot class, I want him to move around some board. Maybe 10x10 or something like that, then i wanted to invent a Robot fights class, I ...
1
vote
2answers
71 views

How can I optimize this Binary Search Tree?

I've added some methods to a basic BST implementation for integers - if anyone can point out some ways that this could be written in a more efficient or clean manner, please let me know. ...
4
votes
2answers
506 views

Should i throw exceptions in the service layer or repository, and catch it on the controller? [closed]

I read some answers here on stack exchange, but none really "hits the nail on the head" about where to throw exceptions, where I shouldn't and where to catch them. the idea that an exception ...
0
votes
1answer
100 views

OOP ATM Implementation

I have tried to embody some basic ATM operations in a Object Oriented manner for practice. Would love some review pointers from structure, Object Oriented principles point of view. Also what should be ...
2
votes
4answers
1k views

Return correct subclass instance, identified by string

I have made a function which takes a string which can be any of "triangle", "square" or ...
2
votes
2answers
107 views

Parking places design

I got a question: Design a parking system. There are 3 types of parking spaces: big, medium and small. Implement ParkingSystem class(int big, int medium, int small)....
0
votes
0answers
123 views

Python Classes for Robot Test Framework which Open Paramiko SSH Connections and Run Commands

Background I am writing a custom library whose keywords can be used with Robot Framework to verify configuration files, check running processes, and eventually other things tailored to a project I ...
2
votes
1answer
72 views

Implement a range behaviour in Python using iterators

I've been assigned the following Python homework: Implement myrange that acts like range using iterators. Define a function ...
3
votes
3answers
94 views

Creating a class and calling it from other .py files

My objective with this code was to create a class and call it from other .py files. The code itself is working, but I would like to know what could be improved or be better implemented. I wrote ...
0
votes
1answer
174 views

Chess in Kotlin

This is an updated version of my first question: Chess game in Kotlin I wrote the following Chess logic in Kotlin and am looking for feedback to make the code cleaner and follow good software design ...
6
votes
2answers
2k views

Income tax rate calculator in c++

I have been trying to learn c++ for the sake of being comfortable with a second language. I found a project that seemed relatively easy, although it may not be implemented perfectly, it was a simple ...
5
votes
1answer
115 views

Copy Columns Forward Macro: From Procedural to OOP

Background: I had created a macro few years ago and when I was reviewing this now, it was hard to understand. I recently went through all the articles from ...
3
votes
2answers
186 views

Tic-tac-toe in python with OOP

I'm a beginner to intermediate in programming, and created a Tic-tac-toe game in python. I plan to add an AI player and a GUI using pygame. Any improvements I could make to the code, especially with ...
1
vote
1answer
138 views

Chess game in Kotlin

I wrote the following Chess logic in Kotlin and am looking for feedback to make the code cleaner and follow good software design principles. I tried to adhere to object-oriented design. Some notes: • ...
1
vote
1answer
45 views

Asking for player name and age using OOP

I have a text adventure game and I need to use OOP so I've chosen to use it when getting the player's name and age. I need to keep the OOP; but was wondering if there are any ways to clean up the code ...
6
votes
2answers
286 views

Usage of Factory pattern for maintaing bookshelf having books, magazine and notes

I have tried to achieve the following task using Factory Pattern with php-7.0. Define the classes and their methods (including parameters and return types) for a system that consist of a bookshelf, ...
0
votes
0answers
70 views

Python - Pagination class

I built a small flask app and a lot of routes do need some kind of pagination system. However, in some cases I would like to just display n-2, n-1, n, n+1, n+2 ...
2
votes
1answer
105 views

JavaScript copy-to-clipboard class

I am have made a small copy-to-clipboard script. I have made a method called copyToClipboard that does the following: create an input box; read the content of an ...
0
votes
0answers
25 views

Filtering methods for 3 collections

I'll start by saying that I just started learning Go coming from Python (and some basic on Java), so I am trying to understand how to write Go code in more idiomatic way and not in a Python way. Any ...
2
votes
2answers
40 views

Combine data from array of objects

I got this data structure and I am checking to see which properties are true, then I am adding the key for all the properties that are true to that object on a new ...
2
votes
1answer
102 views

Stack Exchange Marathon Bot – Part 1: Bot structure

This code review is for my Stack Exchange Marathon Bot project, a Telegram bot for playing a dumb little game involving the Stack Exchange network. Since the codebase is not that small, in this post I ...
3
votes
1answer
102 views

Snake game built from scratch

I have decided to make snake game as my first project with C++ (using OOP) and I didn't follow any tutorial while doing it, now I am frustrated and need to know if it the code is good or not and what ...
1
vote
1answer
38 views

text-messaging app using twilio

I build a small web-app using flask for my parents to text their customers about promotions. I am using Twilio API. I just finished the myapp.com/new-campaign page ...
1
vote
0answers
187 views

DataGridView Undo/Redo Manager in C#

While answering this code review question, I proposed a solution with List<DataTable>. I am trying to encapsulate this data structure into a "...
2
votes
1answer
85 views

C Macro based OOP

I come from an OOP background, and have recently delved into C and embedded systems. As an exercise I wanted to see if I could wrap some OOP concepts into a macro header. It works as I intended, is ...
9
votes
2answers
203 views

Python PacMan with son

I have been coding 'Pac-Man' with my 16yo. A hopefully not too boring project to help improve his Python coding. We have just moved the 'Ghosts' into a class which was a good first introduction to ...
2
votes
2answers
74 views

OOP refactoring technique

I'm teaching myself Object Oriented Programming in JavaScript and I'm looking over this small P5 code of CodingTrain's No.78, which deals with flying particles in the canvas, as a material. The full ...
1
vote
1answer
43 views

JavaScript: Text Processor

I been trying to implement a text processor in JavaScript that can handle 4 different types of operations: append, backspace, undo, redo. The input for this text processor is an array of arraries of a ...
0
votes
0answers
32 views

Implementation in Azure Blob Function Trigger for Insert into Database

I have created Azure Blob Trigger function. If file is inserted in Azure Blob Container at that time this function is trigger and based on that file data we need to insert into our database table. My ...
0
votes
0answers
34 views

Enumerating all fixed-length paths from a vertex in a graph

Enumerating all fixed-length paths from a vertex in a graph 1. Graph-related classes Base implementations of the relevant classes in my graph library. I'm using C#9 in a .NET 5 project. I opted to use ...
2
votes
1answer
98 views

Python: separation of concern User Model and User DB

I am working on a small side-project since a couple of weeks, I am using Flask but trying to use as few libraries as possible and no ORMs (for learning purposes. I am currently working on the User ...
5
votes
1answer
98 views

Python OOP code for identifying knees in data

Context (optional) In my job, we are interested in identifying particular events that may occur during the degradation of a physical system over its lifetime. Specifically, these are referred to as: ...
1
vote
0answers
58 views

Improving php code with OOP paradigms

I'm not that advanced in PHP or OOP concept so I'm facing some issues. I'm working on a project where it's using AltoRouter to call the functions based on the route....
0
votes
2answers
99 views

Factory / Builder Design Pattern in Python

Situation: I have implemented a factory design pattern in Python as below. There are different screens which have different configurations. One can register the screen in the factory and get the ...
-1
votes
1answer
48 views

Can A String array be passed as a parameter to a method that takes object array as argument? [closed]

Why after declaring a variable for String array, it can be passed to a method that accepts object array? Now, String is a class by itself so I assumed a long time ...
3
votes
1answer
95 views

game in oop mini game

So I am trying to create a small C# application which generates a deck of cards, and ask to the user if they want to shuffle the deck, and then display 1 card at a time to the user. Would this be ...
3
votes
2answers
93 views

Alarm clock subclass of a clock

I have these two classes and they should remain separate classes, but I have a feeling that this could be implemented more efficiently and with less duplicate code. After googling around I still didn'...
0
votes
0answers
117 views

Flask blueprints and context_processor - Best approch?

I am working on a Flask application (side-project) to send text-messages to customers using Twilio. There is two different list of customers, 1 for testing and for ...
4
votes
2answers
104 views

Javascript Object Oriented Planner App

I am creating a planner/scheduling app using objects. I am just a beginner with object oriented programming, so any tips on how to better structure my classes would be very helpful. Program Basics ...
4
votes
1answer
72 views

Improving Mancala Game

https://www.mastersofgames.com/rules/mancala-rules.htm I am trying to create a working Mancala Game in scala, Currently, I have 3 classes, Board, ...
2
votes
0answers
79 views

Design a parking lot [closed]

I have tried to design the parking lot problem. Here is the problem statement. Design a parking lot with multiple floors where customers can park their cars. Each parking floor will have many parking ...
1
vote
2answers
97 views

Recursively find data in array of objects

On this script I look up properties in an array of objects. There is an original array of strings list to get the objects that match the ...
3
votes
2answers
302 views

Simple Snake Game With OOP in Mind

I am a beginner in C# and trying to learn how to program with OOP in mind. I am 100% that the code is not OOP-friendly at all, but the game is running and working, so if anyone could look throw the ...
0
votes
0answers
35 views

A Tester of Paragraph Merger for Removing Overlapped Duplicated Lines in C#

This is a follow-up question for A Paragraph Merger with Removing Overlapped Duplicated Lines in C#. I am trying to implement a tester for testing the implemented paragraph merger for removing ...
0
votes
1answer
86 views

My Updated dhondt (political voting system) method implementation in C#

I have took the advice on some people and improved my dhondt method calculator, which is a system that takes a file of data for a number of political parties and try to find which party to assign ...

1 2
3
4 5
74