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)

1
vote
0answers
15 views

Meta-class to allow inspection of all __slots__of a class in Python

If classes provide __slots__ and at the same time inherit from another class also providing __slots__, there is no ...
2
votes
1answer
29 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
0answers
66 views
+50

My AJAX LiveDateTime Object

The following JS code object displays the date and time and updates whenever it changes. It has a sendAjaxRequest() function dependency to send the AJAX requests. ...
-2
votes
0answers
29 views

Pygame implementation of pong [on hold]

Recently, I have been working on a pong game in python using pygame. I have a complete basic game. At the moment, I am looking for a way to improve the code and the game. Here is the code (it is ...
0
votes
1answer
24 views

Ruby singleton for logging

I currently have a logging setup that looks like this: ...
-3
votes
0answers
23 views

Runtime inheritance in Python [closed]

I would like to support inheritance at runtime. For example, accepting user input to tell it which class to inherit from. Here's what I've done, it works, but I'm unsure if it's the right solution: ...
3
votes
1answer
43 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 ...
0
votes
0answers
15 views

Remove elements from an array [closed]

I'm trying to do a code which works with arrays, the thing is that I need to do a method delete(Object e) which has to delete all the objects in the array that equals "e", the thing is that I can't ...
1
vote
1answer
36 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
103 views
+50

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
94 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
147 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
0answers
39 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
120 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
69 views

Validation class

Can someone help me furnish my PHP validation class? I want to reduce its size and make it easier to use. ...
9
votes
1answer
85 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
72 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
100 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
74 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
66 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
181 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
82 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
57 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
76 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, ...
4
votes
0answers
58 views

Building Data abstraction and ADT for rectangle using “objects”

For the below given exercise: Exercise 7: Abstracting Rectangles Implement a representation for rectangles in a plane. (Hint: You may want to make use of your procedures from exercise 5). ...
3
votes
2answers
93 views

Email Template Parser PHP Class

This is a very basic PHP class that I am working on which will allow me to provide an HTML template in the form of a string saved to a variable or into an actual template file. I can then pass into ...
9
votes
2answers
272 views

Decomposing the animal kingdom

I have implemented a Mammal class hierarchy in Java. Is it an intelligent approach, with respect to decomposition, locality and procedural abstraction? ...
2
votes
0answers
47 views

Simple Java MIDI player followup

This is my second iteration of a simple Java MIDI player. I've made several amendments and would like to see if the code is now correctly implemented and readable. This follows on from the first ...
3
votes
1answer
49 views

Form builder class

I am trying to learn OOP in PHP. My PHP knowledge is pretty good, but haven't tried OOP before. I'm currently building a formbuilder class. Can you take a look and tell me if this is the right way? ...
6
votes
1answer
53 views

Simple Java MIDI player

I created a simple program that allows you to create and play MIDI sounds. I've used the MVC approach and I’d like to know if there are any improvements to be made regarding the design and structure ...
1
vote
1answer
45 views

Building Data abstraction for line segments using “objects”

I follow this definition of "object":...
3
votes
1answer
54 views

Matchmaking system - sorting musicians by skills, genres, and location

I'm making a matchmaking system using PHP and MySQL which allows users to search through a list of musicians so that they can find people with the right skills and interests who are near them. It ...
2
votes
2answers
59 views

Fraction Class in Python

I decided to train myself in OOP with a simple perfect precision Fraction class. ...
1
vote
0answers
38 views

Parsing a logic formula

I recently made a little program which task is to parse a logic formula (given in conjunctive normal form) I do the parsing with reloaded operator>> but I am ...
0
votes
0answers
30 views

Object Oriented design - connection to multiple databases

I have a Python application which uses both SQLite and Postgresql. It has a connector class for each database: ...
11
votes
7answers
942 views

Mathematical functions on fractions

I have been challenged by @nhgrif to write a Fraction class to better my understanding of OOP. I have found an interesting challenge here (I apologize that the source is not mentioned, I was not able ...
1
vote
1answer
57 views

Serializing user data to send to another API

I'm trying to improve my OOP skills in PHP. One of my projects requires me to get user info from one API and send it to another API with a different structure. I will use a simplified situation, but ...
17
votes
2answers
602 views

Designing another Coffee Machine Application

After reading Designing a coffee machine yesterday, I decided I could also give the same problem a try. I have used the following problem statement (copied from the given question): Design a ...
-2
votes
0answers
29 views

What is more efficient in constructing PHP classes? [migrated]

For each of a bunch of records from my database I instantiate a class. Inside that class I call another class. Example ...
27
votes
5answers
3k views

Designing a coffee machine

I was recently rejected from what looked like a really promising string of interviews. I did very well in a questionnaire style review, and then they handed me this assignment (more or less): ...
1
vote
0answers
28 views

Imgur API implementation using Retrofit

I've recently (an hour ago) started a project for making a wrapper for Imgur's API using the REST client Retrofit. I've only implemented a single endpoint so far as I'm questioning my design. While ...
2
votes
1answer
101 views

Database Access Object Class

I learned of the Database Access Object design pattern from a friend and decided to implement it recently to my MySQL database. The code uses MySQLi to connect to the Database, and uses prepared ...
3
votes
1answer
57 views

OOP Blackjack game

I made this Blackjack game to help me learn the syntax of JavaScript classes and objects. As I was writing the game I felt like I was misusing the idea of oop. By that I mean I felt like some of the ...
2
votes
1answer
135 views

Indexed Properties in C#

I was challenged to implement a mechanmism to support indexed properties in a class structure. I wanted to avoid the need to implement an abstract property indexer class every time you want to ...
3
votes
0answers
79 views

Laravel controller for a commenting system

Can someone review my Controller? I should follow these guidelines: Code should be written with MVC pattern and to use OOP. The code now works fine, but I need to improve it. Also, should I use ...
4
votes
2answers
311 views

Amazon web scraper

I am trying to improve my programming and programming design skills (poor at the moment). I created a small Amazon scraper program. It is a working program. I would be very grateful if you could ...
1
vote
1answer
42 views

Interface injection and common functionality between classes

I'm trying to get my head around the OOP principles and coding my own classes. As a means to learn, I have decided to convert a couple of functions I have written in Wordpress to OOP classes. These ...