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

12
votes
1answer
14k views

Very simple PHP PDO class

There are many PHP PDO classes out there, agreed. However I find they do not allow for flexibility. So I created one that helps reduce development time as little as it may be but it does the job ...
7
votes
1answer
508 views

Critique Request: PHP Request-Method Class

I'm working on a general Requestmethod class which sanitizes and recasts the input of users in an automatic fashion. I've also tried to do array-access in cookies. ...
3
votes
1answer
352 views

Help improve my first PHP class

I recently started to learn more about OOP in PHP and I created a website for testing. I have 4 classes: database, user, ...
4
votes
2answers
295 views

What would be a better way of adding the functionality to “add” a student?

I have the following Student class: ...
6
votes
2answers
490 views

Minimalistic mysql db class

I am really just looking to make sure I am not making any weird mistakes that could hurt me in the long run or if something seems odd in the way I imagine it to work. This code does work for the way I ...
3
votes
1answer
333 views

Object-oriented Linux networking library

I needed to perform network communications in my Linux C++ project. I thought that it was a good idea to operate on a higher level of abstraction than raw system calls. Also I love OO design. So I'm ...
3
votes
4answers
270 views

PHP OOP coding conventions

I'm brand new at OOP PHP and I would like to get as many of the coding conventions right as fast as possible. I made this tiny guestbook script, and I would like to know if there's anything not done ...
2
votes
3answers
230 views

Am I utilizing classes and OOP efficiently?

In my last question on Stack Overflow I was a very confused newcomer about classes and OOP and how to correctly implement everything to make things easier. So I started a different example to ...
1
vote
3answers
244 views

Do the objects in this code follow OO standards?

I previously posted my first attempt at writing a program that I was given to test my skills for a position that I was interviewing for. I have rewritten the program using the excellent advice that I ...
6
votes
4answers
315 views

General advice on a practice linked_list for C++ classes/templates

Introduction I'm learning C++ (Coming from Haskell, C, and Assembly - and other languages sparsely) and this was my practice with classes and templates. It's a linked list that you can call in this ...
4
votes
2answers
78 views

Validator refactored to be OO

Based on my previous post I completely re-factored my code to make it object oriented. Anything I could improve when it comes to: Object oriented code; Efficiency; Readability. Any other ...
1
vote
4answers
838 views

Javascript effective code structure

What would be the best (performance, memory wise) to achieve a clean way to create a class or some way to properly structure the code, that shares 2 variables (req, res) which have a decent object ...
1
vote
2answers
2k views

Is this good class design (OOP PHP)?

Explained what I'm doing in the comments: ...
11
votes
1answer
517 views

Problem: Traffic Flow

I have the following task: The Shallow Alto city council has organized a special committee to review the traffic situation in the city. Despite the fact that there is nothing whatsoever to do ...
10
votes
3answers
357 views

Design pattern for implementing multiple data sources

I've written a program to populate a particular object from multiple data sources, however I'm not convinced I'm going about this in the right way: I have no idea which (if any) design pattern I ...
5
votes
3answers
781 views

Win Forms design pattern

I am writing a dice roller win forms application using C# 2012 VS. Dice roller is set up for playing Shadowrun table top. I feel that there might be too much code going into the GUI, but I am unsure ...
4
votes
2answers
677 views

Is this a bad way of setting properties inside of a class PHP

Instead of using multiple setter functions within a class like public function setAction() public function setMethod() etc I've been using a method from a base ...
4
votes
2answers
2k views

Small MVC for PHP

The following is a new question based on answers from here: Small PHP MVC Template I have written a small MVC template library that I would like some critiques on. The library is located here ...
3
votes
2answers
316 views

Classes and variables in PHP

First of all, I'm trying to learn OOP PHP, so any advise will be great. My idea is to create some kind of MVC Framework CMS kind of thing, just to learn OOP PHP and MVC well. Let's say that I've got ...
3
votes
3answers
209 views

Refactoring a class hierarchy to remove subclasses

I have the following class inheritances hierarchy: First the abstract parent class: ...
12
votes
1answer
72 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 ...
9
votes
2answers
344 views

Implementation of the Strategy Pattern using an interface, abstract class and delegate

The following class was designed to help create a more detailed error message than what's provided by the repository when a user tries to insert text into a column that is > the column max length. The ...
8
votes
3answers
105 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 ...
5
votes
1answer
605 views

Generic method for database calls

Background Breaking from MVC, I've implemented the following architecture: POST/GET ➤ PHP ➤ Database Calls ➤ XML ➤ XSLT ➤ HTML All database interactions are ...
3
votes
3answers
277 views

PHP Simple OOP Class

I am still learning OOP and I need a little help, I don't really know how to properly make this not look so terrible. Any thoughts? ...
3
votes
1answer
362 views

