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
3
votes
1answer
22 views

Filtering a list of customers in Java based on three criteria

Let's assume that you need to filter customers based on 3 criteria: name tags assigned to customer customer's location For some reasons you have to do it directly in your program code, without ...
3
votes
1answer
25 views

Java Networking Framework

So I've just written a framework that is supposed to make it easier to create a network-based application (client-server) using the native java.net package. I was wondering if the structure of my code ...
0
votes
0answers
20 views

PHP User class usability,maintainability,secure

I'm new in oop programming pattern. I created this simple User Class and i'm wondering if it : Is following oop rules and logic ? Is maintaibable ? Is can be tested without any problems ? Can be ...
-2
votes
0answers
18 views

How can I design a class layout that can elegantly be invoked statically and dynamically in PHP? [on hold]

I'm working on a small logger class, and want to try to improve my ability to wrangle mastery of PHP OOPs. The logger itself is uninteresting, but makes for an ideal illustration of the kind of top-...
3
votes
2answers
57 views

Banking application for Udemy Java course

I just "finished" a Udemy Java that involves building a banking application. Here is the problem definition: Scenario: You are a back-end developer and need to create an application to handle new ...
2
votes
1answer
37 views

A persistent file system operations queue using sqlite and JSON text fields

I want to implement a persistent queue for file system operations (copy, delete, move) that needs to be process and thread safe. The module will be used by a daemon (called ...
3
votes
1answer
166 views

Java console banking

So I wanted to write a basic console based banking app to practice my skills. It makes use of BigDecimal to ensure accuracy. Here is the MVP I plan to enhance it with all banking features soon. I ...
5
votes
2answers
93 views

Custom serialiser with object factory

A couple of years ago I wrote a serialisation library for my project. By the time it worked well, but recently I thought it could be modernised. Back then I needed something that looks similar to ...
0
votes
1answer
2k views

Java MongoDB client as a singleton

Is below code a valid Singleton design pattern for Mongodb in Java? Please suggest any improvements. ...
2
votes
1answer
585 views

Simple Java OOP calculator with GUI

I'm learning Java and I've tried to write my own calculator with GUi based on this post. Here is the repo: https://github.com/MurDaD/java-calculator Could someone check my code and tell me how to ...
1
vote
1answer
39 views

Dijkstra's implementation in c++ with STL priority_queue

This is dijkstras shortest path algorithm implementation in c++ using priority_queue STL. Looking for two things: a) Correctness of algorithm itself and b) Any improvement suggestions. ...
3
votes
2answers
467 views

Open/Closed Principle with calculating the total cost of items in a shopping cart

I came across the below example in a tutorial for the open-closed OOP principle. This example demonstrates function of calculating the total cost of items in a shopping cart. I have provided code for ...
-4
votes
1answer
41 views

Using sufix to describe the kind object is that [on hold]

I don't like sufix, I prefer to use business name or action name i.e. CustomerDetail instead of CustomerModel, ...
7
votes
2answers
85 views

Wordsearch solver

The code below shows my take at creating a wordsearch puzzle solver, where the wordearch is embedded into a .txt file that is parsed and fit into a ...
0
votes
2answers
84 views

A java program that gets a key-value pairs from a textfile, which should also print in a matrix/table like [on hold]

I just want to get some advice about code optimization. How can I make this more OOP? How many class should I have for this kind of task? My code already works but I was told to use OOP in a way that ...
3
votes
1answer
132 views

Initializing a controller that uses Selenium

I've outsourced the setup functions from my class to another file, I outsourced initDriver from the class PortalController to ...
2
votes
2answers
170 views

Spring service for playing Rock Paper Scissors

I had created a service which does the actual play of Rock Paper Scissors. Below is the service which takes a PlayRequest and updates the State of Player objects given by the PlayerService. So the ...
6
votes
1answer
144 views

Python class for organizing images for machine learning

I built a class to help me handle image data to use in machine learning. I thought that there would be a pre-existing package that did what I wanted but I couldn't find it so I wrote this. I am not ...
3
votes
1answer
2k views

Custom ResponseModel for Spring Controller - ResponseEntity<?>

I created a custom responseModel to have a standard json responseModel for some of my different RestController. Superclass TransactionResponseModel: ...
3
votes
1answer
88 views

JAVA Shopping Cart Design

Recently, I have appeared for coding exercise to design the Shopping Cart which should have following features: handles barcoded (like Chips) and non-barcoded item (like Banana 400gm) Can add item, ...
3
votes
2answers
114 views

Implement The Singleton Pattern for Persistency managers Swift [closed]

I am creating an iOS app and I want to implement Singleton Pattern. I have created "Singleton" LibraryAPI to act as an entry point UserManager object to get data from web API. after that I used a ...
1
vote
1answer
70 views

Constructor function for persons with hobbies

I'm trying to write a constructor function that generates instances of a user. One of the properties of the user class is an array of the user's hobbies. I'd like ...
3
votes
1answer
1k views

Laravel controller for a commenting system

Can someone review my Controller? I should follow these guidelines: Code should be written with MVC pattern and to use OOP. The code now works fine, but I need to improve it. Also, should I use ...
1
vote
0answers
51 views

Work around for querying type of derived class

I have an application where messages are collected and dispatched to various handlers. Messages are derived from the base class MessageBase, handlers derived from <...
5
votes
3answers
144 views

