Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.
1
vote
0answers
9 views
From scratch pub sub definition and implementation
I am finished with my implementation of PUB/SUB or Observer pattern, however I just want to see any ways that I may be able to improve this pattern. I wanted to be able to use the typical ...
-1
votes
0answers
9 views
1
vote
2answers
23 views
“Time Conversion” Python implementation
Problem Statement
You are given time in AM/PM format. Convert this into a 24 hour format.
Note Midnight is \$ 12:00:00AM \$ or \$ 00:00:00 \$ and 12 Noon is \$ 12:00:00PM. \$
Input Format
...
4
votes
2answers
54 views
Simple Translation Gem
I have a small gem that I've been maintaining. This gem provides a simple way to do translation using an alternative Google API.
I've been working with Java last year and recently did some ...
-5
votes
0answers
27 views
matrix classes to calculate the product of matrix with vector [on hold]
I wrote an class of matrix to calculate the product of matrix with vector,without using the class .
So, there is my program:
...
9
votes
3answers
467 views
Google reCAPTCHA Validator: Iteration III
This is the third iteration of my reCAPTCHA validator. Iteration II can be found at: Google reCAPTCHA Validator: Iteration II
It does almost everything required to do reCAPTCHA validation on anything ...
3
votes
3answers
92 views
Tic-Tac-Toe classes according to SOLID principles
I have these classes for my Tic-Tac-Toe game project. I am very new to object oriented analysis and design. Can anyone help determine if SOLID principles are preserved in this code or if it is ...
6
votes
1answer
40 views
Multiple file upload class
I've written this a few days back, which is not too big. Do you see anywhere I can improve my logic?
...
6
votes
3answers
314 views
Money class with overloaded operators
I have program that uses a Money class which has several constructors for different methods of input and overloaded operators to add, subtract, and compare values.
...
1
vote
1answer
43 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 advice/improvement hints!
I'm pretty satisfied with the result, but I'm also aware, there ...
-2
votes
0answers
22 views
C++ Copy Construtor…copies fine but has unexpected core dump [closed]
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
95 views
Filter a list of persons by age and write the results to a relevant file
Let's say I have a class:
...
6
votes
3answers
72 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 ...
13
votes
1answer
233 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
46 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
292 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
235 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
67 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
74 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
114 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
64 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
90 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
87 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
121 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
71 views
3
votes
3answers
91 views
7
votes
2answers
471 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
102 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
103 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
35 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
82 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
98 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
...
6
votes
1answer
76 views
UI selector directives for an AngularJS invoicing module
I'm wrapping ui-select in my own directives to pre-configure and style it, as I need it for my app in different select widgets. They appear on many pages, for example ...
4
votes
2answers
70 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
117 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
151 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
61 views
Simple Vector2 structures (and interface)
I built a couple Vector2 structures (Vector2 and Vector2F) for use with a particular ...
4
votes
0answers
145 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
89 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
43 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 ...