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

2
votes
1answer
24 views

Object-oriented implementation of a real-world scenario of using a bathroom

Is there any object oriented way or design pattern I can use to make this code better? How can I avoid casting in this code? What if I add new Object like WaterTank ...
2
votes
1answer
17 views

Bookshelf with Sorting, Categories and File I/O

I've been working on a project originally for school regarding object-oriented design, where I was supposed to write a class for a book and a bookshelf, and then have a driver class to add a couple ...
0
votes
0answers
12 views

Creating Numeric Battle System Backend in Java [on hold]

I've been trying to debug this simple battle system I've been attempting to achieve. I'm at a severely basic level and have made a debugging main file to figure out the source of the problem. The main ...
1
vote
2answers
24 views

Web crawler class

I'm using my crawler class in the following manner and I'm beginning to think it's bad practice: crawler.py ...
1
vote
0answers
28 views

Symfony2 (2.7), Embedded Forms, Persist failure

I am trying to implement Embedded Forms (Symfony2, 2.7), with a three layers situation: Job, Task and Tag entities, One2Many relationships. So, what I am trying is just to develop a very basic web ...
4
votes
0answers
55 views

C# Wa-Tor Simulation - Making my code more object oriented

I tried this as a programming exercise. Its working as intended, but I feel like the code is a mess and I could have used the advantages of object oriented programming much more (like inheritance for ...
9
votes
5answers
708 views
+50

Enter my Matrix

Here is my next Java assignment: create a Matrix class that can add and multiply two matrices together. I was given some code as a skeleton and then fleshed it out ...
-3
votes
0answers
53 views

C++ Interfaces and Design Principles [on hold]

How does a SOLID compliant interface in C++ could be implemented? For example, is this design below SOLID compliant? I have several questions: In the Car ...
-3
votes
1answer
61 views

Message validation rules

I wonder if I should divide this class into two, since it contains two "ifs" with different messages. Would breaking it down be in keeping with the "S" of SOLID? ...
1
vote
2answers
38 views

Sorting an object array

I've created a class called Box that is pretty much what it sounds like. I want to sort these box objects, and I have created a function to do so. ...
0
votes
0answers
40 views

Class for easier localStorage use

As simple as the title, the following code is just a simple class for ease of use with localStorage. I'm just looking for recommendations in clean up, ideas of things to ad, constructive criticisms ...
2
votes
1answer
42 views

Custom countdown second timer

I'm making a card game and I found useful to include a 60 second countdown timer. Here is my approach: ...
29
votes
4answers
4k views

OO coffee dispenser

This picture inspired a contest between a few of my friends to rewrite this code in more proper OO style. This is what I have come up with. Any thoughts: ...
1
vote
0answers
88 views

Does my code still break encapsulation and uses getters/setters instead of the TellDontAsk principle? [migrated]

I and one guy have been discussing potential solution of a problem on an unrelated board, regarding the typical getter/setter hate, ie. using getters/setters leads to procedural programming. I ...
3
votes
1answer
73 views

Object-oriented web scraping with Python

I usually write function-only Python programs, but have decided on an OOP approach (my first thereof) for my current program, a web-scraper. Here is the working code I wrote which I am looking to have ...
10
votes
3answers
1k views

PIN class with SOLID principles

I wrote this Pin class as a part of a project to learn SOLID. What do you think about it and what can be made better? Interface ...
3
votes
2answers
48 views

Data Table Report Class

Most of the VBA I write is to produce tabulated reports from spreadsheet data. So, here is my attempt at creating a CLS_Data_Report class. Properties: a ...
4
votes
1answer
44 views

Simple Ruby program to model a prepaid transit card system

I have written a simple Ruby program to model a transit card system which aims to address the following user stories. I wanted to see whether I could get any feedback on it. My main interest is ...
0
votes
0answers
26 views

Memory management in Python with thousands of sequential instantiations [closed]

Given a spreadsheet of a few thousand URLs, I will loop over them and for each, instantiate a Page() class then call two methods, the first to get the page, the ...
0
votes
1answer
34 views

Implementation of bridge design pattern for a web scraping app - follow-up

Earlier today I tried to implement an example of the bridge design pattern, but I ended up misinterpreting it. I made a lot of changes: ...
-1
votes
0answers
19 views

Returning a pointer from a class member [closed]

I have two classes Person and Student with Person being the base class and Student being the derived class. The question states that I must within the Student() operator when a student member is ...
0
votes
1answer
47 views

Application container design

I'm putting together a simple application container for learning purposes, and I would like to hear how you see this code. The application is the main class that will contain services, configuration ...
4
votes
2answers
72 views

Search word in multiple files

I am writing a brute-force method to search for a word. Please review my code and tell me how I can improve it. ...
4
votes
2answers
75 views

Binary search tree in Java with only one class

I have written a BST using one class. Is my code okey or something could be better? ...
1
vote
2answers
56 views

Calculating unknown parts of a right triangle

I am in the process of creating a program that allows a user to input known parts of a right triangle and the calculates all of the unknown parts if it is possible. I am using a class that I wrote in ...
1
vote
0answers
27 views

Use of HTML (view) in a constructor

I have this constructor (from a Service) where I'm setting a few variables, but two of them include HTML. Is there a best way to set those values, maybe by creating a method in the class to set them? ...
2
votes
3answers
62 views

Calculating a payment price based on a selected phone

The program shows three phones with prices, and you need to select one of them. The program will then calculate the price based on the payment type you selected. I'm very new to the world of OOP, and ...
1
vote
1answer
31 views

Keeping object consistence at its creation

Let's assume I have 2 objects Product and Volume. 1 Product must have at least 1 ...
3
votes
1answer
63 views

Creating a lightweight strongly-typed parameter infrastructure

I'm looking for some feedback on some code, designed to allow me to strongly-type parameters, which get passed to functions. I'm only really looking for comments on making my parameters more strongly ...
3
votes
1answer
68 views

Implementing a Time class in c++

Design a class TIME which stores hour, minute and second. The class should have the methods to support the following: User may give the time value in 24-hour format. User may give ...
7
votes
1answer
57 views

Assembler listings parser components: Operands parser

I'm building the above mentioned parser. It reads a string of assembler instructions. I want to become a better coder, so I wanted to get a code review to start learning to do things property. As we ...
2
votes
1answer
39 views

Using a class to create a custom wrapper for including files

I am using PHP in order to create a custom wrapper for including files, for this I have written this class: ...
8
votes
2answers
285 views

Bridge, We've Got a Problemo

Now that we can move across the bridge, it's time to finally set up the problem so that it can be solved. A reminder of what the assignment is: Welcome to the Bridge Crossing Problem. Person Pn ...
2
votes
0answers
39 views

Object-oriented WordPress plugin

Note: This plugin is / was never intended to be submitted to repo just for personal use but the questions still apply to general Plugin Development. This plugin listens for ...
-2
votes
0answers
33 views

Solving a system with 2 linear equations with 2 unknowns

This code finds the solutions of a system of 2 linear equations. I used Kramer's rule to find the unknowns, but I wanted to do this using classes. I don't know if this is the right way to use ...
3
votes
1answer
27 views

Classes for attributes validation

I have two classes responsible for attributes validation: ...
2
votes
1answer
88 views

Singleton Class for WordPress Plugin

I'm developing a WordPress plugin using the singleton pattern with the following requirements: There should ever exist one instance of the plugin Another instance of the object should never be ...
6
votes
2answers
106 views

Moving across my (sturdier?) Bridge

Building on top of the classes in this question of mine, I've made this class to support the moving of the entities for my given assignment: Welcome to the Bridge Crossing Problem. Person Pn can ...
4
votes
1answer
117 views

Multiple-configurations class for practice and later use

I wrote an abstract Configuration class, then an ConnectionConfiguration class and then an ...
7
votes
1answer
104 views

Connect Four - Console Application

I have attempted to make the classic game Connect Four in C++, and I would love some feedback on this project. I have done everything myself without using the help of a tutorial or guide, so sorry if ...
4
votes
2answers
59 views

Rendering HTML for a navigation menu using a class

Below I have implemented a class that will generate HTML to build the structure for a navigation menu. ...
8
votes
1answer
97 views

I think my Bridge's foundation is too fragile

I've just started a new class learning Java, and since it's been a long time since I've programmed in it I thought I'd put up my first project to get back in the swing of things. Here is my first ...
3
votes
1answer
57 views

Fibonacci using OOP methods in Java

I made a simple program that uses OOP methods. Please tell me if I used the 4 methods right. And if not, please show me how. ...
1
vote
0answers
16 views

Identify and provide a list of commands whose execution will synchronize an “official” list of objects with a “personal” list of objects

Is the intent of this code obvious / clear? Please suggest any improvements. This happens to be TypeScript, but is probably pretty familiar to anyone in the Java/C# world. These are both private ...
1
vote
1answer
82 views

PHP/MySQL - OOP database class

I use this database class in a CMS, just a project to learn OOP. Would like to have some review on how to improve it, what should I change, add, remove? ...
3
votes
2answers
61 views

Object oriented architecture with an image processing code

This code is python 3X code (in django). It takes an instance of user entry, and process images: it creates a resized version of original image, 2 thumbs, saves all, and update instance fields to ...
11
votes
2answers
86 views

Minesweeper implementation

Please review my implementation of the Minesweeper game Kata. Any and all feedback will be much appreciated. I would love to hear your feedback on readability, simplicity, performance, and any code ...
7
votes
1answer
70 views

VBA Class to persist and restore Excel Application properties

Very often on Stack Overflow, and even on Code Review, I've seen questions and answers that have code that begins by persisting Excel properties like DisplayAlerts ...
5
votes
0answers
50 views

Object-Oriented Chess Game in Ruby

I wrote a chess game in Ruby using object-oriented principles. One of the challenges was deciding which particular methods/actions belonged to a particular class, as there were some that felt as if ...
1
vote
1answer
57 views

Converting long list of if/else [closed]

In order to convert a code such as: ...