Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

2
votes
2answers
194 views

PHP login/signup validation class

I am working on a blog with PHP, specially in order to practice OOP. Since the blogging system will handle users, i thought that a Validation class would be a good idea in order to not repeat code ...
2
votes
0answers
19 views

How to connect a propery class/object with a collection (its database class)?

I'm struggling with organizing my code regarding 'best practise'. In particular how I link a class with its collection class. I've 2 classes: ...
2
votes
0answers
42 views

Method for creating and traversing a BST while also getting its depth and width

This is a class for creating and traversing a BST while also getting its depth and width. I feel like this can be factored down into something more elegant and shorter I also feel like the overall ...
2
votes
2answers
204 views

Discrete Event Simulator

I'm an undergraduate student and I have this assignment on a Discrete Event simulator. Currently I have completed to the end of v1.2 here. Attached also, is an algorithmic overview. I have wrote my ...
2
votes
2answers
140 views

Java converter from Arabic to Roman Numerals

I am learning Java and would like to get feedback on the code I wrote. I have written an implementation of an algorithm (found here) for converting any decimal Arabic number to Roman numeral string. ...
2
votes
1answer
70 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 ...
-4
votes
1answer
38 views

Conditionally grab vehicle data depending on criteria specified as key-value pairs [closed]

Here is the case of ugly condition for the "if": ...
1
vote
0answers
275 views

Text-Based Adventure RPG with PyGame

I'm creating a text-based adventure game using PyGame. I plan on also implementing kind of a Pokemon/Final Fantasy style combat system that works with menus instead of commands, but I haven't started ...
3
votes
2answers
132 views

Replace a #define/template “Variable Wrapper” system with a pure template/OOP solution

I have an inherited code base that I am looking to improve. Below is a "variable wrapper" template class and #defines that i would like to replace with a template only solution, or redesign ...
-1
votes
1answer
194 views

Breaking up a simple Paint application into smaller classes

