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)

7
votes
4answers
1k views

C++ quiz game with 25 questions

I created a quiz game program with 25 questions, 4 answer choices, correct answer and 4 points awarded per question. I realize this code isn't the best; I am still a beginner and this is my first ...
0
votes
0answers
19 views

Responsibility to Validate Move in chess game? [on hold]

I came across couple of software LLD to design chess game. I have a specific question where behavior to validateMove of pieces should lie ? Should it be part of piece class or validator class ? Per ...
3
votes
1answer
43 views

Managing documents with manager class

So I have a program that visualizes data from files (csv,txt,etc.). These files are saved to database as individual tables. In my application I have DocumentExplorer...
5
votes
0answers
37 views

Battleships Player vs Computer Algorithm

I am a Year 12 student studying CS for my A-Levels. I have had previous Python experience but it is obviously not to professional/industry standard. Therefore, my goal for this review is for my code ...
2
votes
1answer
45 views

Simple class to mimic a dynamic array

for my c++ class I was asked to write a class with the following characteristics: Implement a vector replacement that operates only on integers (you don't need to use templates like the normal STL)...
3
votes
1answer
42 views

List abstraction using array

Following this reference, below is the list abstraction implementation using array, ...
5
votes
4answers
106 views

Loosely coupled movement

I'm working on my ability to write loosely coupled applications that follow SOLID principles. This is a simple application trying to demonstrate the concept. Is it OK? Am I going along the right lines?...
0
votes
2answers
43 views

No getter/setter on model with many instance vars

I have been reading a lot of material on how to become better in OOP, DDD etc. While reading Object calisthenics and Getters/Setters. Evil. Period. I got confused. Let me explain it by example. I ...
-1
votes
0answers
34 views

Implementing low level class recurring interaction with app logic [closed]

What solution for printing errors to user would you chose from below examples and why you think its the best choice. Do you have better solution? 1.Using Error collector class and shutdown function ...
3
votes
2answers
158 views

First game of Snake

I'm making baby steps in Java programming and I just ended coding basic game: Snake. Could you share with me what is needed to improve in this code? What about OOP here? GameBoard.java ...
4
votes
1answer
32 views

Framework for composing algorithms

I am implementing a game in python, which will give the user a sample encryption, and explain each step from plaintext to cipher. The task for the player is to decrypt a word by undoing each step ...
4
votes
2answers
92 views

PHP OOP Login Script

I'm new to both PHP and OOP and would like some constructive feedback on a class I made. I have a "main account" login system already setup and working; when the user logs in they're presented with a ...
1
vote
1answer
56 views

Using decorator pattern to validate an entity

I am following this article. ...
3
votes
0answers
93 views

Adding swipe support to multiple classes

I have implemented swipe functionality using UIPanGestureRecognizer in a project. What I have done is added PanGesture to ...
4
votes
1answer
147 views

Simple box with tabs

While trying to become better in javascript I've written the following simple box with tabs: Javascript: (entire code (HTML/CSS) is in the snippet) ...
4
votes
8answers
2k views

C++ calculator using classes

This is my first time using classes objects and functions. What can I improve on? ...
1
vote
1answer
55 views

Student Class in C++ using sstream for format

Based on my previous review, I'm posting another Hackerrank Class solution. Problem Statement We can store details related to a student in a class consisting of his age (int), first_name (...
3
votes
0answers
42 views

Perlin Noise Generator - Round 2

After a good first review, I've much improved my code which is generating Perlin Noise as a means of 2-D terrain generation. My first attempt was not very well met because at the time it was a lot ...
3
votes
0answers
108 views

Simple home-brew filter design for a future GUI

I decided to make a small program for filter design, to practise C++. I intend to also add a GUI, later on (Qt, most probably), so I thought that the way the program would go in the ...
0
votes
0answers
14 views

An Object Oriented Attempt to Render Different Cards based on their Source Type

So I'm working on a test project to learn Angular 1.x better. I have this as a Factory that gets required by the main.js. There are different cards that are rendered differently depending on the ...
6
votes
2answers
76 views

Simple four function calculator in python

I just finished my first Python GUI project, a simple four function calculator. I think I've tested it pretty thoroughly. I'm learning python and OOP, so any critiques would be welcome. In general, ...
1
vote
1answer
32 views

ES6 class that generates an area where you can draw on a page

I have the following javascript es6 class (along with some functions) that generates an area where you can draw in a page. ...
0
votes
0answers
50 views

Redesign of classes for my programming language's interpreter

This is a redesign of the class system for a project I started a while ago (I posted about it, but it was really a lot of time ago and the codebase changed so much). I rewrote this because the ...
3
votes
1answer
89 views

Subclassing `int` to make colors

In the ROOT framework (originally a C++ framework, but python bindings are also supplied), colors are objects (ROOT.TColor) identified with an integer index. This ...
3
votes
2answers
71 views

Structure of inheritance between Animal classes and methods

I'm trying to do some basic inheritance between the 3 classes and use some simple methods, and I'm looking to learn what should be the correct structure between them and what can be improved. ...
0
votes
0answers
42 views

More elegant way to use instance of class in other class

I have written some very bad code. It works. But it is certainly not the way to do it. It uses the twisted framework. The problem was I had to use the instance of the ...
7
votes
2answers
430 views

Java beginner exercise : Write a class “Air Plane”

I had to do this exercise for a further education in which I'm currently enrolled in: Write a Java class "Air Plane". Object-property names and types are given and compulsory. Write the according ...
1
vote
1answer
31 views

Binary Option Pricing using Card Game

I shuffle a deck of cards(with an equal number of red and black cards) and start dealing them face up. After any card you can say “stop”, at which point I pay you $1 for every red card dealt and ...
-1
votes
2answers
107 views

Very complicated Java HelloWorld app

This program attempts to shows the basic concepts of inheritance and polymorphism. In what ways could the code be modified to better demonstrate those concepts? The interface, abstract class and the ...
1
vote
1answer
61 views

POJO-like class in Python

I simply want to organize some data (class= MarketOnCloseSecurity) to be used in another class MarketOnClosePortfolio. The ...
2
votes
1answer
63 views

Number representation for a calculator that works with very big numbers

I'm a beginner: I have learned concepts and features which I think I need in my project, but this is my first serious program and it is my internship project. I'm totally confused and need help to ...
1
vote
0answers
37 views

OOD for reverse polish notation calculator

I am new to OOD and trying to implement a notation calculator in java with OOD concept, attached is my code. It works but I have feeling it's not good especially the factory method is not good. I will ...
0
votes
1answer
51 views

Abstracting HTTP requests to keep it simple, flexible

The project is an API that will itself make HTTP requests to external webservices. Since this is PHP, we actually chose to use guzzlehttp. Now the library itself doesn't matter much, but I'm scared ...
2
votes
1answer
51 views

Tokenizer building blocks: tokens and spans

In a completely overkill BrainFuck lexer/parser I've presented the lexer, parser, interpreter and syntax tree classes. With this post I'd like to go over the lower-level ...
0
votes
1answer
26 views

Two (or more) LRU caches for a Node.js app

Here is a caching code of a nodejs / typescript app using lru Cache module from https://www.npmjs.com/package/lru-cache. For various reason i need to setup separate caches: one for homeCache another ...
14
votes
2answers
3k views

A completely overkill BrainFuck lexer/parser

I'll need to build a syntax tree (AST) for Rubberduck, but since VBA has dozens of tokens and complex rules, I needed a simpler language to play with first, so I thought BrainFuck would be a perfect ...
3
votes
1answer
64 views

C++ Tree Object Class

I'm writing a class that acts as the base for almost all objects in my project. I know this class technically doesn't represent a tree structure, because it can have more than 2 children. What should ...
0
votes
0answers
36 views

App for system that will load ad reports

I need object analysis for this problem. Since I am new to OOP and this is basically my first project, I want to know if I am doing it right. I think it should work as it is stated in assignment (...
5
votes
5answers
162 views

Taxi Meter App Business Logic Using TDD

The following problem has been written using TDD. Please review the following: Unit tests OOP Design Principles (SOLID) Cleanliness and naming Anything that could make the program better. Problem ...
3
votes
1answer
281 views

Generic Implementation of A Linked List in C#

Yesterday I posted my Generic List and received great feedback from it. I have taken the feedback to heart. Today I'm posting my take on the linked list in c#. LinkedList.cs ...
10
votes
2answers
614 views

Implementation of a generic List

I have only been self teaching myself programming on and off for about 5 months. The purpose of me writing this class is to incorporate the knowledge that I have gathered since I started. ...
3
votes
1answer
94 views

Chat Application

I've written a backend for a chat app but I'm not sure, if I'm following all the SOLID principles and if my code is clean enough. IModel interface for my db ...
3
votes
3answers
90 views

jQuery plugin to highlight text spans in various colors

I am trying to tackle two fairly massive concepts through JavaScript and jQuery, the first being object-oriented programming and the second being how to build robust modular plugins with an OOP ...
3
votes
2answers
72 views

Item categories

This is my second day into C++ and I wanted to get a small review from someone experienced with the language. I'm coming from Python so some stuff seems kind of weird. My plan is to build a little "...
5
votes
2answers
153 views

Simple factory pattern for cooking a pizza

I have developed a command line application which prompts the user to initially select an oven and then requests that they cook a pizza. The oven affects the pizzas cooking time. The pizzas ...
3
votes
1answer
58 views

C++ small 2D matrix class

I make a 2D matrix class (where matrix elements are of type float) which so far can: Create a matrix of zeros of any size by typing ...
7
votes
1answer
162 views

Search in a JSON structure after a key

This code is supposed to search for a specific key in a object or an array or a mix between both. Is there anything I can improve? ...
0
votes
1answer
68 views

Finding pair in an array with the OO approach

Description: I am trying to solve algorithmic problems mixing them with Object oriented design as part of my interview preparation. So, the question is given an array of integers find the pair of ...
6
votes
4answers
137 views

Count number of nodes in a binary tree the OO way

I am trying to write a simplify the algorithm of finding the number of nodes in a binary tree by using good object oriented design. I have been into good OOP style recently and found it really ...
5
votes
0answers
59 views

First Memory Game with PyQt and OOP

So this is my very first time in this site. I have written this very basic Python code with PyQt5 to create a Memory Game. As I am not very familiar with OOP (but I'm trying to be!), I hope somebody ...