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
0answers
21 views

Factory to augment JS classes with validation methods

I have some validation classes. To keep things smooth, I create a single class that has those validation classes inside of it. That class will be a singleton, and gets injected into my other classes. ...
3
votes
3answers
64 views

Add multiple instances of a property to a list [on hold]

I'm a novice programmer asking first question here although I've gotten tons of help from previous questions. The following code is abstracted from what I currently have working. ...
4
votes
1answer
59 views

Stack implementation in ES6

Finally happy to see that now we can have iterators and generators. I also need to try to have private properties too so that we have well encapsulated data structures and I see that there are Proxies ...
2
votes
0answers
33 views

Input-reading library for Node.JS part 2

Note: This code is a rewrite of the post I mentioned here since according to CR policy I cannot update the same question. This is somewhat didn't went through that much thought process and I wrote ...
1
vote
0answers
55 views

Wrapper for a vendor API that lacks common interfaces

I know basic Java, but I struggle sometimes with object orientation design. There is a vendor api I use, and I wanted to wrap it to be reusable as a lib in other projects. All the services from the ...
3
votes
1answer
37 views

Bukkit API Town plugin for Minecraft

I'm creating a town plugin for the game Minecraft using the Bukkit API. It works fine and all, however I'm not satisfied with the quality of the code and I'd like to know how I can improve. I've been ...
3
votes
1answer
53 views

Input-reading library for Node.JS

Recently I have been busy with nodejs and I thought to create something like this Java input library, so I started with some rough code like below: ...
4
votes
3answers
88 views

Program to reverse a string using std::string

Background: I'm trying to learn C++ and I'm doing that by writing some programs by myself. I'm decent with C, but I'm having trouble translating to OOP paradigm. I'm reading from learncpp.com and a ...
3
votes
1answer
37 views

Use of scoped objects in a JavaScript Tic-tac-toe implementation

I have been using the w3 org's JavaScript Best Practices web page's examples for coding an object literal for a game. It is my understanding that I should use this to keep all my variables and arrays ...
2
votes
1answer
67 views

Linked list using dynamic memory [closed]

I created a simple linked list to test what I've learned so far and if I manage everything correctly. If you see syntax errors is't because of copy-paste. I just want to know if i'm making everything ...
1
vote
1answer
60 views

Moving To Object Orientated Programming

Please keep in mind I am new and still learning when reading the following. What I am doing I have the following code which pulls a sport, tournament and round NR, from a DB table called ...
3
votes
0answers
42 views

Check the latest internet connection speed

On the journey of learning software design I am now taking a slightly different approach and thinking to focus on some real world projects. After code reviews I would be publishing them to the ...
0
votes
0answers
15 views

Inheritance is better or composition design pattern in this scenario? [migrated]

Design and implement Cash Register: Given a number of items you will be required to calculate the total bill. Items are charged for in a couple of different ways: A given price for each item, e.g. ...
7
votes
2answers
132 views

Load and analyze a list of people from a file

I recently completed a programming task in Java for a job that was javascript heavy but the hiring company wanted some Java knowledge. I've been using Java since the turn of the year. Other than ...
1
vote
0answers
34 views

AWS Redshift wrapper class that automates similar types of loads from S3

I have a AWS Redshift wrapper class that automates similar types of loads from S3 for me, and I have recently adapted it to work for Spark jobs, which don't require a manifest, and instead need a ...
1
vote
0answers
23 views

Developing a Feed Reader in the MVC Architecture are there better posabilities?

I'm redisigning my old Feed Reader APP with the MVC architecture, to understand the OOP better, currently there is just registration functionallity implemented, ...urrently workiing on the session ...
5
votes
0answers
85 views

SVG mosaic creator

