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
1
vote
2answers
43 views

Scraping news articles from various pages

Scraping news articles from various web page is the main goal of this code. For starting all spiders(web crawlers) at the same time, I try to implement the facade design pattern. It works but I feel ...
2
votes
1answer
21 views

Download statements from Yahoo Finance

This is a Yahoo Finance wrapper to get income/balance statement for a stock ticker. What I have tried to do is make an abstract implementation so more features can be added easily in the future. The ...
-1
votes
0answers
25 views

Learning javascript by developing a simple game

I am learning javascript and have developed a car game using : HTML Canvas javascript The repository link is : https://github.com/lazycoder-007/car_race_html_javascript_game The code is given ...
1
vote
0answers
31 views

sharing and decoupling data

I basically want to know how you would review this code and design. Right now, there seems to be a tight coupling so I feel like I've violated some rules about ...
0
votes
0answers
27 views

Is it bad design to “fake” polymorphism by diverting a function call to another function? [closed]

This question involves C++ code in the context of numerical simulations of some physics. I have a class driver which provides certain core functionality, e.g. ...
3
votes
1answer
39 views

Implement hash table using linear congruential probing in python

I have just read the Chapter 5 of Data Structures and Algorithms with Python. The authors implemented hash sets using linear probing. However, linear probing may result in lots of clustering. So I ...
1
vote
0answers
27 views

Implement priority queue as min-heap in python

The standard library heapq in python doesn't support updating keys as a public method, which makes it hard to be used as a priority queue. Although the official ...
-4
votes
0answers
26 views

Number Conversion System Using Inheritance [closed]

I have a problem in my code. It's just the class. The whole code is under one class.Can it be converted to inheritance?like can it be converted to base and derive classes? Here is the requirement of ...
4
votes
1answer
73 views

Resource management classes in C++ game

This is a part of simple sfml C++ game, but I think neither the library nor the language is that much crucial here. I am mainly worried about the design. I have a class template ...
1
vote
1answer
25 views

Stack Implementation Using Linked Lists

