Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.

learn more… | top users | synonyms

1
vote
1answer
47 views

Creating a Party Game to learn OOP

I've been developing sites using Dreamweaver for the last 15 years, I do a lot of code editing manually so I have quite a good knowledge of the PHP language. I'm diving into object orientated ...
0
votes
1answer
16 views

Registering multiple keypresses simultaneously, very slow

I'm working on a Pong game and right now I'm working on being able to register multiple KeyDown presses simulatenously. I used the Win32 native method ...
5
votes
1answer
38 views

A simple web-app code - user registration. Is the layering ok?

So knowing the little pieces is something different and putting them together is something different. Here is the code where I try to follow good oop practices and 3 - layered structure. Any ...
4
votes
2answers
88 views

OOP between projects

So, I wanted a separate project to act as the data layer for my website project. Classes in the website should reference the data layer after getting input from the user and should get back ...
5
votes
3answers
92 views

Creating date strings and setting dates

I've created a Java class, Date, in which I basically create date strings and set dates. Is there anything I can do besides adding comments to improve/shorten my ...
5
votes
2answers
61 views

Avoiding globals in gumball machine class

I'm planning to transition from years of forced procedural programming to OOP. I decided I'd start off small with a little gumball machine object to get my bearings. Everything seems to run ok, but I ...
0
votes
2answers
88 views

Tic-Tac-Toe implementation where computer should not lose

I have implemented Tic-Tac-Toe so that human can play with the computer, where the computer should never lose. I did a simple analysis before implementing, and I found out that there are certain ...
4
votes
1answer
43 views

Should I differentiate object types by calling methods via variables?

I have three JavaScript objects. The first one serves merely as a prototype. The other two are implementation of a specific type. ...
5
votes
1answer
70 views

UK tax calculator

I'm very much on the beginner end of the PHP scale but I have read plenty of the entry level books and completed the online training at teamtreehouse.com so I know the basics. I'm at a point where ...
4
votes
1answer
93 views

Throw exception in favor of an error?

I've been reviewing my previous projects for the last few days. I've found that I never return an error from any of my methods. I always throw exceptions. I googled about exceptions vs errors and I ...
0
votes
1answer
38 views

Class that handles header and footer includes looks like a mess

I tried making a class that handles my header and footer of my site. It looks like a mess, because I like to preserve the indentations as is. But I'm wondering if there maybe is an even cleaner or ...
1
vote
0answers
35 views

My database class extends MySQLi

The following is a small class I extended MySQLi with. I'm going to use this in my upcoming projects, but my main reason to do this class is learning, so I would like to submit this for your review, ...
4
votes
2answers
62 views

Reduce similar methods via pattern?

I've put together a simple application in order for me to learn sqlite and OOP in PHP. The application basically outputs two random words, e.g. "Angry Badger", from two database tables, one called ...
4
votes
3answers
356 views

Basic JavaScript OOP model object

I'm relatively new to JavaScript OOP and would like to know the best practice when doing a simple object such as a Model. Here's a piece of code representing class named "Child". What I'm asking for ...
3
votes
1answer
65 views

Redunancy Issues in PHP Class

I've been studying PHP for a while now and decided to dive into OOP. Most of my code was a mess and I've begun to refactor much of the website to OOP; however, I'm having an issue with redundancy in ...
3
votes
1answer
26 views

Re-writing rough JS code with loads of jQuery plugins

I want to include about 10 jQuery plugins in a project but do so in a better way than just pasting them into a JS file. I want to capture various device data and other data passed from the ...
4
votes
0answers
34 views

Making a FileHandler more OOP friendly using SOLID

I have a class created for the sole purpose is to help handle files. The class holds a path(folder) that contains a single file at a time. Some extra properties to this class are: age of a file and ...
5
votes
4answers
126 views

Neatest way of including a header and footer on every page

I just got into Object Oriented Programming, and it made me think about certain code how I can make them as efficient as possible. Right now I am just including my header and footer like the ...
2
votes
3answers
79 views

Color vision checkup

I have this old project I wrote years ago and it's all classes and methods all over the place. I am trying to learn/understand how I can apply a more OOP principle. It is very large and can't paste ...
3
votes
1answer
30 views

System for tracking stock information

Background: I'm designing a system (VB/WinForms) that uses a database(MS SQL Server 2008 R2) to track people, their stock account #'s, which stocks they are investing in, and the payout of those ...
1
vote
1answer
28 views

object oriented Node.js class RiddleInfo.js

So I am trying to make a Object oriented Node.js class for store information about riddles. Please feel free to be harsh as possible. Would love to hear your ideas about how to make this class better! ...
9
votes
4answers
276 views

Tic-Tac-Toe feedback requested

I just started learning coding about 4 months ago, I think Tic-tac-toe was the first application that I've ever written in C# not counting the mandatory "Hello, World!". So for me, I really wanted ...
5
votes
2answers
184 views

How best to keep track of an unknown number of objects?

I have a manager class that will manage an unknown number of objects. I'm currently storing the objects in a NSMutableArray object, and when I need to find one, I ...
1
vote
1answer
62 views

Is this way of passing a parameter relatively safe? [closed]

I'm still playing with how I want to build the parameter. However, in the end I still want to pass it to the prepare statement the same. Note: $this->dbh is ...
7
votes
1answer
86 views

interactive slider

Task: Create an interactive slider that allows the user to view a given image gallery. Slider controls: See previous slide See next slide Quick navigation through the images / Paging - ...
12
votes
1answer
66 views

