Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.
0
votes
0answers
7 views
Laravel API design
I've been designing and coding my Laravel API boilerplate for couple days now, and I'd like to hear some advices/improvement hints from you guys!
I'm pretty satisfied with the result, but I'm also ...
-2
votes
0answers
22 views
C++ Copy Construtor…copies fine but has unexpected core dump [on hold]
I have tried about everything. Increasing the amount of allocated space...copying not the full previous array. Testing has revealed that everything is fine until directly after the code is run. My ...
5
votes
3answers
89 views
Filter a list of persons by age and write the results to a relevant file
Let's say I have a class:
...
5
votes
3answers
54 views
Python OOP shopping cart
I am a new Pythoner, and don't have good knowledge of OOP. I completed the following task, but I feel the code is not good. I welcome recommendations to improve the code.
You need to create the ...
12
votes
1answer
212 views
Three in a row: Tic, Tac, Toe
The other day, I started thinking of a new personal project to start that I wanted to do in Java. As I started to do it, I realized that I was constantly deleting classes, creating new ones, merging ...
0
votes
1answer
37 views
Structuring a JSON array with objects
I have a JSON array or literal (passes through JSON.parse).
Requirement: an array of tasks which contains operations which are key/value pairs.
Array of tasks > Array of operations (array of ...
1
vote
0answers
44 views
A form builder component
I would love my component to be reviewed. I am looking forward to responses mainly answering the questions:
Is my code violating the SOLID principals? If so, where and how?
Does my component contain ...
11
votes
2answers
288 views
Simple object oriented design of student system
I have created a simple system to get hands on experience with OOPS design and some features in Java:
The system is:
A ClassOfStudents contains Students
A ...
8
votes
1answer
227 views
Generic domain independent Monte Carlo Tree Search methods library
I've written this small generic library for the purpose of my Bachelor’s thesis. It's fully functional and unit tested and I want to get as many opinions as possible regarding overall code quality ...
1
vote
3answers
65 views
Using cookies in PHP
I was wondering if there was a better way to do this. Would that mean there would need to be no client-side refreshing to show the cookies when they are created?
...
11
votes
1answer
205 views
Framework to track changes and relationships in C#
Recently, I wanted to see how I might could track state changes to objects, and manage relationships (1 to 1, 1 to N, N to N) between types in C#. This was a really interesting project, and I'm ...
4
votes
1answer
73 views
The rounded box that wanted to be an arc
This is from Bjarne Stroustrup's C++ Programming: Principles and Practice, Chapter 13 Exercise 2:
Draw a box with rounded corners. Define a class Box, ...
4
votes
1answer
99 views
CRUD operation using Object relational model and Data Mapper pattern for a Matrimonial website
Database.php
As the name says, it create connection and execute query. Although I think I should make it static/singleton class.
...
0
votes
0answers
33 views
Message construction dispatching and generation
This is going to be long on descriptions and a little shorter on code–my apologies, but I can't get too specific for various reasons.
In some existing code that I did not write there are two main ...
2
votes
1answer
61 views
Basic CRUD application for Product, Category & Location with SQLite
I improved the code from my previous question.
At this moment, the 3 entities have not yet a connection with each other. They should only be available for CRUD actions in a SQLite database.
I would ...
6
votes
2answers
88 views
Chess game in Python - follow-up
Three weeks ago I wrote the first version of my chess game in Python and shared on Code Review. Thanks to your suggestions, I improved my code. I would like to know if I am going in good direction ...
2
votes
2answers
59 views
Calling a class setup function directly rather than creating a class from metaclass
I'm creating a new data type, with the intention of overloading the arithmetic operators. It's for Galois Field arithmetic. The obvious thing to do is create a class, the instances of which will be ...
10
votes
2answers
242 views
Filtering log files from a server
I have made a program in Python to do a filter of log files from a server. What I would like is some guidance on how this code could be optimized, streamlined or 'short-handed' so my 'pythonic' ...
8
votes
1answer
67 views
Elevator Management System
So here's my attempt at the September community challenge, making an elevator handling system. I'm not really very familiar with OOP, so I'm particularly looking to get feedback on that part of the ...
3
votes
2answers
120 views
Count words that are longer than a set Length
This is working, but I want to know if is this a place where IEnumerable can be used?
...
3
votes
0answers
66 views
OOP paradigm implementation of a Dictionary data model
Below is the implementation of interface Dictionary using chained hash table class HashTableChained.
Despite item 22 says: ...
2
votes
1answer
70 views
3
votes
3answers
91 views
7
votes
2answers
468 views
Three-in-a-row board game
I don't truly understand how OOP works and It's stopping me from creating good programs! Below I have a program that will check to see if there are 3 tiles from a gridview in a row.
Here's a ...
7
votes
1answer
101 views
Board-tile game click event OOP pattern
This is actually an old 'problem' that I never really knew how to improve, but I'm wondering now if there is a better approach for this problem.
I'm creating MineSweeper with Java and struggling with ...
3
votes
2answers
99 views
Brute-force string generator
I have created a brute-force algorithm class in C# and I was wondering if I could speed up the process of creating a new string. There are two methods inside the class: one returns the brute-force ...
4
votes
1answer
29 views
LRU Cache in ECMAScript
I wrote this for a CodeWars challenge while trying to learn ECMAScript and would really like to have some advice on how it could be improved.
What I don't like about this code myself, but am unsure ...
4
votes
2answers
66 views
ProductManager: a basic CRUD for products with SQLite
I would like to have a review of this basic CRUD application so I can improve and learn from your experience. The code can be found here.
Design pattern/coding principles improvement that could be ...
4
votes
1answer
32 views
Python GUI for cropping and saving images quickly
I wrote a simple GUI applications to help me select 'positive' regions of a bunch of photos for the purpose of training an object detectir using OpenCV Haar Cascades.
For training purposes, you need ...
5
votes
3answers
80 views
Passing JSON object through loop to be used in jQuery Dialog
I'm wondering if there is a better (cleaner?) method than my current implementation. I'm currently encoding a PHP SimpleXMLObject (USPS Tracking API) to JSON and ...
2
votes
0answers
28 views
Boarding cards route finder
Recently I had an interview project, which I did and sent, so this question is not for avoiding thinking. I am just struggling to build my own opinion about it so I decided to ask in public.
My ...
3
votes
2answers
96 views
Simple object oriented design for a patient system
I want to model this scenario in object oriented language:
A hospital has number of patients
A patient can have zero or more medical conditions
A medical condition is identified by name and date
...
4
votes
2answers
68 views
Modeling rainwater collection and cost
The following is a function that takes an area as an input and outputs some resulting calculations.
I thought an object was useful for creating multiple instances with different custom properties ...
2
votes
3answers
116 views
Music collection with lyric songs and instrumental pieces
I have problems with dealing with derived classes that inherit from the same base class.
I have 2 types of songs:
Songs with lyrics that have: Title, Tags (sad, happy etc.), lyrics (one line), ...
5
votes
2answers
150 views
Rock, Paper, Scissors, Lizard and Spock with OOP
Today I saw an extremely interesting question on the Rock, Paper, Scissors, Lizard and Spock game. I've decided to take my swing at it and I've written the following OOP implementation:
...
3
votes
1answer
60 views
Simple Vector2 structures (and interface)
I built a couple Vector2 structures (Vector2 and Vector2F) for use with a particular ...
4
votes
0answers
139 views
Small PHP-MVC system (for personal learning / use)
I've made an "simple" / "small" MVC-like PHP system. I've used some code of an project I used before and ask questions about it back then to.
The thing is, it works (the admin part to begin with), ...
3
votes
1answer
85 views
Solving Project Euler problem #60 in C++
I have implemented a solution to Project Euler problem #60. In summary, the problem asks to find the smallest sum of a set of five prime numbers such that the decimal strings of any two numbers in the ...
2
votes
1answer
41 views
Get K most frequent tokens from a token stream
This is an interview problem:
Given a token stream, find the K most frequent tokens in real time (the order of these k tokens does not matter).
My approach:
Use a hash table (...
10
votes
1answer
99 views
Find all the primes less or equal than N
This is not a novel interview problem. But I want to address it with the following points:
Implement the algorithm with Object-Oriented Design principles in mind.
Optimize the solution, if there are ...
6
votes
1answer
72 views
Avoiding code repetition while handling exceptions
For my application, I need to use two slightly different algorithms for persisting an entity:
...
5
votes
1answer
108 views
Inventories, Containers and Filters
Coming off a comment on this question, I figure it cannot hurt to post my Inventory work here as well.
Basically, I have Item, ...
4
votes
1answer
46 views
Sorting a linked list using mergesort
This sorts a linked list using mergegort. Can you please critique my code and provide your thoughts on where I should improve my code?
...
5
votes
0answers
75 views
Multiple inheritance pattern for vehicle information
I wanted an easy way to augment objects, by adding functionality from any other object(s). More importantly, I needed a way to augment the object from multiple sources in a clean one-line solution.
...
7
votes
2answers
104 views
Tic Tac T-OO: Design and Implementation
I want to learn OO design and as a start, I implemented Tic Tac Toe. I'd like to hear your thoughts on the design and implementation.
Classes:
Player - Has just ...
5
votes
1answer
117 views
Simple hotel reservation system
This is a reservations software for hotel and restaurant management, allowing you to add and delete rooms, show available rooms, keep track of reservations etc. I am looking to trim my code a bit and ...
1
vote
1answer
57 views
JavaScript accordion
I'm trying to refactor some code I wrote months ago when I used to use lots of anonymous functions. The way I'm trying to do it now is by taking all those functions and rewrite them within Object ...
1
vote
2answers
34 views
Cameras and ITrackableObjects
The purpose of these two classes (and hence why I am including them together) is to allow you to create a Camera, that indicates a "render zone", and track an ...
1
vote
0answers
67 views
Simple Router class
I made a simple routing class that I like to get reviews for, mostly because I do not know how to make it SOLID, since I even made this class separate from the HTTP response/request for the sake of ...
12
votes
1answer
130 views
Ultimate Tic Tac Toe A.K.A. Tic Tactics
My attempt at this challenge., incorporating lessons from this question, which turned out into a much bigger project than I anticipated, but it works. I'll definitely be refactoring most of this in ...