Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.
0
votes
1answer
26 views
Upload file program
I'm working on an upload file program in PHP in OOP style. I need some feedback about code.
index.php
...
-2
votes
0answers
18 views
Design a sendInvite for a Calendar appointment [on hold]
Recently in an interview I was asked to design a "send invitation for an appointment to multiple contacts in a company". (Something similar to creating an Appointment in Outlook)
Could you please ...
2
votes
2answers
60 views
Build a Person class, delegate don't duplicate
I am currently learning javascript and I attempted to make a Person class (note - this was part of a practice exercise, so some of the design decisions may have ...
4
votes
0answers
23 views
OO shopping cart class + product class interaction
I built a small store site for learning purposes. I loaded my 'products' from the db into a products class. I used a method from this class to display the products in HTML. Of course, the HTML ...
8
votes
2answers
65 views
Particle swarm optimization - follow-up
This is a followup post to Particle Swarm Optimization.
I wrote a script in Python for particle swarm optimization and I posted it here to get comments on the design. I was told that encapsulating ...
7
votes
3answers
85 views
Implementing Dynamic Network Message Handling (Part II)
This is an iterative review request of this other question I posted.
As a follow up to that previous question, I changed the pattern completely and I went to an events-based approach, which might be ...
4
votes
1answer
51 views
Database classes for job offers
I've recently started using PHP OOP, and I'm now working on an application where different company representatives can create job offers that candidates can look at.
I have a variety of objects for ...
0
votes
2answers
38 views
Creating multiple objects from SQL server extract
I've created a simplified prototype solution as a sort of proof of concept before starting a larger program.
Here is the test data used to build the objects:
...
5
votes
2answers
81 views
Composing a prototype chain in JavaScript
As an exercise, I wrote a simple function that composes a prototype chain from a list of objects by appending to the prototype chain of the first object, the rest of the objects. This is the code ...
4
votes
1answer
76 views
Cohen-Sutherland 2D line clipping algorithm
Please, review the following implementation of Cohen-Sutherland line clipping algorithm (p-91):
Bits.cpp
...
3
votes
1answer
39 views
Class modelling for a shogi notation reader
I have made GPL software in GitHub whose purpose is reading shogi notations (shogi is Japanese chess). I have been told that my software modelling is underdeveloped in this question and advised to ...
3
votes
0answers
35 views
Action dispatch for a combat class
My problem is that I have a piece of code logic that I'm having trouble fitting into an OO approach, and I was looking for design patterns so that the following code would no longer rely on the ugly
...
3
votes
2answers
49 views
Matrix class with lots of tiny methods
I have been following the advice to make tiny methods that does just one thing and does it well. I also have been keen on reducing or eliminating duplication as much as possible.
But when a very ...
11
votes
2answers
122 views
Implementing Dynamic Network Message Handling
I'm trying to handle network messages in a dynamic, and effective way, though I feel I've overthought it again. As of now, I have a very structured approach, but it feels as if it's a lot of overhead ...
8
votes
2answers
57 views
Take These Buttons Back
I created a side bar of buttons for my game, the idea being that if you click on the "main" button of the group, the rest of the buttons in the group would pop out from the side of the screen.
Later, ...
4
votes
1answer
38 views
Class(es) for animating objects on a canvas
I'm building a simple canvas animation engine as an exercise in learning ES6. Coming from C++ and Java, I miss static properties, but I've read that "Prototypes having data properties is generally ...
2
votes
3answers
92 views
Subscribing an Object to its own Events
Is it appropriate for the class to subscribe to its own events like this? Should the class not subscribe, and instead move that code to before the ...
7
votes
1answer
97 views
Class to manage config data to allow DI
I'm writing my own framework (purely for learning purposes, SPL, OOP, patterns, etc) and have written a class to manage config data throughout the framework (not front end/view, just the core ...
4
votes
1answer
55 views
Native JavaScript to-do list app using Jade
For practice and to explore my vanilla JavaScript (no-library) weaknesses, yesterday I made a Todo app, similar to what you see floating around for AngularJS blog demos.
How can I optimize this?
...
2
votes
1answer
49 views
IRC server implementation in Python
People say that the code in my implementation is generally obscure.
Can you point me what looks bad?
...
3
votes
1answer
285 views
Avoid using object to hold int, bool, double application setting values
I have some code to handle integer, double, Boolean, and string settings. Right now, each setting variant extends an abstract class, where the setting value is stored as an ...
5
votes
6answers
1k views
Adventure game player using public fields instead of getters and setters
I was writing class Player with private fields and getters and setters. But the number of methods started to grow, I used lists ...
5
votes
2answers
126 views
Restful API Building: Dependency injection + factory patterns
I am learning OOP. I feel I have a grasp of basic dependency injection in that as a rule of thumb, you pass an object to a method rather than the parameters to create an object. As such, never create ...
4
votes
2answers
71 views
Lightweight implementation of the in-close algorithm from C++ to C# translation
The following C++ code is a lightweight implementation of in-close algorithm. Full details of the project can be found here.
I was trying to translate the C++ code to C# but it's very difficult to ...
0
votes
1answer
36 views
YUIDoc syntax for optionally static constructor
In JavaScript, I wrote a class that can be optionally instantiated with the new keyword, but can also be called statically as well. What is the best way to ...
5
votes
0answers
69 views
PDO Class to help on writing SELECT statements
I made this class just for the fun of it.
The idea is to make a SELECT statement really quickly.
...
1
vote
1answer
52 views
Scroll to specific sections
I have a jQuery code that helps me to scroll to specific sections on mouse scroll. To handle mouse scroll events I am using the jQuery mousewheel plugin.
...
11
votes
7answers
879 views
Scoring a Scrabble Word
I was asked before an interview to create a console application that will work out the score of a word for the board game scrabble. It worked fine but the feedback I received said:
"there were no ...
3
votes
0answers
30 views
Dynamic voting protocol implementation for replicated file system
I recently implemented a dynamic voting protocol for a replicated filesystem. I would really appreciate it if you can review the design and some choices made with regards to sharing of Locks & ...
1
vote
2answers
39 views
PHP session_set_saver_handler with session timeout
I have developed a class that utilises the session_set_saver_handler function so I can store sessions within my DB. The class works just as I would like.
However, ...
0
votes
0answers
72 views
User login authentication
I started with OOP around 1 week ago and I would like to ask you to check my code and give me some tips and advice but also tell me what I'm doing completely wrong. I also know that my code is not ...
11
votes
4answers
98 views
Cats and Dogs at the Petshop
I had a test before and had to do this task:
Create classes: Cat, Dog and Petshop. Types ...
2
votes
1answer
70 views
A color class and a CRUD class for it
Is it better to have only one class color and include the functions from the second class in the 1st one? Or leave them apart?
Why is one better than the other or ...
7
votes
1answer
57 views
Media lending library
My assignment was to make a "Lending Library" that keeps track of items. We were advised to create two classes and a main method.
What I am unsure of is if any of my code would be considered bad ...
4
votes
0answers
56 views
Blocking reads when writes are happening on two flows
I am trying to implement lock by which I want to avoid reads from happening whenever I am doing a write.
My requirements are:
Reads block until all three maps have been set for the first time.
Now ...
5
votes
2answers
116 views
Generic Networking Class for PHP
I am in the process of writing networking code for PHP that is meant to be used in long-running PHP processes. I realize that PHP is supposedly not well suited for long-running processes, however ...
3
votes
1answer
48 views
Converting Procedural JS Code to Object
I'm new to JS and trying to improve my code with the use of more organised objects. I have the following procedural code which I have converted to an object. It does an ajax load within main. Aside ...
4
votes
1answer
48 views
OO coding style in short Ruby scripts
I've been using Ruby for about a year now, mostly for small scripts with uses ranging from data munging to DevOps tasks. However, I am not intimately familiar with OOP (I appreciate the functional ...
4
votes
3answers
141 views
Case Study - Basic sales tax
The solution was to be assessed, not just on completing the task but also on code quality and design, presence of testing, robustness, maintainability etc.
Problem Statement
Scenario
Basic ...
2
votes
1answer
48 views
Program simulating dictionary using file handling - part 2
This is the new version of the dictionary program which I uploaded for reviewing here.
I would be grateful if the program could be reviewed for all the points mentioned in the above link.
...
3
votes
2answers
66 views
Ball Entity for a Entity/Component/System Soccer Game
Here is a code snippet of a class that I be interested to refactor. I was in doubt on how to proceed with the process of instantiation. The original ask was here. After think about it and heard some ...
5
votes
1answer
130 views
Code Golf challenge that plays Mafia
I am working on writing a Code Golf King of the Hill challenge, the details of which can be read here. You can read the full code here.
Briefly, the game proceeds in cycles of night then day. There ...
7
votes
3answers
251 views
Go (board game) in Java — version 2
First version: Go (board game) in Java
What's new:
I now use (as advised) HashMap<GoPoint, StoneColor> where GoPoint ...
-1
votes
1answer
28 views
Globally accessible helper class [closed]
I would like to get opinion if I am doing this right. I am creating a helper class that is globally accessible to my whole project. I want it to be easily called like ...
1
vote
0answers
45 views
Soccer game using libgdx and an Entity System Framework
I'm working in a game as a hobbie. I'm using an Entity/Component/System architecture using Libgdx as Engine and Ashley as Entity Framework.
I have a GamePlayScreen in which I initialize my system, ...
2
votes
1answer
51 views
Parking lot and vehicle classes
The expected functionality is that a user/vehicle interacts with a ParkingLot and it allots the space in Park method based on ...
2
votes
0answers
141 views
Procedural to OOP MVC: Understanding Controllers, Models, and Service Layer
I designed a framework to make the switch from procedural to OOP design. This question will contain multiple parts I will bold each question to make reading/dissecting easier. I attempted to look into ...
5
votes
2answers
148 views
Slim API with 3 layer architecture
I'm new to Slim and the three layered approach I'm using below. So far I have the API, a Presentation layer (leaving out for now), a Business Logic Layer, and a Data Access Layer. The code's working, ...
13
votes
4answers
1k views
Go (board game) in Java
Go is a board game (it looks like 5-in-a-row and plays like chess) and I tried to program it in Java.
Rules:
Two players take turn placing stones on a board. The goal is to capture teritory. ...
1
vote
2answers
40 views
Separate Ajax code in separate modules
This is the first time I am working on OOJS code and I am a beginner in JS. I think I have pretty much messed it up. I am planning to modularize my code, but with the inclusion of ...