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
17 views

Method name if class already contains a part of it [closed]

I have a class called ComputerGameService. In this class I've methods with following names: ...
4
votes
1answer
58 views

Banking system using polymorphism

I am asking this, because after studying I am confused that it is necessary to declare base class object, then declare derived class object and then store reference of derived class object in base ...
5
votes
2answers
238 views

Object oriented approach for snake game in C++

I started to code in c++ recently and my goal is to develop games using c++. After learning basics I tried to implement my own version of snake console based game in c++ with the help of some online ...
1
vote
0answers
35 views

A Tabbed calculator in python with tkinter

For learning purposes, I have written a small calculator app on Python, tkinter. I want to check if my design is on best practices for OOP, And seek advice on Nested functions For easy readability, I ...
-1
votes
1answer
69 views

Is performing IO in constructor good idea? [closed]

I have Java (or C#, Python, Kotlin, or other similar language) class that will be used to communicate with client over network. Protocol used by this application allows many different ways to create ...
1
vote
0answers
26 views

Connect 4 in TypeScript

This is my first TypeScript program, so I'm curious as to what conventions and optimisations I may have missed. Concerns: I'm not sure whether to check for 4 in a row in the entire board or to just ...
8
votes
2answers
736 views

C# threading and synchronizing methods

So I started this question, I believe i have synchronized the methods correctly, need some insight on whats wrong and what should be done. I have to modify ths class Purse so that the method AddCoin ...
1
vote
0answers
23 views

Ruby Tic-Tac-Toe two-player

As a preface, I'm very new to coding (self-learning) so if you notice any bad habits please let me know, it would be GREATLY appreciated. I'm self-learning Ruby so I don't really have a frame of ...
4
votes
0answers
43 views

JS Stopwatch - Is this a good way to implement the observer pattern?

I'm learning oop and also trying to learn and implement some design patterns. This question is a follow up of Stopwatch interface OOP (Vanilla JS) The app is available in https://nacho-p5.github.io/ ...
8
votes
4answers
261 views

Python text-based Tic Tac Toe

I created a simple text-based Tic Tac Toe game in Python using OOP. Currently the computer moves are completely random - I plan to add some sort of algorithm later (no idea how to do that yet though) ...
10
votes
2answers
104 views

Using Method Chaining To Alter Last Item Added To Collection

There is a Name class with properties that represent different components that make up a person's name. A Name object requires a FirstName and ...
4
votes
2answers
79 views

In-Memory FileSystem in Java - Is there a better OOP approach?

I have implemented an in-memory filesystem - this is a design question from LeetCode. Is there a better OOP approach to represent files and directories? The current code uses a boolean flag ...
3
votes
1answer
71 views

Parser for AEC in C++

Many people tell me that C++ is a significantly better language for writing compilers than JavaScript is. So, I've decided to rewrite the compiler for AEC (the programming language I've made) from ...
3
votes
1answer
53 views

creating own javascript join and push methods

I'm a newbie trying to write my own push() and join(). This isn't very serious, just an exercise. This is what I got so far <...
1
vote
0answers
26 views

Python 3 checking input attribute type and values? [closed]

I'm wondering what is the best way to check for input arguments for a defining a class attributes, and performing type checking and value checking. Currently, I'm assigning the attributes and then ...
1
vote
0answers
41 views

How To: Organizing Functions Into a Class [closed]

I have created code using only functions. The code I have created gets a users pizza order asking them for the size wanted, then their toppings wanted on that pizza. Returning the size cost then ...
7
votes
1answer
102 views

Chess application with GUI and AI in Java

I've included the files that I felt were relevant (i.e I haven't included the individual pieces in the inheritance hierarchy). I'm particularly curious as to whether the system as a whole is ...
4
votes
2answers
57 views

Online Reader System Object Oriented System

I have designed and Online Book Reader System as considering the previous reviews on this platform. You can find the classes below. I would be appreciated for the valuable reviews. Assumptions: "...
4
votes
1answer
71 views

Pizza Order System

I am new to coding/programming. About four months ago I decided to develop my skills using Python. After several books and a lot of assistance from this awesome community I developed the first part of ...
6
votes
1answer
81 views

Creating a Chart Worksheet from scratch with VBA / OOP Design

I recently posted some code for review, and am now looking to gather some feedback on my latest implementation with that code. Yes, I have fallen into the OOP rabbit hole (thanks Mathieu Guindon) and ...
2
votes
0answers
22 views

Maybe with a structural pattern matching interface

With a reference implementation for PEP 622 now available in a Jupyter playground, I decided to copy over my favourite feature of Rust in full to Python. Note: this won't be released until Python 3.10 ...
3
votes
1answer
92 views

Python REST API and Mongo - Aggregation Pipeline/Stage classes

This has been my approach for "simplifying" MongoDB aggregation queries in a pythonic syntax - was my intent, at the very least: ...
3
votes
1answer
40 views

Python's OOP for Calculating Growth of Money

I am making an OOP to calculate growth of money according to theory of interest. I have made 3 classes: Contribution which contain data of a deposit and its growth, ...
3
votes
0answers
58 views

File parser for csv and xls files

I made program for parsing CSV and XLS files, I just want to know if there is some space to improvement and is it all written good? My goal is when I got CSV or XLS file to parse that file and got ...
3
votes
1answer
48 views