RPSLSMB OOP Version 2

Rock Paper Lizard Spock Monkey Banana My original post Based off of Malachi's post I've changed the way rules work in this version to allow ties to result in double loss or double win. While ...
6
votes
1answer
111 views

My first project using namespaces

I have to create some APIs for a online game and I decided to learn to use namespaces correctly. I used the factory pattern, then the loadModule method checks if ...
-2
votes
1answer
53 views

Conways' Game of Life not working as it should [closed]

I made a topic earlier about optimizations and feedback on my Conway's Game of Life implementation, I've made some changes to the code now based on the earlier feedback and I've primarily changed the ...
4
votes
2answers
99 views

OOP Simple Contact Form

Here is my Code. But I feel that my code isn't really that much object oriented. There is a small piece of "styling" in it aswell, the "message error" thing at the end. Should that be in my class ...
10
votes
1answer
137 views

Refractoring OOP vs. Functional Programming Approach

I am writing a python script that will call mandrills export activity api for every blog on a worpress mu install except for the main site. The script is designed to be called from a cron job on a ...
-2
votes
0answers
22 views

A module which is used by most other modules [migrated]

I am pursuing object oriented design. So we don't want to use globals but yet sometime we have a module that most other modules use. This means we have to just pass it to all other modules and this ...
7
votes
2answers
510 views

Feedback on my Conway's Game of Life

I've been programming for about 4 months now, just trying to learn by myself. I've tried my way with coding the Game of Life here, would like some general feedback as well as some pointers on how I ...
4
votes
1answer
101 views

How is OOP achieved with configuration files in PHP?

Someone asked if their singleton is good for OOP: Using a singleton class to get and set program wide settings. However, the answer just provides tweaks to his existing code - but the question ...
3
votes
1answer
80 views

How to go from Spaghetti PHP OOP to SOLID OOP?

I am beyond stuck in a half way point between PHP structural and OOP, but I can never achieve proper SOLID patterns despite reading DI, IOC, and reading about the interfaces. Rather than to read ...
4
votes
3answers
299 views

Nested class or two separate classes?

I am making this program that is going to calculate distance from randomly generated dots (with x and y coordinates) to 5 bigger ones and then its going to put each smaller dot into the group with ...
3
votes
1answer
44 views

Utility object for setTimeout

I was using setTimeouts for a project where a callback will be called after a duration, but the user has the options of extending, pausing or stopping the timeout. I felt using the default setTimeout ...
8
votes
3answers
95 views

RPSLS refactored to Object Oriented

I wrote a couple reviews for this CR post. In my most recent review, I refactored @Malachi 's code to fit OO design. I'm looking for any advice/hints/criticisms on it. A Review is welcome for both ...
9
votes
3answers
181 views

Updating Grid on Webpage (new version)

Task: Draw a grid with a given number of rows and columns. Each cell can be any color. The same grid should also be updated at a predetermined time interval. The grid should cover the entire ...
5
votes
2answers
113 views

Updating Grid on Webpage

Task: Draw a grid with a given number of rows and columns. Each cell can be any color. The same grid should also be updated at a predetermined time interval. The grid should cover the ...
0
votes
0answers
20 views

Using one parent model and other extending it in PHP framework

I have multiple models which all have the same functions in it in my framework. So I decided to create one "parent" model and all of my other models would extend and inherit its functions like: ...
2
votes
1answer
95 views

Simple application to experience encapsulation

Looking at the code, is this a proper example of encapsulation? additionalComputer.php (class) ...
4
votes
1answer
132 views

OOP UserAuthenticator Class

I've been a PHP procedural programmer for several years but I'm trying to learn OOP and I'm getting a bit confused with some patterns and principles. I would appreciate it if you could give me some ...
5
votes
2answers
75 views

Binary Tree/Knowledge Base design C++

Currently I have a binary tree template setup where my main is using it with strings to make a question/answer game. I'm using a knowledge base that works as an interface to the binary tree that main ...
14
votes
4answers
671 views

Modelling a Call Center

This is the requirement I have (from the book: Cracking the Coding Interview) Imagine you have a call center with three levels of employees: fresher, technical lead (TL), and product manager (PM). ...
2
votes
1answer
49 views

Prototype OO-style of my THREE.JS application

For several months I'm working with JavaScript and THREE.JS library. Firstly I dislike the prototype-based programming because I have to work a lot of with ...
0
votes
0answers
27 views

Classes to iterate over millions of records, performing calculations and comparisons on each

I'm converting a PHP written with a lot of procedural loops to classes. There is a hierarchy of nested information represented in nested associative arrays. The actual records are from currency ...
1
vote
1answer
47 views

Is this a model? What is controlling it (controller?) and how does the data get to the view?

My goal is to instantiate a class based on the request and call a method on it based on the request verb. The classes I'm referring to will have methods such as ...
6
votes
4answers
759 views

Making a word processor

The Word Processor I had in mind would be similar to Microsoft's word and OpenOffice. I am trying to keep my logic separated from the User Interface and that separated from the controller, basically ...
11
votes
2answers
175 views

UltimateTicTacToe - ActionScript Style!

In an effort to complete this month's code challenge, I've started off with the basics. Below I have for review, a class that I can call to create the square/button a user would click to mark a spot ...
4
votes
2answers
76 views

Does this generic query follow good OOP standards?

I am trying to convert over to MySQLi and wanted expert advice. Is the enclosed code 100% OOP. Also, how secure is the code against attacks? I know nothing is 100% secure, but how good/safe is it? ...