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)

0
votes
0answers
8 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
22 views

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. ...
-5
votes
0answers
36 views

My C++ Programming Final. What do you think? [on hold]

My final requires me to create a class Human with constructors, accessors, and mutators, as well as to allow user input and to output a description of each object to the screen. I was hoping to get ...
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
34 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
49 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
44 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
10 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
20 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
62 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
804 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
931 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
103 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
48 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
33 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
77 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 ...
6
votes
3answers
188 views
+50

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
42 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
55 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
43 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
65 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
77 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
34 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
136 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
31 views

Ruby singleton for logging

I currently have a logging setup that looks like this: ...
3
votes
1answer
48 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
111 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
162 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
66 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
194 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
91 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
82 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
114 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 ...
1
vote
2answers
83 views

Predicate builder [closed]

I have a predicate builder that initially evaluates to false. Because of this, the very next expression should be a logical Or. ...
2
votes
0answers
28 views

Comparison of sprite movement implementations

I've come up with two ways to do sprite movement with CreateJS, and I'm wondering if one is better than the other as far as performance and maintainability. The player data is saved in a json file ...
1
vote
1answer
49 views

Creating and sending a Fixed-Width file

This function will run every x seconds. PAN: The name we are calling our fixed width file we are transmitting. ...
3
votes
1answer
88 views

My Google Maps Script v3

My Google Maps Script v2 I re-factored my code to be more OO. Does it have any more room for improvement (naming, readability, oop, etc.)? I'm importing ...
-1
votes
4answers
189 views

Finding the lowest terms for fractions in C#

I have been working on this Rational Operations calculator where you can input two rational numbers and can add, subtract, multiply and divide and the final output is the reduced answer. For example: ...
3
votes
2answers
89 views

Assembler for Hack Assembly Language - Take 2

I have been reading this great book and I decided to do the Project in Chapter 5: Writing an Assembler for the Hack Assembly Language. You can find the specification for the Hack Machine Language and ...
3
votes
2answers
64 views

My Google Maps Script v2

My Google Maps Script v1 Using the Google Maps JavaScript API v3. Does my script have any room for improvement (naming, readability, oop, etc.)? I'm going to pair it with some live time ...
3
votes
3answers
80 views

Simple list comprehension

As far as I can tell, there is no network access happening at this stage in the code. I am accessing Reddit's API via the PRAW module. However, it is crawling, and I think it should be faster, ...