Collect reporting data for each possible combination of filter properties

Basically I'm looking for a way to improve my code, and avoid making a lot of if statements and parameter combination manually, 'cause I need to return a query result depending in the parameters that ...
3
votes
1answer
41 views

Continuous Range class

I was surprised to find that there doesn't seem to be a good "continuous range from start to end" data structure in python. I ...
2
votes
0answers
27 views

A Simple Connect 4 game in Python

I have made a simple command line version of connect 4. It is my first time using classes and importing one part of my project into another so any feedback on how I've done and any way it could be ...
5
votes
2answers
3k views

Recording all instances of a class - Python

In a programme that I am writing, I need to loop through all the instances of a class, the way I got around this was by appending every class to a list like below: ...
5
votes
1answer
2k views

First attempt at a Java Roulette Game

I was looking at since it was my first multi-class program, is there anything I could have done better, via making it shorter and other things as it's very long, and I'm not sure it's efficient enough ...
3
votes
1answer
43 views

A Basic Hash Map in Python

A hash map is a data structure that implements an associative array abstract data type using keys and values and has a hash function to compute an index into an array, from which the desired value can ...
3
votes
0answers
16 views

Automated machine learning training and evaluation in Sagemaker with XGBoost

This code aims to make very easy to train new models in SageMaker and quickly decide whether a new feature should be introduced in our model or not, getting metrics (recall, accuracy and so on) for a ...
4
votes
2answers
92 views

Parking Lot Object Oriented Design Python

I own a parking lot that can hold up to 'n' cars at any given point in time. Each slot is given a number starting at 1 increasing with increasing distance from the entry point in steps of one. I want ...
1
vote
2answers
132 views

Is it normal to have a base type for Entities and Value Objects?

Please see the code below, which I am currently using in a production application. : ...
7
votes
2answers
77 views

Document classfier

Description: I am working on a classifier which categorizes the text based on some criteria, at present, it is a map of category and list of words if any of the words appear in the text, a category ...
3
votes
1answer
107 views

Snake Game in C++ with OOP need advice

I wrote a Snake Game in C++ and I have practiced some OOP approaches on windows 7. What I need: advice how to improve code Most important how to made what Snake on ...
0
votes
1answer
65 views

Text-based Tetris game in C++

I am learning C++ and I've written a text-based classic Tetris game using OOP design. I would really appreciate it if someone could take a look at it and review the OOP design and tell me if something ...
3
votes
1answer
41 views

CLI Menu library

I started writing a small CLI menu library in python. I'm uncertain of the structure and scalability of the current code. For example the Menu.choice method would ...
4
votes
2answers
70 views

Ruby price calculator for groceries

I am good at logic and most of the time I write working code. But I want to learn writing code which follows best practices and is very efficient. I tried to implement some of them in my code but it ...
6
votes
2answers
212 views

Object Oriented Ascii dungeon game

I have solved an assignment (Exercise 33) from the MOOC Object-Oriented programming with Java, part II, but I'm not enrolled in said course. Assignment Summary In this exercise, you ...
1
vote
0answers
21 views

Using metaclass to decorate derived classes to be `attrs` classes

I am currently developing a framework to facilitate writing controller programs for scientific instruments. I use attrs extensively in the internal parts of the ...
2
votes
1answer
62 views

Temperature and currency converters in OOP JS

I just started learning OOP from Mosh on YouTube and I looked for easiest exercises to practice. Can I get a feedback on my code please? What I did wrong and what I should change? In the code there ...
4
votes
3answers
77 views

User management OOP php class

I found a class that i coded for an old project about a year ago and i haven't really touched php in a while. Now i need to use similar functionality again i thought it would be the perfect time to ...
3
votes
0answers
30 views

Adapter pattern to support multiple file storage systems

I am just getting in to following design patterns. I have create a class that allows for performing a couple operations on different remote storage systems: drive, dropbox, .etc (I call these ...
2
votes
1answer
39 views

Searching for matching shares

We're working on some code that involves validating certain UNC paths (specifically looking for things that appear to be subdirectories of other things), and we've gone back and forth on how to best ...
3
votes
0answers
57 views

Footwear scraper

I've done this parser to scrape all footwear data, but I don't know if it is good to use OOP in this case. Can you please check this out and give me the strongest feedback? I'm working on improving my ...
1
vote
1answer
28 views

Adding Length dimension to a Crate Object

Consider Crate::addLength() in the following code: ...
2
votes
2answers
55 views

N rotations of an array, either left or right, and then printing the result

Disclaimer, I'm new to OOP, but have experience in haskell and javascript. Essentially, the challenge was to create a program which would shift an array a given amount of times to the left and then ...
-2
votes
1answer
41 views

Simple First Come First Serve Scheduling Simulator [closed]

My goal is to write a CPU Scheduling Simulator in C++ using the STL features as far as possible. So far, I have only written the code for FCFS and have not provided any input method. What sticks out ...
8
votes
2answers
160 views

Two player snake game

I created a 2 player Snake game from my original one player version. I am looking for some feedback on how I made it. I think I could use improvement when handling input (...
1
vote
3answers
40 views

Collecting data into objects and POSTing to 3rd Party API

I have a semi-working project currently and am wondering if I am doing this the wrong way or if there is a more efficient way. I will try to be as general as possible as to keep the point concise. ...