Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.
2
votes
0answers
10 views
Session flash class
I've created this class, for flashing variables like validation errors or success messages. But I'm not certainly sure about it.
...
1
vote
2answers
24 views
Database fetch class
The active column in the database only contains a boolean. The country column contains ISO 3166 A2 codes (2 char). Do you have any advice on improving this class?
...
0
votes
0answers
22 views
Module based todo list [on hold]
This is my todo list based on the Module Pattern. This is working fine and just want to know two things.
Can my code be simplified? Once I've added a list, if I refresh the page, then these lists are ...
0
votes
1answer
13 views
Creating object Nodes an easier way
I am required to create a bunch of object nodes to an object:
...
3
votes
1answer
81 views
Memory leak using UserControls
I seem to have a memory leak on this method but can't figure it out. This method is called every 10sec by a timer which acts like a refresh.
...
5
votes
3answers
66 views
Design of a remoteControl class for connecting to electronic devices
In a course that I'm taking on learning object oriented programming in java, I have completed an assignment for modeling a home entertainment system and the ability for a user to be able to use a ...
8
votes
2answers
54 views
Adapting a bilingual program to support users with learning disabilities
I have a very large class which serves as the BaseClass for many AdapterClasses. The base class consists of methods that can be ...
2
votes
1answer
42 views
Method for parsing floats and adding totals
My intention is to create a nice DRY method (add) which will take care of parsing floats and adding totals internally and will be called by other methods.
I feel ...
5
votes
3answers
48 views
Performing database interactions
I wrote this CRUD class in PHP that has methods to do database interactions, but I want to know if it is good/secure/elegant?
It works fine and all and it hasn't ever given me any troubles, but I'm ...
0
votes
2answers
41 views
Questionnaire design puzzle
I am designing a small questionnaire web service application but however I would like if someone can look at my design and see if it good approach I am taking.
The application has the following ...
7
votes
3answers
243 views
Rocks, Paper Scissors game
I wrote a Rock Paper Scissors game and was hoping to get some feedback on issues like:
Am I utilizing object oriented techniques correctly? What can I do better?
Am I using ...
3
votes
2answers
120 views
Correctly coding an OOP object
I have a couple of functions in WordPress that I'm rewriting to OOP. All these functions are interlinked in some way and also reuse code from other functions.
This is an example of the first class ...
3
votes
0answers
25 views
Custom dropdown selector
I'm working on improving my knowledge of OOP in JS. I just created this custom dropdown selector. It's working nicely, but I'm not super happy about the Filter ...
4
votes
2answers
912 views
Switch statements in Rock-Paper-Scissors game
I am very much new to design pattern. I'm trying to modify the Rock, paper, scissor game from an example book where I try to add more various design pattern. But I am encountering two similar switch ...
2
votes
2answers
38 views
Quickly filter an object by keys
I am trying to optimize an object filter function. Given an array of keys, I need to filter an object. I feel that creating a new object each time may degrade performance. Is there a way to mock the ...
4
votes
0answers
32 views
Brute Force (and not) Bejeweled AI
My approach to solving the problem of selecting the best match on a bejeweled board is a fully object oriented approach. Some of the other relevant code can be found in my previous questions ...
2
votes
4answers
83 views
User class and 'generic' Database class
This may be a bit overwhelming, but me and a friend of mine have written a Database class with methods for our queries. All of these queries should be generic so we can use them in multiple ways. We ...
4
votes
2answers
73 views
TCP chat application with both server and client logic in same application
Here is my simple chat program. I'm wondering whether it has an acceptable design (both object oriented design and network design).
If you want to run it, I can provide the solution folder.
...
4
votes
1answer
72 views
Calculator - C++ operator-overloading
I am new to object-oriented concepts. The following is my attempt at creating a basic calculator using class and operator overloading concepts. Please review it for improvements. Also, how do I make ...
1
vote
0answers
12 views
Javascript custom event hub
I'm creating an event hub object in for a large project I am building in Javascript. The project will have modules in charge of the UI, commands, and rendering. Each module will use this hub for ...
2
votes
1answer
354 views
Controller for repository of members
I am still new to Laravel, just learned the Repository pattern.
I tried to implement it on my project, here's the result:
MemberController.php -- this one is a bit ...
4
votes
1answer
48 views
Serial port for Node.js
I am trying to create a class for serial port using Node.js, but I want to know if there is a better way to write my data class code.
In my sample code below, in the ...
4
votes
2answers
89 views
4
votes
1answer
46 views
Data-checking class supporting letters
I'm starting to learn OOP with PHP, and all I've learned so far is just by searching and reading. So I have this need to check input data for certain things like min of chars, max of chars, spaced or ...
5
votes
1answer
54 views
2
votes
1answer
62 views
TicTacToe in OOP
I'm trying to learn some OOP programming using Java, so I've created TicTacToe. Could you give me some advice on how I can improve this code?
Player.java:
...
5
votes
3answers
403 views
Does this Tic-Tac-Toe game follow abstraction and encapsulation?
This below program will be further enhanced for TicTacToe game with Human and Computer as players.
Currently this program is written for choosing best move for a ...
15
votes
2answers
222 views
Hangman on the C++ommand line
I'm wondering if my code is just a tad too long to post here, but if the only consequence seems to be getting high-level reviews, then that's perfectly fine.
This is my implementation of Hangman in ...
2
votes
1answer
96 views
Vehicle Running Cost calculator
I'm making a road tax data calculator/parser for practice. I do this because I want to learn more about OOP and arrays with its functionality.
On my previous post, i made this same application but ...
5
votes
0answers
139 views
Database abstraction layer for PHP web application
I'm working on a PHP based web application.
While building the UserStorage class, (which acts as a storage source for user data, and implements the ...
2
votes
1answer
216 views
Displaying a list of players and their leagues
My question is mostly directed towards the principles of object-oriented programming.
I have an Android application and one of the activities has a ListView.
In ...
11
votes
2answers
137 views
Basic duel fight with OOP
How would you improve on this? It's been fairly long since I last did something slightly more extensive in C++, so I'm looking for ways to be more compatible with modern C++ ways, and this style of ...
7
votes
1answer
122 views
Recursive dragon on a canvas
I've been doing some JavaScript for fun again. This time I tried my hand at drawing the Dragon curve - a neat fractal that consists of one line traveling across the plane, never crossing itself, and ...
4
votes
1answer
179 views
4
votes
2answers
496 views
Use of a static class for a game engine
I've been designing a game engine for the past few months with little issues. However, one main goal with this project is to put it on my portfolio/résumé so naturally I want the code to be as good ...
1
vote
1answer
37 views
Magento MySQL search based on phone number
I'm building a search for Magento. Magento API doesn't provide an easy way to look up a customer using a phone number so I created a custom solution. My MySQL/PHP OOP skills are limited. Did I miss ...
2
votes
1answer
117 views
PHP Register Form - OOP
I'm trying to build my first object oriented system. I'm not sure that my register function below is the best way of approaching this within OOP.
...
2
votes
1answer
59 views
Road tax data parser
I'm making a data parser for road tax data (costs) which parses a JSON file with all weird variable names, which the customer gave me.
The costs are different on each vehicle type. The costs at some ...
16
votes
3answers
618 views
How to Train Your Dragon
I started out practicing on implementing the builder pattern and somehow ended it up with this 2 hours later. It isn't really much, but it works and I'm hoping review should bring about a lot of ...
7
votes
1answer
192 views
Multiple inheritance with JavaScript with support of calling of super() methods
I have just finished working on a Node.JS module that provides "multiple inheritance that works". I had some really specific requirements:
Works in safe mode
Auto-calling of parent constructors
...
8
votes
1answer
151 views
Python-based Git pre-commit hook to manage multiple users/Git identities
A couple of months ago I posted a bash script to manage multiple Git identities as a solution on Stack Overflow but soon found the hook isn't flexible enough.
Thus I decided to rewrite the hook in ...
4
votes
2answers
66 views
Multiclassing and updating each of its component classes whenever it changes
A Multiclass character can consist of any number of component classes. For example, if Fighter, ...
4
votes
1answer
106 views
Entity class for a Slick2D game
I'm working on a game with Slick2D and am just working through the Entity class. I'm making every variable protected and then ...
0
votes
1answer
84 views
OOP PHP best practices
I've worked with PHP for a few years now and have a degree of understanding about classes / objects, but I've never written my own until now.
In that vein then, I'm looking for a bit of confirmation ...
1
vote
0answers
33 views
PHP MIMEType class
There isn't a very reliable way (in my opinion) to get the mime type of a specific extension, regardless of the file actually being of that type or not.
This type of thing usually is used when ...
2
votes
1answer
100 views
Markov text generator
This is a Markov text generator I've created in JavaScript. I'm pretty sure the term "Markov" applies, anyway.
The way the generator works is like this: it first divides the source text into unique ...
2
votes
1answer
70 views
Using a class for reading config from files
The goal of my current piece of work is to read from a global config file all the settings and then from the local file only those settings that a user has chosen.
Firstly I wrote a function but then ...
4
votes
1answer
154 views
Data model in MVC for multiple providers
I have constructed an API service that dives into a storage engine and retrieve data.
I have tried my best to apply the MVC modelling with services (repository) in mind where the controller (as it ...
7
votes
1answer
123 views
Sorting Algorithm Visualizer
Over the course of the past month I've worked on a little visualizer to show how different algorithms are sorted. I'm pretty happy with how it turned out but would be interested in any feedback ...
2
votes
0answers
32 views
JavaScript module for creating text gradients via canvas
Today I wrote a JavaScript module (with module pattern) which generate gradient texts using canvas tags. This is my first JavaScript "program" (I don't know how to call it) created for a real need.
I ...