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

Model tornaments between teams

In one of my projects I wrote a little tournament platform, but the way I handle participants is a bit messy and I want to clean this up. So in my case a Tournament can have participants, but either ...
1
vote
0answers
22 views

Design to separate client API from internal API in Kotlin for a chess engine

This is a follow-up from my previous review on this site. To be clear, the code is stand-alone, and does not depend on the previous review. As before my goal is to come up with a design for a chess ...
0
votes
0answers
26 views

Design of a turn based, dice game [closed]

I'm trying to build a irc-bot that serves as a manager of a multiplayer, turn based, dice rolling game. The bot is listening to all messages on the channel. When the logins it build a ...
2
votes
1answer
41 views

Iterator-Pattern for an iterator that returns one objects that changes

I wrote an algorithm that returns all k-sized subgraphs of another given graph. Because I don't want to make the runtime of the next() call of the iterator depended on k, I don't want to return a new ...
-6
votes
0answers
31 views

hello world!!!- ANY WAY TO OPTIMIZE GIVEN CODE [closed]

`print('hello world') print('hllo word') print('helo Wrld') print('hell orld') print('helloworld')` OPTIMIZE THE GIVEN PROGRAM
0
votes
2answers
122 views

What's wrong with this design in C++?

So I wrote this a while ago and yesterday I was going through it and trying to remember every line of code and how it works. Well, the program simulates a online bank account as well as an ATM. You ...
1
vote
1answer
62 views

Initializing more than one instance object at a time in init method

I have a RadioStation class file and a view controller where I create two station objects based on this class, one for FM and one for AM. I created both of these ...
4
votes
2answers
94 views

What changes should I implement in my templated sorter class so that it performs efficiently?

I have a college assignment to implement a class called sorter, whose object is a sorted vector (the user is allowed to sort it by the method he/she desires). I have been able to implement it as ...
4
votes
1answer
56 views

Testing Terminal Text Game with Classes and Game Loop

I am making a super simple and dumb terminal text game to try out unittest in python. I have ran into a problem. When I run the test, the game loop is ran, and I have to manually insert input to ...
8
votes
3answers
832 views

Refactoring multiple boolean conditions?

I have a Predicate which takes employee object. Predicate<Employee> getPredicate() { return emp -> filter(emp); } Now the filter method is very ...
-2
votes
0answers
22 views

I wanna know if my code is a correct way of OOP Php while using jquery

Now my question is this a correct way to code if i want to use OOP and also jquery to call functions i have 2 files the client side which has a ajax call to get data AddTicket,php ...
2
votes
1answer
73 views

simple implementation of List in c#

...
8
votes
2answers
175 views

Tron game on Wii / GameCube

I implemented the following Tron cycle game so that it can be run on GameCube / Wii devices (quarantine...). Indeed, there exist many tools (I rely on devkitPPC) and I thought a Tron game would be an ...
4
votes
2answers
91 views

Polynomial Class in C++

This was one of my friends' Java OOP class assignments. They were tasked with writing a polynomial class in Java with multiplication functionality. I did it in C++ as a challenge and for improving my ...
4
votes
1answer
63 views

Simple Console Snake Game

I have created a Snake console game using object-orientated programming methods. This is the first time I have ever used OOP so I just wanted to know if I was using the method correctly as well as ...
2
votes
0answers
30 views

router system like laravel, how to manage routes creation and router handler?