How to convert my classes to Dependency injection?

I am still learning to develop my skills in OOP. It uses a combination of the factory and its real singletons? As I did more research, I have realized this design pattern is bad because of global ...
2
votes
1answer
42 views

Validator extended to handle domain objects / entities

I started improving my validator library even more, and I think I'm at the last final element (domain object / entity validations) before I can gladly say that my Validator library is completely done ...
2
votes
1answer
555 views

A PHP MVC class

I had asked a first question about this class a while ago and got a few answers here which made me rewrite it completely. I removed all statics and globals, added my variables as arguments for the ...
2
votes
1answer
1k views

FileMaker PHP API Interface

I have written this piece of code to help the development of FileMaker developers having to use the dog-awful PHP API. ...
9
votes
4answers
576 views

Clean and well-designed Tic-Tac-Toe game

My design goal was to try and make a "clean" and well-designed Tic-Tac-Toe game but also to try and use concepts and programming constructs that I'm new to. I'm planning to implement an "AI Player" ...
7
votes
2answers
524 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 ...
7
votes
4answers
400 views

Tic-Tac-Toe design

Kindly look at this code and point out design flaws or areas for improvement. I think I've done the last part right (the enum). I think the rest of the design is flawed but I am very new to ...
6
votes
2answers
322 views

Singleton design pattern

I am a beginner in PHP-OOP and design patterns. I have got this basic piece of code in Singleton Pattern and I changed it in order to understand its behavior. I can see that it works as expected. ...
6
votes
1answer
110 views

How should I implement my domain model?

My domain model consists mostly of simple DTOs, i.e. 'Data Transfer Objects' which this article distinguishes from 'Plain Old C# Objects', like this one: ...
6
votes
2answers
219 views

Sprite animation for a game

I'm just getting started with XNA and game development in general. I followed these instructions to create a basic game, then this article to get sprite animations working. Now, I'm trying to ...
6
votes
3answers
1k views

Dynamic Array Written in C

I'm learning C. Specifically, OOP in C. As a practice, I wrote a dynamically expanding array. So far, this is how the code looks: dynarray.h ...
5
votes
1answer
56 views
5
votes
2answers
89 views

Converting bootstrap file from procedural code to OOP

My bootstrap file contained procedural code, but after stumbling upon this answer I tried to make my bootstrap object oriented. This is my attempt so far, and I have a feeling that I'm failing at it. ...
5
votes
1answer
201 views

Airline/Hotel reservation system in Python

I am trying to teach myself OOP in Python. I am picking up some projects from GitHub and trying it out on my own. I wrote a Airline/Hotel Reservation System, where I want to maintain the customer ...
5
votes
2answers
115 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 ...
5
votes
2answers
152 views

When an object has different representations… what's the OO pattern?

I've an AbstractMessage object (a hierarchy, actually). It represents a small text message and can be sent using different transport methods: HTTP, REST and a ...
4
votes
3answers
308 views

Simple spin game

I see many many programs that are written out of the main method. But most of my programs are written in main() and access some ...
4
votes
3answers
1k views

OOP PHP form ok?

I am new at OOP and I wonder if the code below is OOP or it can be better and also what can be better? ...
3
votes
1answer
72 views

Validator Readability and Efficiency

This is my first validator I have created myself and I was wondering if there is anything about it that I could improve as far as: Code readability Code efficiency Note: The reason why I put an ...
3
votes
1answer
103 views

Employee wage/salary calculation MVP solution - follow-up

This is a follow-up to this post. In this project (C# Win forms) I'm supposed to calculate wages of employees. These are the steps: Calculate earnings from Attendance data. Here all regular ...
3
votes
1answer
75 views

How could I have approached this responsive image gallery differently?

This gallery uses the Orbit gallery from the Foundation framework (version 3). I've set it up so that on smaller screens it appears as an accordion. It works just fine, but is there a more concise ...
3
votes
2answers
115 views

Structure of API wrapper

I'm building an API wrapper for a bookkeeping SOAP API. I have some questions regarding bast practice for structure of the wrapper and for error handling. For now i've structured it like this: ...
3
votes
1answer
124 views

Needs code review for class implementation

could you please review the code for the implementation of the class (link: Ruby. Code review. Working alone on the code) ...
3
votes
1answer
1k views

PHP Config Class

I'm working on a config class for PHP, where I can easily bring in config options. Any improvements/suggestions are appreciated. Example usage: ...
2
votes
1answer
143 views

Router for MVC framework: Is it OO and good to go?

Am I utilizing dependency injection correctly? Any parts of my class that I should decouple? Anything I could improve in my code when it comes to OO PHP (and MVC)? The class routes URLs based on ...