Simple blackjack game using OOP

I've decided to learn python as my main language and after watching some tutorial on youtube I decided to write this blackjack game using OOP. Im sure it has a lot of beginner mistakes and might be ...
7
votes
3answers
117 views

Stopwatch interface OOP (Vanilla JS)

I'm learning OOP and the first exercise of the course was to made a Stopwatch class. I did it really fast and decided to make an interface for this little app. I created the interface. Basically I ...
1
vote
1answer
50 views

Google People PHP best practise to get OOP

I need to log in users to web app in Javascript and PHP. So I have Javascript interface which send me accessToken to PHP which stores users data to DB and log user in. But the result code does not ...
2
votes
1answer
74 views

Do I need to use inheritance and classes for my OOP webscraper? [closed]

I am currently writing python code that scrapes information from the web. I have to scrape several sites, but there a two types of procedures: Directly scrape from the website Download pdf and scrape ...
6
votes
1answer
58 views

Chemical reactor with UV light project in python

Introduction I'm new to python and made this code which computes the decay of sulphur dioxide (SO2) pollutant in a chemical reactor by ozone (O3) when it is hit by UV light. Code description Short ...
1
vote
0answers
39 views

Custom CssSelectorBuilder object in JavaScript

I've developed task solution following a learning program: ...
1
vote
1answer
56 views

Parallel image segmentation [closed]

Follow up question Image processing using Python OOP library I want to use multiprocessing to analyze several images in parallel: ...
5
votes
0answers
47 views

LeetCode 284: Peeking Iterator

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Given an Iterator class interface with methods: ...
1
vote
0answers
31 views

events countdown OOP app

I wrote a JavaScript app with allows the user to add events and get countdown for every event. Also the events and their dates are stored in localStorage. I want a general review and I think that ...
1
vote
0answers
58 views

Can I replace instanceof if I cannot use a common interface (third pary API)?

I'm using Telegram API and I've different methods wich returns different type of information like this: ...
3
votes
1answer
52 views

follow up: Blackjack with card representation visuals

This is a follow-up to my original post of Blackjack with card representation visuals I was given some very helpful advice by @Reinderien and @Linny which I greatly appreciate. I have done my best to ...
1
vote
1answer
29 views

Iterating an Array Object & Assigning the Attributes Values to those that Match the Condition

Is there any approaches to reduce the below coding snippet in Angular 2+ with few lines of code by making use of ECMA Script or by some other ways ...
1
vote
1answer
48 views

TypeScript fetch wrapper class with localStorage cache

I'm learning TypeScript while doing my portfolio, and I wrote a class to make a fetch request to the API that holds my data. It is working fine. I use localStorage to set a cache to avoid calling the ...
14
votes
2answers
563 views

Blackjack with card representation visuals

To try and practice OOP, I've heard making a blackjack game can be really helpful; which it has been. I don't know how 'advanced' an implementation this is; but it has all the standard features, like ...
3
votes
1answer
76 views

Parse and format var_dump data to become more readable

I have a class that exposes var_dump data in order to get better human readable layout. I have achieved this with a lot of ...
3
votes
2answers
85 views

Java Reflection-based CSV Parser

I'm an experienced Java developer, however I don't have experience with reflection or Annotation classes. For fun, I tried to develop a CSV Reader class which can parse each row into a particular type....
1
vote
1answer
43 views

Link downloaded subtitle files and video files

This code unzips the downloaded subtitle files and maps them to their corresponding video file. Currently, after pairing video files with their corresponding subtitle files, it links them by renaming ...
2
votes
2answers
46 views

How can I simplify this JQuery validation process?

How can I simplify this functioning JQuery validation process: ...
7
votes
4answers
2k views

If/else produce code duplication

I have the following class: ...
7
votes
1answer
52 views

Python - A Numeric Matrix Calculator/Processor

it's the second object oriented program i've worked on, more details on https://hyperskill.org/projects/96?goal=391. I've added as much documentation as needed, as a first time, to explain each ...
9
votes
3answers
1k views

IP address detection code

I am using PHP for detecting a user's IP address and displaying their details and I use OOP (i.e. object-oriented programming). Are there any problems in it or is it well-written? index.php: ...
1
vote
0answers
43 views

Database connector in Python

I've been trying to build an ORM. I started with the connector layer, which is responsible for the database server connections and executes raw SQL as the code below shows. I have built the ...
2
votes
1answer
122 views

Simple C++ Telegram Bot

Hi :) I am a beginner coder who just learnt C++ and I wanted to apply it in projects to solidify my learning process. However, I only took a short tutorial before trying this out hence I'm pretty ...
4
votes
1answer
82 views

Bank with factory method for accounts, multithreaded deposit and withdraw

I have a couple questions about this program Should I implement runnable instead of using thread class? I like the idea of the consumer and producer being thread objects, it seems simpler to me, but ...
2
votes
1answer
48 views

Command Line app for calculating payroll in Java

I had an assignment last semester to program a payroll app utilizing methods. I went back to it and re-wrote it to include an extra class as well. I would like some feedback regarding whether my code ...
1
vote
0answers
40 views

Avoiding Arrow Pattern with C# Pattern Matching [closed]

I have started to use C# 7's type based pattern matching. A method that only manages a single pattern-based result looks very clean and is easy to reason about. However, once a second pattern-based ...

1
2 3 4 5
67