(Sorry this is a repeat post, I hadn't logged in on my initial question and am unable to respond) I currently have a working code for a simple paint application but it is all in one file and very ...
1
vote
0answers
50 views

Displaying a user profile based on a mock ORM

Overview We are learning PHP OOP and decided to create a simple app with 3 database tables, one a basic users table, the other two containing information about the users' favorite food and favorite ...
5
votes
1answer
145 views

Arabic language lesson program Part 2

This is the second time I am asking for a review of this code (first time can be found here: Arabic language lesson program). The goal of the program hasn't changed - to house Arabic language lessons ...
2
votes
1answer
118 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 ...
-1
votes
1answer
48 views

Building a 64 × 64 particle accelerator frame in Minecraft with a computercraft turtle

I dont think this will work anywhere besides in minecraft with computercraft but it's all correct syntax. I just feel like it has some lines of code I could eliminated somehow and made it a cleaner ...
4
votes
1answer
105 views

JWT Authentication Service

Recently I've built a service at my work to generate tokens with JWT (JSON Web Token) "protocol", I would like to show you the code and to get comments from you if that's good enough and if there are ...
-2
votes
1answer
31 views

Polymorphic string that describes each child class [closed]

I have a couple of chemical reactions. One of them is described as "If insulin is mixed with antibiotic, healthy people catch Fever". I think it would be useful for ...
2
votes
1answer
74 views

C++ object tracker

I created a utility class to keep track of all objects inheriting from it. My main motivation here was to have a clean solution to select which entities in a multiplayer game are synced with the ...
1
vote
0answers
32 views

Populating a CMS's database with some initial data

I have a simple content management system Spring-MVC web app made with spring boot. I have the following class called data loader that initially creates some objects and stores them in an H2 in-...
3
votes
1answer
81 views

Django post function : split method is a good way?

I'm working on my Django project and I'm trying to develop this one with 'Class Based View' (CBV) method in order to keep the code maintainable. I have a class ...
0
votes
1answer
83 views

Saving Reddit posts and comments from JSON into ArrayLists

I'm trying to get and save in an ArrayList Reddit posts and comments. The code is very similar for both: The RedditThing is a parent of RedditPost and RedditComment: ...
1
vote
1answer
55 views

PHP validation class for username, email, and password

I'm relatively new to PHP OOP, currently I'm practising how to use it, however I am not really certain I'm building my classes correctly, I think perhaps I'm missing something out but I'm not entirely ...
2
votes
1answer
51 views

Javascript class to geocode Dutch addresses

I am relatively new to javascript ES6, the code I've written is working fine. However I am curious if this would be the best approach. I am trying to write a reusable module that I can use in multiple ...
7
votes
0answers
41 views

Perl Script to import flat-file versioned files into git repositories

I wrote a perl script to import local files with "File-Ending-Versioning" (like file.1.12.pm) into a git repository. I tried to use the concept of roles in this script and I am not shure if I applied ...
9
votes
2answers
217 views

Area calculator for shapes as an OOP interview test

A while ago a tricky C++ interview question came across to me, and ever since I could not tell what I did wrong. Create a base class named “Shape” with a method to return the area of the shape. ...
3
votes
2answers
136 views

SpaceInvaders Second Iteration - Fully Functional - Next Up New Presenter Class

Going to take a look at Rasta's comment below tonight and just realized I am using byref to pass everything again - DUHOH - Old habits die hard I have revamped with some of Comintern's improvements ...
5
votes
1answer
121 views

OOP, one class from multiple database tables

This is an OOP question and probably answerable even if you don’t have PHP knowledge. (A side note – we are learning PHP OOP and decided to create a github to hopefully help others learn this and ...
4
votes
0answers
158 views

Python Class to represent a Pokemon

I have been programming with Python on-and-off for about 2 years now, even now I still find that when I look at other applications I struggle to follow along with their classes/objects. Please help me ...
7
votes
1answer
321 views

Space Invader Style Game Written In VBA

EDIT: Link to the github, https://github.com/Evanml2030/SpaceInvader/tree/master EDIT: SpaceInvaders Second Iteration - Fully Functional - Next Up New Presenter Class ^ a link to second iteration. ...
1
vote
1answer
45 views

Traversing the Parent-child relationship between objects: Part 2

This code builds on the code in the previous iteration. All of the following tests should work: ...
0
votes
2answers
65 views

ContactsList implementation in Java

I created a ContactsList class in Java that holds Person objects. I consider this is a side project for my GitHub profile. Any ...
4
votes
1answer
196 views

Simple Java Download Manager

I have written a simple download accelerator in java which downloads the same file in multiple threads and then combines them all. I would love some feedback on my design. How the same implementation ...
8
votes
2answers
184 views

Battleship UI: GameSheet

In the previous post I presented the MVC architecture, but all we saw of the View was the pretty bits. From the outside everything looks innocently pretty: The guts of the worksheet's code-behind is ...
-3
votes
1answer
75 views

Application for writing checks

I am writing an application which has lot of checks. Most of the logic is based on conditions. How can make such code comply with SOLID principles? I cannot give the code of my application here hence ...
2
votes
0answers
58 views

One class for MySQL and MSSQL Queries

EDIT BELOW I am trying to create resusable classes for MSSQL and MySQL queries (later also Update and Delete queries). I tried it doing the OOP-way. Here is my result: Einstellungen.vb: ...
5
votes
0answers
186 views

Battleship MVC Architecture

The entry point is the Macros module, which - for now - includes only a single procedure, at a very high abstraction level - I'm quite happy with this: ...
2
votes
1answer
54 views

Simple Duration calculator using es6 class syntax

I've written a simple script that calculates the distance between two points in time and returns the duration. Example: Start - 11:00, End - 11:45, Duration - 0.75 I wanted to make use of ES6 ...
-1
votes
2answers
222 views

Get count of credit cards that are expired [closed]

Below is a sample implementation for getting the expired credit cards in the credit card list.I wrote a property and initialized it in the constructor. Need an opinion on if this is a proper way to ...
3
votes
2answers
442 views

Console Snake Game in C++ with Classes

I would appreciate some criticsm on my code so that I could improve it. I tried making the Snake game in OOP but don't think I did it right. Any suggestions would be appreciated. The code is is ...
3
votes
1answer
59 views

Dividing an arbitrary dollar amount into the fewest bills and coins

I am taking a class in mobile application development this fall. I have finished my first assignment of creating a class to divide an arbitrary dollar amount into the minimum number of bills and coins....
4
votes
1answer
237 views

A tax calculator application to calculate tax and print final receipt

Although this question has been asked a lot of times, I was hoping for a feedback on my approach. Tax Calculator Basic sales tax is applicable at a rate of 10% on all goods, except books, food, ...
2
votes
1answer
49 views

PHP RSS/XML reader basic class

I write this class to process and output xml/rss feeds. I'm still working on, but any suggestion will be appreciated. As a little trick if the xml file come from an online resource, I've added a ...
3
votes
0answers
169 views

OOP Othello in Python with tkinter UI and basic AI

I wrote an Othello version with limited UI to try to learn python(3.7) and OOP. The game has 8 classes. Start creates a controller object which is responsible for the logical flow of the game. ...
8
votes
3answers
340 views

Processing player's move in an ASCII rogue-like game

I'm making an ASCII roguelike game and while writing the code for processing the player's move I can't decide between these two options. I have defined a class named ...
1
vote
0answers
64 views

Nested class hierarchy for scientific instruments

i am currently developing an application to use with Measurement or Generation Instruments like Power Meters, Functiongenerators and so on. As this is my very first Programming Project in General, I ...
1
vote
1answer
273 views

ChangeCalculator for calculating money denominations in change

I'm doing some exercises in OOP and I just created a program that calculates amounts of denominations in a change at the shop. So, let's say something costs 10, I give 25.30 (for some reason), so I ...
4
votes
0answers
97 views

Data processing program

I'm working on part of a service for data processing. The main idea of the service is to get the input data, process it and return the processed data to another service. Input and output data format ...
1
vote
2answers
438 views

Calculate various shapes Area and Perimeter

I am writing Python program which calculates area and perimeter of various 2d shapes. I am trying to learn about OOP and this is the first project which I wrote from scratch. I'm wondering how to let ...
1
vote
1answer
488 views

Buidling classes with user input and calling methods

Learned alot in this first week, following PCC, but biggest leaps came from the community and others giving their time to help, thank you! All input appreciated! ObjectiveGoals were to fill a class ...
8
votes
1answer
156 views

Solution for Parent/Child circular references: WeakReference class

Sometimes in advanced OOP scenarios, a class needs to hold instances of another class which needs to hold a reference to the "parent". For example when you have a dynamic ...
0
votes
1answer
37 views

PHP simple template loader

This is not really a question but I'd like to obtain some opinions about this simple class. For an old project I had the necessity to load some php template files that includes some ...