I have tried Implementing Stacks Using Linked Lists, and would like some tips and tricks regarding optimizations or ways to simplify/compact processes. It has 3 functions, Push, Pop, and Peek (For ...
1
vote
1answer
82 views
+100

Trying (and failing) to implement the best conventions on OOP Swift

I'm making a MacOS app that will do some analysis on the user's calendar data. For now it only supports Apple's native calendar (EventKit), but I will later add ...
0
votes
1answer
43 views

Simple State Machine and Transition Table

The goal is to have well defined state transitions, and the ability to provide the next event to execute. I'd like to know if this is a proper implementation of State Machine, considering how states ...
0
votes
0answers
29 views

Run non overlapped periodical tasks on user specified executor

I have concurrency tasks in my module: user code is able to instantiate my object and specify Executor service, then user can submit requests to this object which ...
2
votes
3answers
79 views

Is it fine to typecast from one implementation type to another while using an object?

I've a simple code base with few 'weapon' concrete classes which implements different contracts in order to be used by its clients. My contracts: ...
2
votes
1answer
58 views

Constructing House using OOP

I am new to programming and I have tried to recreate below lines into OOP's code. Please review and provide comments. House has Rooms.Rooms are drawing room, bed room, bathroom etc.Each room has ...
4
votes
1answer
66 views

Life and death model in python

The basic idea of the code is that agents come into the world, they age and then die. I want to keep track of who is dead and who is alive. Eventually, they will do more things but I think there ...
6
votes
2answers
256 views

LazyEnum with validation

Motivation In the standard Python library enum, a subclass of Enum would create all its members upon class creation. This can ...
1
vote
1answer
50 views

Reusing multiple switch cases and if-else statements [closed]

I am creating a 2D text-based Drawing Application which can draw basic shapes like Line, Rectangle, Triangle, Circle, Oval. The Line can be drawn in eight directions on a 2D plane and can be moved by ...
2
votes
2answers
61 views

(Java) Read .txt and organize activities for hours / minutes

Doubts in logic to generate the output file according to the example I need that even if he reaches the total_min <720 condition he continues to travel the lines. 720 is the total number of minutes ...
-1
votes
2answers
55 views

Multiple inheritance of class broken up into modules [closed]

I have a class Main that uses fn(cls, ...) methods from several modules; they're used exclusively by ...
5
votes
1answer
136 views

Multiplayer card game “Hearts” with OOP in Python

To practice Object-Oriented Python and learning how to write tests, I found an exercise and solved it as below(all classes are put in one block of code to make the question a little bit more readable):...
3
votes
2answers
69 views

Simple Banking Program - OOP Principles in Java 11

I created a simple bank program. The program asks for the user’s name and a starting balance. From there, the user can do 4 things, Check Balance, Add Funds, Transfer Funds and Exit the program. Check ...
3
votes
4answers
1k views

Java OOP principes

we have homework in Java to do some users, contracts, and some API. We should create a user with some information about him and one of that information should be address (one where he live and one ...
2
votes
1answer
54 views

PHP OOP - Login & DB adding/removing script

I've created something that I called System, where you can login, create the files and delete the files. It's not any kind of big project, but it's the biggest project I made in PHP OOP so far. It ...
1
vote
1answer
63 views

Is this an good OOP Design in MVC PHP for getting User Details?

I was given a API project by my co-worker to work on half created a system in slim PHP. The project consists of the Models and controllers. When the route is called it calls the Controller with the ...
1
vote
1answer
62 views

Simulating a Rock, Paper, Scissors Game - Flexible

Today I learnt the basics of OOP. I have tried to apply them to this Rock-Paper-Scissors project. However I'm still a beginner, and so I feel my code can be improved. Are there any tips, trick or ...
3
votes
2answers
140 views

Overloading == for better readability

I was working on a project recently that had a good amount of business logic associated with status codes. To better understand the flow of logic in the domain layer, I created an enum ...
3
votes
0answers
54 views

Coffee machine in Python 3

I've been struggling with python OOP. I've gone through the basics but I'm struggling with implementing them. So I've decided to create something small everyday while in quarantine to get more ...
0
votes
1answer
48 views

Should I separate the classes in types and increase decoupling?

My goal is to make a form builder class, that generates bootstrap 4 form inside a modal. My doubt is whether I should leave it as is or if I should crate a interface and then implement that interface ...
2
votes
1answer
53 views

Use Python Enum to implement residue ring and multiplicative residue group

I have implemented the integer residue ring \$ \mathbb{Z}/m\mathbb{Z} \$ and the integer multiplicative residue group \$ (\mathbb{Z}/m\mathbb{Z})^* \$. Functionalities include: In \$ \mathbb{Z}/m\...
5
votes
2answers
371 views

Developed TicTacToe game

I'm a beginner in Java programming. At the start, I wanted to make something easy and then develope it more and more. I chose to do TicTacToe game. At this point I added some menu, playing with bot, ...
2
votes
0answers
33 views

Scraping local news sites

This is my first Python web scraper (and overall my first Python project). I am also relatively new to OOP but do understand its core fundamentals. The script below scrapes two local news sites for ...
1
vote
0answers
27 views

Implementing Doubly Linked List in Python

My take on Doubly Linked List in Python. Is there a more efficient and compact way to do this? Are there any bugs in my program if so how can i fix it? PS: I'm a beginner in Object Oriented ...
0
votes
2answers
121 views

Double switch C#

I see in old code two function that uses same switch like this: ...
1
vote
1answer
46 views

Predicate class implementation in TypeScript

I am have created a predicate builder that takes predicates (functions with a single input and produce a boolean) and can chain them using boolean logic, so AND, OR and NOT. It is inspired by the Java ...
1
vote
0answers
37 views

File organizer based on extensions

I'm still new to programming and I'm not confident about this code. I recently created this File Organizer that organizes files in folders based on their extensions. How can I make this code cleaner? ...
5
votes
1answer
36 views

Command line based game with players and monsters

I am coding a command line based game with 1 player and 2 monsters. Monster attacks player at specified intervals and player takes input from standard input to attack specific monster. I would like ...
3
votes
3answers
140 views

Robot Name - Exercise

Robot Name Manage robot factory settings. When robots come off the factory floor, they have no name. The first time you boot them up, a random name is generated in the format of two ...
3
votes
1answer
44 views

Staff Scheduler: Design/Algorithm questions (Python)

Background I worked at a community center where everyday one of my coworkers would spend 20ish minutes trying to organize the day's schedule. The facility had three rooms: The Great Hall, The Club ...
1
vote
0answers
36 views

DDD design: Tracking price calculation progress and fallback price calculation

I am pretty new to DDD, so any help/ideas will be appreciated. I will explain my initial design and problem below. The user can ask the system to generate products proposal, proposal is basically ...
2
votes
1answer
28 views

Re-implementing an Array Class in Python

I gave an attempt at reinventing the wheel and recreate list methods using my own Array Class to broaden my understanding about lists. I would like advice regarding efficiency, and in implementing ...
0
votes
1answer
83 views

Re-factorize a program using single responsibility principle - SOLID- SRP

The class WalkingData storages a "date" and a "walked distance". The class also read the stored data. ...
1
vote
2answers
45 views

Grouping methods of a Python class [closed]

I have a class with numerous methods, and so I would like to split these up into groups. This would make it easier for the user to find the method they are after. Here is a minimal example of this ...
1
vote
1answer
90 views

From procedural to OOP

I recently discover by reading some blog topics on web that 90% of code lines I produced in my career was procedural and not OOP oriented (big slap in the head). So now, I try to lobotomy my brain in ...
1
vote
1answer
48 views

Chain of responsibility and handlers dependent on each other

I'm importing data from file to many tables in database. It may look like this: First Name, Last Name, Meeting John, Doe, 2020-04-24 08:00:00 Some fields like "...
2
votes
1answer
61 views

Simple TCP Client in C++

I've been experimenting with TCP clients in C++ and I really wanted to get some feedback on my code since I know it is bad. I would really appreciate some feedback on the class structure I have and ...
1
vote
0answers
30 views

How to make it more Scala compatible?

When you write a code in python code people always ask to make it more pythonic. I am not sure if there is a term for scala or not. However, I am pretty sure my following code use one or two scala ...
4
votes
2answers
58 views

Is this an appropriate use of abstract classes and inheritance?

This is a simple app that starts the webcam either in color or in grayscale mode depending on what the user wants: The grayscale camera is implemented via the ...
2
votes
1answer
49 views

MNIST Neural network in C++

While reading an online book (Michael A. Nielsen, Neural Networks and Deep Learning, Determination Press, 2015) regarding neural networks, I decided I wanted to try and build a neural network which ...

1
2 3 4 5
71