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)

3
votes
1answer
28 views

Connect Four (the OO approach)

I saw some approach to the connect four game at the site. They all where not that much OO like. Therefore I'd like to present my implementation and request suggestions on how to make this code more ...
4
votes
2answers
41 views

Python REST API clients

I am working on a project right now, where we need to search different APIs, then clean & persists data to database and finally pushing to Elasticsearch. The high level code looks like this: <...
1
vote
0answers
32 views

Player statistics class architecture

I've made a stats hierarchy for my Unity game project, it consists of 1 base class and few derived ones. abstract class Stats : MonoBehaviour ...
5
votes
0answers
39 views

Generating RPG Characters (Objects)

I am a beginner Java programmer. I have just finished up an assignment and would appreciate some advice and/or constructive criticism on my program. I am trying to ensure I do not advance my knowledge ...
3
votes
0answers
28 views

Designing a toy dependency injection library

Just for learning purpose I thought to write a simple and useful dependency injection service which would just do dependency injection but also it should expose its core too which would let the client ...
4
votes
3answers
73 views

Generating 50 Random Shapes

I am a beginner Java programmer. I have just finished up an assignment and would appreciate some advice and/or constructive criticism on my program. For context, I have the assignment details, ...
1
vote
1answer
32 views

Modelling an account manager in OOP

I have this task of modelling a system where given a group of users each can keep track of their expenses. The basic requirements are as followed: To be able to give credit to an user. Find all the ...
3
votes
2answers
54 views

Loading items from XML document

I'm making a game in Unity and I need to have a inventory/item system, I decided to store my items in simple XML document which I later read from. I'm planning to have different varieties of items and ...
2
votes
1answer
65 views

Defusing a bomb using a state machine

This code is a solution for /r/daily_programmer #293. The idea of this challenge is, you are given input in the form of colored wires: ...
4
votes
0answers
65 views

Test and implementation of a reorderable data structure that stores number of users (classifiable as per gender, country, etc.) of an Application

I have implemented a data structure that allows storage of number of users of a hypothetical application in a tree-like data structure in nodes as per their classification based on categories such as ...
5
votes
4answers
657 views

Generic Null/Empty check for each property of a class

I have created a method to check for null/empty values of class properties and if any null property is found I'm stopping the checking process and returning the result as true. I'm used a solution ...
3
votes
2answers
64 views

Singleton Pattern + unavoidable Public Constructor

We have an object that needs to be converted to a different type before storing it in database. For that purpose, the library provides an annotation over the field that specifies the appropriate class[...
2
votes
1answer
64 views

Refactored game of Snake

A week ago I requested a review of my code for a game of Snake. First game of Snake I made some changes based on your answers and now I want to show you present code. Something else to modify here? ...
-3
votes
1answer
60 views

Refactoring code to adhere to DRY principle [closed]

I'm relatively new to Javascript and jQuery. I have this code that has a ton of duplicated code and could use some refactoring. I've heard of Object Oriented Programming(OOP) and the Don't Repeat ...
10
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
22 views

Responsibility to Validate Move in chess game? [closed]

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
56 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...
6
votes
0answers
47 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
47 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
44 views

List abstraction using array

Following this reference, below is the list abstraction implementation using array, ...
5
votes
4answers
120 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 ...
3
votes
2answers
167 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
94 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
61 views

Using decorator pattern to validate an entity

I am following this article. ...
3
votes
0answers
99 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
148 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) ...
6
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
49 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
111 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
15 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
77 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
90 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
72 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
437 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
32 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
63 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
44 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 ...
4
votes
2answers
72 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
67 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 ...