Although my code works as expected, there are a few gotchas. A single row is not filled at once; instead, I can see partially filled rows during the rendering process(Fixed in the updated code below....
0
votes
0answers
18 views

Event log implementation with TDD

Below is some code that implements an 'event log' whose purpose is to record events and periodically check that all events were recorded in chronological order. The collection of events must be ...
1
vote
1answer
41 views

Simple router for updating users

I need to know if I am going in the right direction with my code so far. I am really trying hard to transition from procedural, page-based programming into OOP MVC. So far I have written a simple ...
3
votes
1answer
52 views

A class to create and modify SQLite3 databases with a terminal

I would like feedback on the class I've written. The purpose is to dynamically create and interact with SQLite3 databases, accepting lists of complete or incomplete statements. ...
2
votes
2answers
65 views

Triangle class implementation

I need some advice to improve my Triangle class. I know some of my code is sloppy, such as in the Triangle constructor. can ...
4
votes
1answer
172 views

Guessing game in Java - Take 3

I already have two versions of this code reviewed (thanks @Bobby). They can be found here and here. The question is still the same. The goal is maintainability and following best practices. Jar....
0
votes
0answers
22 views

Model controller relation

I am creating a PHP app in MVC (no framework). I am having a difficult time understanding how the Model and the Controller communicate in an optimal manner. User.php ...
3
votes
1answer
26 views

Tracking orders efficiently using a Python class

I've written a Ledger class for a daemon process, which is supposed to keep track of an exchange's orderbook. My main concern is the way I keep track of the orders -...
3
votes
1answer
79 views

Simple Wizard Goblin User Story Test Driven Development

I have written this to practice Test Driven Development. I would like to know if the process is right and how it could be improved. Problem Statement : A wizard can cast spell on goblin and make his ...
4
votes
1answer
57 views

Guess how many are in the jar game in Java - Take 2

Original question can be found here I took the advice I got to heart, and re-wrote it. Once again I'd appreciate any advice as to how I can improve this using best practices. Jar.java ...
6
votes
3answers
70 views

nonstd:: non standard classes

I am looking for people's opinions on my use of a set of non standard "standard classes". Basically I am working on a 'modern' C++ Lexical Analyser and Parser Generator duo to replace flex and GNU ...
2
votes
1answer
71 views

Guess how many are in the jar game in Java

I'm reading up on java and have completed a fairly simple console game. I'm unsure on my own structure when considering maintainability, separation of concerns and best practices. Any tips or ...
-1
votes
2answers
67 views

Java dog hierarchy

I am supposed to write a small java program. The program must contain 3 different kind of dogs. The dogs can bark and move, these methods can be represented just by System.out.println();. Some dogs ...
3
votes
1answer
51 views

A module to make JSON in Python easier

I recently wrote the livejson module as a way to make working with JSON in Python easier. The idea of the module is that you initialize a livejson.File, and then ...
11
votes
1answer
134 views

Finding the cheapest hotel

I thought this question made a good excuse for some basic OOP code, so I whipped up a little bit of code to demonstrate it in VBA; the idea is to have tutorial-grade code, to show how interfaces and ...
1
vote
3answers
72 views

Instantiating a property when the required attributes have been set

I have a simple class which holds my product. Someone can add a serial to this product and also a purchase id. On change of the properties, I want to check whether both properties are set, and get the ...
6
votes
1answer
88 views

Creating a Kinesis stream, Firehose, and lambda event source from config file

I'm in the process of writing a python script for automating a data ingestion pipeline using Amazon Web Service's Kinesis stream, Firehose and lambda. This is my first stab at writing Python, but I do ...
12
votes
6answers
2k views

Find the first non-repeating character in a string: (“DEFD” → E)

I recently had an interview and got to phase 2 which is a coding assessment. One of the questions was: Find the first non-repeating character in a string: ("DEFD" --> E) I didn't pass the coding ...
7
votes
3answers
657 views

Mars rover movement and position

I have written a solution of a Mars Rover problem in C++ using OOP, but I am not fully satisfied with the design. What changes can I make to improve the design? Problem description is: A rover’s ...
5
votes
1answer
107 views

A “todo” app built to practice Object Oriented JavaScript

I built a small "todo" app with an object oriented JavaScript approach. I have spent this morning reading on a few ways to approach this, and I've come up with the following: ...
2
votes
2answers
72 views

Setting up a database class

I am wondering the best way to setup a database class, to remove repeat code by using OOP. This way if I changed how I connect to the database (switch from PDO to sqlsrv driver) I can just change it ...
3
votes
0answers
75 views

JavaScript Singleton Pattern/Class “Methods”

I have a library that will be called in multiple places. Here is my implementation: var vessel1 = new Vessel(); var vessel2 = new Vessel(); ...
1
vote
1answer
37 views

TCP client library using Winsock WSAEventSelect in C++ - Take 2

This is my second take on creating a tcp client C++ class. The class declaration is general but the implementation is Windows only at this stage and uses the Microsoft Winsock WSAEventSelect model. ...
10
votes
5answers
848 views

Largest Prime Factor (PE3) using OOP

I want to learn some C# syntax/paradigms (I'm more used to Java), and have been wanting to get a bit better at math as well, so I solved ProjectEuler3: Largest prime factor with the following small ...
6
votes
3answers
57 views

Running a MySQL query with an admin class

This is my admin class, DB class and how I use OOP. I am looking for ways to improve my code to make better use of OOP. Please help me if you think I can improve my code in some way. db.class.php <...
1
vote
2answers
44 views

Method to get user information (OOP / MVC approach)

I coded a small user script with PHP. I'm improving the script, learning from my mistakes. I recently learned about object oriented programming and wrote 2 big god classes (user class and message ...
2
votes
2answers
41 views

Random distribution in Ruby

Below is a Ruby implementation of a random statistical event, based on a hash with the actual observed counts of outcomes. I'd be interested in feedback in particular on what techniques I might use ...
3
votes
1answer
66 views

TicTacToe Implemented with Classes

I made some changes to my class structure and the way I determine a win. I was attempting to decide if it made sense to keep the player completely isolated to TicTacToe game class or if it made sense ...
0
votes
2answers
56 views

PHP MySQL connection class

I'm trying to build a class that connects to the database. It does the job but it is not very elegant. I also have no understanding of singleton class or dependency injection. Is this safe? Can you ...
6
votes
4answers
654 views

SharePoint CRUD class

I am writing an application where I have some objects like customer, supplier, product, etc. I have written a class for the object 'supplier' and wanted to ask if this is a good design. I have put in ...
3
votes
2answers
127 views

Form validation library

Background: After reading this thought provoking book I decided to write a small library as an exercise. ...
2
votes
1answer
98 views

Reading Input from file for sorting and rewriting

I am writing a program that reads a DAT file with names. The names are stored in an ArrayList of Type Name, the Name object can hold the first, middle and last name. Once the names are stored in the ...
-1
votes
3answers
95 views

Is it good to have a method accepting an array of keys to return it's values? Does it break OOP concepts?

Here is my ValueObject example class. I wrote this example for my OOP research. I know I could use ArrayAccess interface but I am curious abobut feedbacks about this class. Does it break OOP concepts? ...
7
votes
1answer
99 views

Project hotel reservation in Python with OOP and multithreading

I have to create a project in Python 3 for a university exam. The project involves the use of object-oriented programming and the use of multithreading. My project is based on the simulation of ...