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
16 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
21 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
12 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
17 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-...
2
votes
1answer
34 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
2answers
56 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 ...
1
vote
1answer
38 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. ...
-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 ...
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 <...
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 ...
3
votes
1answer
40 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 ...
1
vote
1answer
69 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
42 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 ...
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
106 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
64 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 ...
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 ...
4
votes
2answers
91 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 ...
3
votes
0answers
29 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: ...
6
votes
2answers
211 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 ...
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 ...
-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 ...
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 ...
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 ...
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. ...
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 ...
-3
votes
0answers
51 views

Ranking in javascript

Could someone test my code and tell me if it worked. If you can help me with suggestions or bugs. This code has a class called Rank. Its properties are: ...
15
votes
2answers
2k views

Message-formatting code with pluralization, revised to be more functional

I'm a C++ dev, and I've recently started working my way through Clean Code*. Whenever I encounter an example I think I could improve, I try to re-implement it in C++. On pp. 28-29 there is an example ...
4
votes
1answer
92 views

Page-by model of data output and search results with values for UI

This is my first experience of designing classes with inheritance. I would like to get feedback on the interaction between the presented classes. It is unlikely that this code will seem complicated. ...
6
votes
1answer
170 views

OOP Python Blackjack game with player accounts in PostgreSQL

This is an OOP version of Lastest version of my Blackjack game. Also, it now uses PostgreSQL as database. ...
3
votes
1answer
161 views

Object-oriented calculator

I have solved an assignment (Exercise 3) from the MOOC Object-Oriented programming with Java, part II, but I'm not enrolled in said course. Assignment Summary: Make a simple calculator. You ...
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, ...
-1
votes
1answer
70 views

Class Inheritance in C# (possibly generics) [closed]

I'm working on a segment of code where it runs a number of tasks and then combine individual task results to construct a complete task result object, there's no concurrency involved so it's purely a ...
1
vote
0answers
56 views

Managing millions of objects in a MMO game server [closed]

A litle context: This game server is coded entirely on C-with-classes (plain C code using basic C++ features like classes, templates and such, to avoid any possible overhead). At startup the server ...
1
vote
0answers
50 views

Making text based Blackjack game in Java. Can't figure out how to deal with Ace(1/11) and Splitting [closed]

I've been learning java for about a year in University and decided to start this Blackjack game which I can hopefully animate into a full app in the future, although I'm still working on the ...
2
votes
1answer
26 views

Find cycles in Graph using Union Find Algorithm on Adjacency List

My code detects if a cycle is present in a graph using Union find algorithm with Weighted tree analysis and path compression. It works and I have included test cases. ...
7
votes
1answer
92 views

Function to send email, refactored based on SOLID principles

I have the below method that is responsible for generating and sending a MailMessage using a SmtpClient object: ...
0
votes
1answer
30 views

Upload image with GD library

First of all I just started learning OOP. My priority is to make safe code. I think my code is safe, because I use GD to make a copy of the uploaded image and I use an image proxy to make sure nobody ...
4
votes
1answer
185 views

Console-based BlackJack in C# - Follow-Up

I have done some code-refactoring of my console-based BlackJack in C#. Finally found a better solution to solve Ace problems (double Aces should be value 22 and third Ace should be value 1). I still ...
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 ...
2
votes
1answer
59 views

Table class to fill array structure with values

The code creates a table and adds rows and columns. Does it make sense to write the code like this? Would you design it differently? Is there a better OOP approach to this? ...
2
votes
2answers
127 views

Tetris game for Windows improved version

About a month ago I made a Tetris game for Windows. After a helpful review, I improved the code. I want to hear again an opinion about the implementation, how readable the code is, new mistakes or ...
8
votes
1answer
91 views

Geektrust: Solve War problem in a OO way in Python

I solved this programming challenge whose objective is to come up with an OO solution to the problem. The problem statement is quite verbose and the tl;dr version would be: Given an enemy army(...
1
vote
0answers
108 views

Initializing a Node JS Express Application with OOP [closed]

Overview I am attempting to learn Node JS with Express by creating a project. I have seen many examples of setting up an express.js application with functional based programming, like so: ...