Tagged Questions
Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.
3
votes
0answers
46 views
PHP based 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
198 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 ...
8
votes
0answers
72 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
84 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 ...
1
vote
0answers
29 views
4
votes
2answers
478 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
24 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 ...
-3
votes
0answers
35 views
Abstract methods vs constructor parameters [closed]
I have a class that takes a lot of parameters, and to simplify things I created a child class that calls some static methods to retrieve those parameters (file names and the like):
...
-5
votes
0answers
46 views
2
votes
1answer
83 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
51 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 ...
14
votes
3answers
555 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
167 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
143 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
69 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
75 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
31 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 ...
1
vote
0answers
66 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
62 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
143 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
120 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
29 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 ...
7
votes
0answers
39 views
Polymorphic animals speak their name and make a noise
I'm new to GNU Smalltalk. I'd like to port a script I've written in Ruby, Scala, CoffeeScript, and several others. It's the one I use to try to learn the classic OOP concepts of abstract classes, ...
4
votes
2answers
145 views
Simple PHP Login Register Script with OOP
I am relatively new to programming and OOP in PHP. I tried to create a Simple Login Register Script using my basic knowledge of OOP. I'm sure my code can be better in a lot of way. I'm trying to code ...
2
votes
1answer
57 views
Large message population design
We are designing a small framework to create and send messages to external parties as a result of internal events. I am reasonably happy with the design, but I am wandering if it can be further ...
1
vote
1answer
58 views
Passing multiple JS arrays to PHP via data mapper
I'm making a project to calculate road-tax prices based on a vehicle's weight, type and vehicle's owner's province.
For that I've received data in 9 different JavaScript files, all those files ...
1
vote
0answers
29 views
Remove items, resize columns, shuffle a list
I'm at the very beginning of starting to learn object-oriented programming patterns in JavaScript and PHP. Up until now I've always coded in a purely functional pattern. I'm doing a lot of reading, ...
4
votes
0answers
56 views
+50
Object-oriented file upload handler for a CMS
I've started with a bunch of functions, made the code work, then I spent a day rewriting it in an OO way, as much as I can.
I've tried to group up the task into objects, letting the relative data go ...
6
votes
1answer
54 views
Note taking app (saves notes to an array)
I created the following app (only saves the notes in an array so no a proper note taking app). I would like to know how I would make this code more object orientated.
JSFiddle
script.js:
...
2
votes
1answer
52 views
Switching from functional jQuery code to object-oriented
I've been happily using jQuery, creating vars and binding events in my modules (which have only a little bit of JS). But recently I needed to add an anonymous functions to my code and after ...
-2
votes
1answer
71 views
Display multiple subtype objects in one page
I have a base class with 3 sub ones:
Item <-- Book, MusicCD, Software
They have some common and different properties but in the view I want to get a mixed list of them and show in one table:
...
5
votes
2answers
108 views
My Google Maps Script
I've written a script with the Google Maps JavaScript API v3.
I've ran it through JSHint and everything seems to be valid.
I'm wondering if my script has room for improvement.
Any suggestions are ...
3
votes
4answers
170 views
Using readonly field instead of private setters in struct
This is supposed to be an immutable structure representing a time-stamped value. Since it represents a physical measurement, it cannot change, and I want to make sure it really doesn't change ...
10
votes
1answer
58 views
Class used for stochastic epidemic simulations
I've developed a class used for some epidemic simulations I'm doing. Individuals are 'S' (susceptible), 'I' (infected), or 'R' (recovered). These are standard abbreviations in the research ...
2
votes
1answer
61 views
Validating input against rules
I have created a method that validates inputs based on a set of rules. If an error is found, it is put into an array which can later on be used to display the errors to the user.
Below is my code:
...
5
votes
3answers
122 views
Code redundancy issue while feeding dropdownlists
I have a dashboard to manage a learning center system. There are scenarios like admin create learning center and define a classroom in it and then assign some courses in it and assign students to ...
1
vote
1answer
65 views
Http Request/Response class
I would like to get a feedback on this. It is just a simple Response/Request classes.
I tried to keep it simple, so I made two interfaces, and two classes.
...
7
votes
2answers
84 views
Correct usage of MVVM and object for method
I'm writing my first C# Windows Store app and am learning C# from scratch. I'm trying to implement MVVM as I understand it and object orientated patterns, obviously though I'm expecting to be doing it ...
7
votes
3answers
95 views
Better card validity check in JS card game
I am writing a card game in Javascript. The game is played with a 32 card deck.
When a card is selected to be played by a user, i do a validity check on the server to check whether it matches the ...
7
votes
1answer
415 views
Math expression parser in C#
EDIT: Added refactored version 2.0 to the end!
I have a parser that is supposed to take a string similar to a math expression and return a Tuple of:
An array of strings where each string ...
9
votes
2answers
1k views
It's almost Friday, right?
This is my final post for my CS1 saga. Mostly all I had to do was just "class-ify" my past project in this post. Here are the requirements:
Make all data members private and use constructors, ...
5
votes
1answer
169 views
Drying Up Very Similar Implementations of an Interface
Work continues on the Rubberduck VBA Editor Add-in. I have a need to call some VBA code from the add-in with Application.Run. Unfortunately, the ...
3
votes
1answer
55 views
Functional organisation of JavaScript functions
In one of the web apps I contribute to, the main.js file has multiple interacting "objects". Unfortunately, I'm so bad at OOP in JavaScript, despite studying other ...
4
votes
3answers
206 views
0
votes
1answer
92 views
User Registration
I'm fairly new to PHP and am very interested in learning best practices, etc. I have just created a user registration system mostly in OOP that will dump user info into a database I've created. This ...
0
votes
2answers
55 views
Class CatalogWalker can walk thru a list of catalogs, calculate and report some statistics
Just for review and may be useful for somebody
...
1
vote
0answers
46 views
6
votes
4answers
75 views
Using PostgreSQL effectively with a banking app
I'm kind of newbie for these things but I did something and I want to know how I can do this effectively.
...
2
votes
3answers
72 views
A class which represents an SQL table
I'm representing DB tables as classes (in this case PHP classes). This has the goal of modeling every section of the web page, where you will get inputs from the user.
My actual base design is:
One ...