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 (2)

3
votes
1answer
31 views

MVC'd login form

I've written this small MVC login application as an example for someone, would anyone let me know what they think of it? index ...
3
votes
0answers
22 views

YouTube video intro, and autoscroll when video ends

This code creates an intro video using the Youtube API, screen text written by JavaScript with a typewriter kind of effect. How can I rewrite this as succinct object-oriented code? Also, I'm not sure ...
5
votes
2answers
41 views

Player assignment in Tic-Tac-Toe

I am building my first OOP program, Tic Tac Toe. I want to conquer it in chunks, but the first part for me is the intialization of the program and the creation of the two players. I want to get some ...
3
votes
3answers
58 views

Device-dependent image descriptor fields

In a Java class that belongs in a library, I have a field size that indicates size of image. It must be int, but some values are ...
0
votes
0answers
73 views

A Router I coded

This is router I created for use, however, I wish to refactor this code and make this more robust. I would really appreciate anyone who can: Point out how to make this code more robust, clean and ...
5
votes
0answers
50 views

Implementing classes that should behave as Optional [migrated]

Imagine finding out if two shapes intersect. An intersection of two shapes may be either another shape, or nothing. I believe, the proper object-oriented solution would be: ...
0
votes
0answers
23 views

Python TKinter data entry window GUI for SQLITE3 table

I would like to offer for review a simple tkinter GUI window in Python 3 to be used for data entry into an SQLite database table. As a noob, this is my first attempt at OOP and my first experience ...
-4
votes
0answers
25 views
4
votes
1answer
61 views

Guess the Number Game in Python

I have been using Python to learn programming, but I am just recently beginning to utilize classes. I have a basic game below. Please review and let me know what I should improve on. ...
2
votes
0answers
85 views
+50

LiveDate version 2

LiveDate has the ability to display the current date either by asynchronously fetching the time from a server or by just using the client system date. It's only as ...
0
votes
0answers
14 views

Send Ajax Request Function v2

I would like to get a full on review on my sendAjaxRequest function. Suggestions for any improvement are always welcome! sendAjaxRequest.js ...
0
votes
0answers
38 views
+50

Expanding/contracting panel widget

Right now I'm studying OOP with js/jquery and so far upon reading tutorials over the internet and with the helping hand of google, I come up with a way to do it based on my understanding. ...
2
votes
0answers
29 views

Configuration class

This is my first serious programming effort, so I'd like some comments about what I did so far. Project structure: ...
0
votes
1answer
37 views

Rover on a grid

I have ridden to much about MVC and SOLID, so I have a mess in my head. I have written a small MVC application and I need your experience and sober mind. index.php - Start point of my app ...
2
votes
0answers
54 views

Building the HTML body view

I created a library class in CodeIgniter that handles building the HTML body view. This class builds the body, adds content and adds javascript element tags at the end. The body is built by using a ...
3
votes
1answer
50 views

Basic Java statistics class

I noticed there's some code on StackOverflow that is, to put it mildly, suboptimal. I'm posting here to see if we can provide a better solution. Here's a proposal for fixing it. The approach is to ...
0
votes
1answer
16 views

Dynamic building of URLs

I'm teaching myself Python and wanted to share this problem as my current solution feels inelegant but I'm not sure of the best way to refactor. If this sort of question isn't appropriate, leave a ...
3
votes
0answers
22 views

Derive currency conversion rates from database, keep it available in a class

I would like to know whether I applied the SOLID principle and the repository pattern the right way. My code should derive exchange rates from a database and do basic currency conversions. The ...
6
votes
1answer
67 views

Moody game characters

I've been doing some self-imposed exercises to get accustomed to Python and below is my code. ...
8
votes
4answers
815 views

Basic text-based rover game

I've made a small "rover game" similar to this one, except made in C#, using OOP, and prettier menus. Here's how it works: There is one Rover class which is ...
10
votes
2answers
940 views

First OOP in C++ - Car example

A code challenge between some friends, as I came from a Procedural way of coding, instead of using Objects. The paramaters are below: store the properties of a car colour make model ...
2
votes
1answer
45 views

Elegant way of processing an “options” parameter

In this constructor function I'm assigning everything to the proper variables. For the third parameter it accepts an options argument that contains the optional ...
4
votes
2answers
110 views

Library Management System

I have created a Library Management system. Can anyone please look at if see if there's any bad practices or if anything could be done better? Main.cpp ...
1
vote
0answers
51 views

Class Object to create objects of type Object, in a dynamic way, with magic methods

