Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.
-1
votes
1answer
37 views
1
vote
0answers
32 views
Setting Pokemon stats
I set the stats (.ie. name, attack, defense, HP) in the __init__ method. However, I have chosen to build the self.attacks ...
3
votes
1answer
28 views
Path Finder Maze
The goal of my code was to find all possible moves from each open position in the maze (@moves_hash), assign it a value for how many moves it would take to get to ...
3
votes
0answers
32 views
JavaScript constructor function “RandomNumbers”
My idea is to have objects which contain random numbers. The random numbers are keeped in some data structure (within the objects). Furthermore the objects shall have methods for working with the ...
5
votes
1answer
41 views
Object Oriented Console menu in Java
I am a Spanish programming teacher in a vocational training course and I want my students to make a CRUD exercise on arrays.
I want them to start using OOP as well and as an example, I'm going to give ...
-1
votes
1answer
32 views
Improving User Class structure/design [on hold]
I recently got into OOP, because I'm working on a big project and want to make sure my code is easy to maintain & scalable.
My question is - how could I go about properly structuring the ...
3
votes
3answers
210 views
Rectangle Class
I'm trying to create a private graphics library.
Even tho I'm doing so for fun, I'd like to have some feedback about my coding.
For instance, what do you guys think of the following class (Rectangle)?
...
1
vote
0answers
80 views
Leetcode 317: Shortest distance from all buildings
Problem statement:
You want to build a house on an empty land which reaches all buildings in the shortest amount of distance. You can only move up, down, left and right. You are given a ...
4
votes
1answer
57 views
Binary to decimal conversion and vice-versa
I need to write a code for conversion between the decimal numbers and binary numbers. I have tried the problem and what I have is 3 classes and 1 enum type
...
1
vote
1answer
58 views
Reduce repetition when sharing data across an application
I have a CodeIgniter 3 application. There is some data every page across the application needs to have.
This is the system I currently have.
Create a model function that will get the data I need
<...
2
votes
2answers
93 views
Windows forms application for a Cubscout Pinewood Derby
I have a pretty simple C# windows forms application working here. It is used for creating and running a Cubscout Pinewood Derby. You can create dens, assign them cars, generate a race schedule and ...
6
votes
2answers
73 views
Parsing XML commands and parameters
I'm C# programmer and started Python recently for a new project.
This is a part of my project, and I want your opinion about my code and if it's clean or dirty, too long, has duplicate code, or it's ...
11
votes
4answers
1k views
Making a web service call based on a type of request
I have my code which makes a web service call based on a type of request:
...
-3
votes
0answers
50 views
My problem is on the getPay() and getPerformance() [on hold]
getPay(): Overrides the superclass’s method to calculate and return the monthly pay earned by the staff. The monthly pay of a designer is determined by the projects completed in the current month. ...
3
votes
1answer
85 views
Calculator with history using Java 8
Yesterday, I saw this post from another user: Calculator with history
I started refactoring the code while typing an answer but I end up not posting as an answer because I not sure if my ...
2
votes
3answers
89 views
Creating a Dog Shelter
Background: I have created a program that allows a user to input information about their dog. The output is the bill they will receive commensurate their dog's weight.
The Problem: I believe I am ...
0
votes
0answers
21 views
Dunder proto equality
What changes should I make to keep all other outputs same except the last two?
I wanted to implement few OOP principles (data hiding and inheritance) using JavaScript. I have achieved it. But I feel ...
2
votes
0answers
58 views
Tic-Tac-Toe class and methods
I'm trying to learn python and am still a bit foggy on classes.
Am i using them right in this tic-tac-toe game? Everything function like i want it too but not sure if i am really getting how to use ...
2
votes
0answers
90 views
Designing a WFS service Client
The Driver Code that needs to be encapsulated in interfaces is shown next:
...
3
votes
0answers
79 views
Python Perceptron
This is my finished perceptron written in python. Is there anything that I can improve/suggestions? I'm a beginner with python so anything would be helpful!
...
4
votes
1answer
67 views
Quarantine implementation
I have an assignment to implemented a Quarantine project where I was left with the some unit tests and a skeleton of the implementation. I provided the solution below and get rejected from the ...
4
votes
5answers
120 views
Simple class to create csv
As part of a solution I have the following class createCSV. It is working as expected but I'm very much aware of my lack of experience with ...
1
vote
2answers
64 views
5
votes
1answer
80 views
Building a model-view-controller application in PHP
I've seen at least two recent PHP questions that would do well from a Model-View-Controller ('MVC' from here-on-out in this question) setup. Now, me, being the horrible person I am, I wanted to build ...
-1
votes
1answer
34 views
Initiating an action based on product type
I am starting my studies with Ruby and OO and I have received a test to do about OO. I am looking for new ways to improve the scenario following object-oriented concepts. Is there a better way to ...
1
vote
2answers
73 views
Sortable Shapes
Description:
Although shapes can be very different by nature, they can be sorted by the size of their area.
Create different shapes that can be part of a sortable list. The sort order is based on ...
2
votes
2answers
75 views
CRUD operations for a patient database
My code performs CRUD operations in PHP using OOP and dynamic queries. How can I completely separate HTML tables from this code?
Db.php
...
3
votes
3answers
403 views
Pokemon-style text battle game
I took a crack at making a Pokemon-style text battle game in Python 3 to practice object-oriented programming a bit, inspired this project on Reddit, but I did not follow every instruction.
...
1
vote
0answers
29 views
Op-code decoding in an emulator
I've written the larger part of an emulator for a 6502 CPU but my method of op-code decoding is giving me concern, mainly because of how long the method is getting but also because I need a variable ...
-1
votes
2answers
59 views
2
votes
0answers
51 views
Simple OO MVC PHP framework
I've been working on a simple MVC PHP framework on and off for the last nearly 12 months, so I thought that I'd put it out there.
The project began as a way to mentor and teach a junior (or a more ...
3
votes
3answers
102 views
An online store, being converted from procedural to OOP
I just start to learn OOP, and it's far more interesting than procedural style.
I have a complete working online store written in procedural style. After realizing that my code is becoming very huge ...
4
votes
0answers
55 views
There Was an Old Lady - generate lyrics to a cumulation song
This is a problem from exercism.io. View repo here (contains full example of song).
Problem statement:
Generate the lyrics of the song 'I Know an Old Lady Who Swallowed a Fly'
While you could ...
6
votes
1answer
116 views
Find the shortest path through a maze with a twist: you can knock down one wall
I would like my solution to Google Foobar's prepare_the_bunnies_escape checked for readability, maintainability, extensibility, style, design. I am looking forward ...
7
votes
2answers
253 views
Sending data to a database in size-limited chunks
I have a method which takes a parameter which is Partition enum. This method will be called by multiple background threads around same time period by passing ...
7
votes
0answers
101 views
Multiple similar manager classes for handling scroll lists
I am working on my first object-oriented programming project, written in C# for Unity. My code does what I want it to do, but I am wondering if there is a better way to do it. I think I am building ...
8
votes
4answers
520 views
Finding the lowest and highest values in an array… with “Poor Man's DI”
I am practicing my object oriented knowledge, so I created a very simple program that determines which is the lowest and highest number inside array.
This is my main method:
...
0
votes
1answer
39 views
PHP Single Type Collection
I have implemented a collection class that stores a single type of value.
At the moment it is immutable.
...
7
votes
0answers
95 views
Analysing Poker combinations
I made a Poker game a while ago and looking at it now, I'm not really happy with the code structure and I decided to revamp some of the core functionalities there, starting with the different Poker ...
1
vote
1answer
72 views
Working with a new form instance every time
I have a form that looks like this:
It is initialized with a Shortcut from the keyboard. It is in a module:
...
2
votes
2answers
97 views
Is this a correct way to use Decorator and it respect SOLID principles?
I've used Decorator to create a Dataset class used to build a Dataset Basic Empty (ConcreteComponent) and Iris class (ConcreteDecorated) used to populate it.
Decorator allows a user to add new ...
2
votes
0answers
43 views
Applying changes to the same journey with method chain [closed]
I have class:
public class Journey
{
public int Id { get; set; }
public DateTime Date { get; set; }
List<Stop> Stops{ get; set }
}
My ...
5
votes
1answer
88 views
Sudoku solver with Tkinter
The code below is a Sudoku solver using backtracking. There is a fast mode which doesn't display the permutations in the Tk widget in real time; only the solved grid.
This is the second version of a ...
1
vote
1answer
53 views
Simple quadtree template implementation
I'm returning to C++ after more than 10 years. The code I wrote for a simple quadtree style class has a ton of new elements I haven't used. I'm looking for comments on the design and not necessarily ...
2
votes
2answers
46 views
ASCII to Binary and reverse in java
Here is a simple app that i am trying to implement in java.
my goal is to write a program that can convert ASCII to Binary and back.
Questions:
Am i violating any OOP Rule.
Is my code readable ?
...
5
votes
2answers
248 views
99 Bottles of Beer using polymorphism
This was part of an exercise from exercism.io. If you fancy, view the repo here.
Given problem statement:
Write a program which produces the lyrics to that beloved classic, that field-trip ...
0
votes
1answer
36 views
Complex class polymorphism and lazy-loaded components
I'm having an issue defining a base class and child classes, which handle initialization differently. I want it to work in ES6 but allow babel to transpile to ES5, and currently babel does not have a ...
1
vote
1answer
41 views
3
votes
2answers
113 views
3
votes
1answer
79 views
Generating Settings Objects from Database via Factory Class
In an ASP.NET MVC application (C#) have a factory-like class that generates settings objects of ISettingType for my application. However, some settings are very ...