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
25 views

Javascript Class System

Warning: The code snippet does run two alerts, just so you know. I wrote a javascript class system with the idea of making declaration simple and clean and instantiation even simpler, along with ...
5
votes
2answers
74 views

PHP OOP example using animal classes

I've been reading up on OOP concepts such as: polymorphism, inheritance and encapsulation and would like to know if I am even close to using these concepts correctly. ...
8
votes
2answers
420 views

Binary Calculator in Java

I'm a beginner in Java and I tried to create a program that will perform basic arithmetic operations on binary numbers. BinaryOperations class: ...
6
votes
0answers
40 views

A reusable ProgressIndicator

There was a Tweet from @ExcelEasy earlier this week, that linked to this article, to which I replied with a little challenge: @ExcelEasy well done! #Challenge: make a more #OOP one without using ...
6
votes
2answers
65 views

Templated queue implementation

I wrote an implementation for a simple queue in C++ (for practice, since there's an stl queue). I've been trying to focus on memory management and the rule of three. Any suggestions/improvements? ...
0
votes
0answers
12 views

C code to represent a dataset and a 'window' of data

I'm fairly new to C so I'm looking to see if I'm heading in the right direction. This bit of code is to define a structure which represents a dataset (in this case, a GDAL dataset and some ...
3
votes
1answer
37 views

PHP validation class using method dispatch

I wrote this validation class. I'm kinda new to the whole OO(PHP) style, so I don't know if my class is acceptable. I looked around at other people's validation classes, but most are huge (1k+ lines ...
4
votes
3answers
86 views

Student Classroom class

I'd like to know if the following class design is good or bad: ...
3
votes
1answer
45 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
26 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
44 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
61 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
80 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
32 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
29 views
4
votes
1answer
68 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. ...
5
votes
0answers
138 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
16 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 ...
-1
votes
0answers
50 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
41 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
55 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
51 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
18 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
23 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
68 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
816 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
945 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
111 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
52 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
53 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
36 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
33 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
81 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
243 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
44 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
58 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
48 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
138 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: ...
2
votes
1answer
43 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 ...
10
votes
1answer
182 views

Recursive dragon on a canvas

I've been doing some JavaScript for fun again. This time I tried my hand at drawing the Dragon curve - a neat fractal that consists of one line traveling across the plane, never crossing itself, and ...
6
votes
1answer
188 views

Is my LoginView class valid?

I know the Model, Controller and View's purpose, but I have never really found a good concrete class example of a View class. Usually I see people having some small ...
8
votes
1answer
215 views

Game of Life - OOP and Best Practices

I always have a problem figuring out what good JavaScript coding practices and conventions are and if I'm following them, especially concerning OOP. So I implemented The Game of Life and wanted to ask ...