i'm trying to create a url router system, for educational purposes, that has a similar usage like Laravel has, but i'm curious about how i can register the routes like laravel does (with single calls ...
9
votes
3answers
1k views

Secrets management, operational security, keeping API tokens hidden while streaming

I've taken up code streaming and I'm concerned that as I do so, I'll leak an API token somewhere. It was suggested that I use something like "a secrets.toml or secrets.yaml or secrets.json file." But ...
5
votes
4answers
292 views

Section 2: Classes - Design a StackOverflow Post

Design a class called Post. This class models a StackOverflow post. It should have properties for title, description and the date/time it was created. We should be able to up-vote or down-vote a ...
1
vote
0answers
29 views

**Refactored** Library project

My Solution What I am looking for: DRY Code - in my handleDeleteBook and handleToggleStatus methods I felt that I couldn't find a way to share the id between the methods. Furthermore, what other ...
3
votes
3answers
125 views

Stopwatch class without using System.Diagnostics in C#

Design a class called Stopwatch. The job of this class is to simulate a stopwatch. It should provide two methods: Start and Stop. We call the start method first, and the stop method next. Then we ...
11
votes
3answers
1k views

Implementing a rectangle class

First I've to indicate that this is my homework. An example of a given input is: s1 = {'p1': (x1, y1), 'p2': (x2, y2)} where all names and coordinations are ...
4
votes
1answer
37 views

Python disk caching with index

My task is that of caching. If the folder exists then load the cache from disk, if it doesnt create new cache. This is trivial, what bothers me is if I want to create third mode of noop (don't do ...
2
votes
0answers
63 views

implementation of a mvc url router with low coupling and solid principles

i'm building an url router and i want to improve it to respect SOLID principles, i want suggestions of how can i make it less coupled. here's my current code: Router.php ...
3
votes
1answer
47 views

Python sudoku solver with classes

I just coded an object-oriented Sudoku solver, but I don't have any possibility to check whether I have written good code, so I thought I would just post it here for review. I have looked for other ...
3
votes
3answers
117 views

Make it SOLID: simple simulation of animals eating other animals (improved)

This is an improvement on the code presented here I was given the exercise of refactoring some code that was breaking the Open-Closed Principle in a SOLID design, ensuring that the new code would ...
1
vote
1answer
45 views

Trying to write an equals method for a class containing array of objects [closed]

Im trying to write a College class equals method that compare the content of the arrays of the two objects of college class. So The method will compare the Student[] array in college object to other ...
1
vote
1answer
25 views

Class ISBN - checks for valid ISBN 13

I am at the moment trying to grasp multi-file programming instead of one big main.cpp. The class I wrote is about ISBN 13. Can you point out what could be done to improve my code? Also is there a ...
4
votes
2answers
141 views

Simple simulation of animals eating other animals

I was given the exercise of refactoring the following code, thus ensuring it was following the SOLID design principles. It refers to an Animal Park, where there are a couple of different species of ...
3
votes
1answer
43 views

Handle HTTP and BLE requests

Im implementing and designing a workflow that performs both HTTP and BLE requests. Im having trouble figuring out the best approach to design a service to handle both types of requests, and manage ...
2
votes
1answer
45 views

Class to encapsulate an XML document

I have a set of XML documents that have a rather long list of tags and corresponding values that I am interested in. For simplicity, I decided to create a class that would let me get an object with ...
2
votes
0answers
104 views

Enum in PowerShell Class

I am playing with learning PowerShell classes, and I have a validation situation that kind of lends itself to Enums, as shown in the first example. With Enum ...
8
votes
1answer
109 views

A Python based Tic-Tac-Toe game

As a basic project, I've programmed the game of noughts and crosses (tic-tac-toe) using classes. I made three classes: Board, ...
9
votes
3answers
763 views

Subclass instance recorder in Java

I've written a relatively small abstract class in Java which keeps track of all instances of it's sublasses. Any class which extends this abstract class will automatically have all its instances ...
6
votes
2answers
81 views

Python Blackjack, need OOP advice

I'm still learning Python and especially Object Oriented Programming. The latter, though, seems to confuse me a lot: defining class object attributes vs instance attributes, passing arguments, using ...
3
votes
1answer
104 views

Array manipulation object

I'm trying to write a class that simplifies the most common operations with arrays and then I want to distribute... Maybe it can help someone... But I'm facing some problems in make the object ...
9
votes
3answers
848 views

Master Mind implementation

I have created a Master Mind BoardSolver. To apply the BoardSolver I have created an app (...
6
votes
1answer
98 views
8
votes
2answers
860 views

O.O. Teacher List

After the feedback I got on my previous question, I decided to try one more program to see if I understand O.O.P. The idea for this is also based off the project I am working on im my class for this ...
6
votes
2answers
502 views

Chaining Internal Class Methods in Python

I'm learning object-oriented programming in Python. I've created a class RepositoryMaker that contains all methods required to create a Git repository. The idea is ...
0
votes
0answers
62 views

OOP approach to filter two-dimensional array

So, after this functional(?) approach and thanks to the great improvement of @CDP1802, I've decided to try an OOP approach to filtering an two-dimensional array. In my opinion, the result is way more ...
3
votes
3answers
122 views

An in memory Url Shortener in Java

This is a popular question in machine coding rounds. The requirements are to build a URL shortener. There are certain registered users who have the capability to define a URL and an optional time to ...
4
votes
1answer
186 views

Utility for Python date ranges

I'm trying to write something that can take a description and a date range and return all the dates that satisfy that description. Descriptions can be anything from the following... ...
11
votes
5answers
1k views

Generic Heap Implementation in C#

This has been done a thousand times on here already, but here's another binary heap implementation. The implementation is generic in terms of heap elements, allows for injection of any type of ...
4
votes
1answer
101 views

O.O. Style Palindrome Checker

I am beginning to learn about object oriented programming in my programming class, and to make sure I had all the ideas down, I made a small palindrome checker program. It works by checking if the ...
5
votes
3answers
430 views

Template Matrix Class: implemented some basic functionalities

Basically I have written a matrix class for addition, multiplication and scalar multiplication. I need your review of the class implementation below in terms of efficiency, memory consumption and new ...
2
votes
0answers
44 views

Simple employee GUI database sync/display/edit

This is a simple GUI to display employee data stored in the database, with editing options that sync with the database and adjust display according to mouse clicks/ keyboard scrolling/add/delete ... ...
3
votes
1answer
55 views

Configuring NavigationService and NavigationView in one place

Context The main goal located a configuration NavigationService and NavigationView in one place. In order to minimalization a ...
3
votes
2answers
109 views

Simple Binary Search Tree Class with Insert and Search Functions

I am trying to learn to implement DSs in C++ and here is a simple implementation. Please review in terms of optimization, memory management, coding standards, etc ...
3
votes
1answer
70 views

Discount card reduction calculator

I have started programming a couple of months ago and have recently applied for an internship. One of the assignments was to create a console application, the assignment can be seen here - > HERE My ...

1
2 3 4 5
70