I have a project in my mind for quite some time, and it requires me to create dynamic objects. Usually, casting an array to object does the trick (e.g.: ...
4
votes
1answer
52 views

Method for calculating shipping cost

I'm trying to optimize the following method. Any suggestions on how this can be done better? The shipping cost is based on weight and the total cost of products. Following are the conditions for ...
3
votes
1answer
35 views

MySQL class that handles sanitization

I've written a MySQL class that handles sanitization of different data types. The reason I used this (and not prepared statements) is because this can be more dynamic. Prepared statmenets only ...
2
votes
2answers
32 views

Functions and a GUI for entropy-related calculations

I wrote a script with utilities for calculating the entropy of iterables and included a Tk GUI that shows a quick overview over a text's properties in real-time. (on GitHub) I tried to follow PEP 8 ...
6
votes
1answer
80 views

Separating Cats and Dogs

I'm writing an animal shelter program, which keeps a database of different classes of animals (dog, cat, monkey). Functions that create the form and add the animals are very similar (difference is two ...
8
votes
3answers
239 views

A PHP User System

This PHP User System was built with MySQLi and I also used Composer. I'm planning to improve this, and add more stuff and release it as a sort of a module for Composer. User.php (Controller File in ...
2
votes
1answer
43 views

Date validation in Java - take two

I read through and implemented the advice I received yesterday. I would, once again, really like some input on how this can be improved. e.g. encapsulation, interfaces, abstract classes etc.. Right ...
4
votes
1answer
56 views

Observer Pattern with an Observer observing multiple Subjects

Is the below a good solution for an observer to monitor multiple subjects. My only fear is that if an observer was monitoring a wide range of subjects then the update method could get quite large ...
2
votes
2answers
95 views

Program for sending emails

Disclaimer: This question is very much like the one posted here. I gathered some opinions about my options from the answer there. Here, I just want validation about the choices I'm deciding to stick ...
3
votes
1answer
46 views

Validating a User via Save Method

I'm fairly new to object oriented programming here and am trying to get my head around the best way to go about creating Users and Validating them in the system. My first attempt is below and my main ...
3
votes
0answers
66 views

Applying the copy-swap idiom to humans and employees

I came across this post which explains the copy and swap idiom. However I could not find this idiom applied to classes that have base classes. Following is my attempt of a copy-swap idiom applied to ...
3
votes
1answer
78 views

Meta-class to allow inspection of all __slots__of a class

If classes provide __slots__ and at the same time inherit from another class also providing __slots__, there is no ...
2
votes
1answer
35 views

PHP CSRF eliminator

There are three functions involved. The first Init is run before the content is parsed. The second is parseContent where the ...
2
votes
1answer
137 views

My AJAX LiveDate Object

The LiveDate object displays the live current date and has a sendAjaxRequest() function dependency to send the AJAX requests. ...
0
votes
1answer
32 views

Ruby singleton for logging

I currently have a logging setup that looks like this: ...
3
votes
1answer
49 views

Webserver for handling GET and HEAD requests

I have a programming assignment where I need to build a webserver which can handle GET and HEAD requests. My webserver is working as it should but since I'm still a newbie at Java I'm not sure about ...
1
vote
1answer
37 views

Returning Function Calls from an Array within a JavaScript Function

I'd like to use JavaScript to generate HTML. I've made a JavaScript function object that has two parameters; a string and generic object. The string is used to specify the type of HTML element you ...
5
votes
1answer
126 views

Related links for WordPress posts

I have written the following class which is part of a pagination system in Wordpress. The class works as expected and also works as expected when used in the system. Just as background, the class ...
3
votes
2answers
115 views

Service Layer Design

I have written the following service class for my application and at the moment it only contains a single method which is responsible for carrying out the necessary actions to add a new team to the ...
0
votes
0answers
15 views

Object oriented rugby analyser

I have this code which mimics a rugby match. You select a player by clicking the div (turns green), move it, and click to release (returns to default color). There is a bug, the mouse can move too ...
11
votes
2answers
168 views

Object-oriented design for Wheel of Fortune

I'm trying to design the classes for the Wheel of Fortune game in Java. The below diagram represents the classes and the interaction between them. . Below is the partial implementation of it. I ...
1
vote
1answer
71 views

PHP class for file handling and creation

This is a very simple class to handle files. It allows to access, create and modify files in the system or 2 fake files (one in memory and other similar to ...
5
votes
3answers
211 views

Savings account class and test program

My code is complete. It runs properly and produces the correct output. I did calculations by hand to check and then ran the program and it gives me the same result. I just want a second opinion. Are ...
2
votes
2answers
75 views

Validation class

Can someone help me furnish my PHP validation class? I want to reduce its size and make it easier to use. ...
10
votes
1answer
92 views

Hangman game using Java 8

I’ve been getting used to Java and I’ve written a simple hangman game using event-driven programming in Java 8. Please let me know of any improvements regarding the readability and design of the ...
2
votes
1answer
84 views

Class method to insert a record into MySQL

I'm just starting out using OOP; classes and methods etc. I've been looking around for some PDO classes/wrappers out there, but there's not much to choose from. So I've tried to make my own. Started ...
3
votes
1answer
115 views

GUI flashcard program in Java

I'm new to Java and I've written a flashcard program in Java 8 that allows the user to create a collection of flashcards and then test themselves using those flashcards. Please provide any ...