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)

4
votes
2answers
23 views

Mars rover movement and position

I have written a solution of Mars rover problem in C++ using OOP, but I am not fully satisfy with the design. What changes can I make to improve the design? Problem description is:- A rover’s ...
4
votes
0answers
67 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: ...
1
vote
1answer
39 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 ...
2
votes
0answers
54 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(); ...
0
votes
0answers
14 views

The same object as parameter of function and returned [on hold]

I write the question for my fellow worker (I want to send him a link with the question and answers). I would like to ask you about arguments you have that the code below is bad. It is purely C++ code ...
1
vote
1answer
25 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. ...
8
votes
5answers
805 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
48 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
39 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 ...
0
votes
0answers
17 views

Database to calculate Date/Time [on hold]

I'm trying to make a calculator to calculate the estimated delivery time for products from its producers, and since every producer has his own time cycles, I have to make a kind of database about them ...
2
votes
2answers
32 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
0answers
18 views

i need to change my form process into OOP [closed]

this is my currently process.php how can i change this into OOP? im still trying to learn OOP and i could not figure it out.i also need to sanitize the $_POST and get it into OOP class somehow. if ...
3
votes
1answer
59 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
53 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 ...
5
votes
4answers
635 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 ...
2
votes
0answers
60 views
+100

Form validation library

Background: After reading this thought provoking book I decided to write a small library as an exercise. ...
2
votes
1answer
92 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
91 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
93 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 ...
3
votes
1answer
28 views

Semi-playable chess game in Ruby

I made a simple, semi-playable command line Chess game for my class exercise. At this point, this game can do the following things: Print out the updated board representation after every move ...
1
vote
2answers
129 views

Tasks organizer app

I've created my first complete JS app, which lets you add tasks and control how much time you spend on them. I posted this to get some ideas how to improve readability, efficiency and the speed of my ...
3
votes
1answer
46 views

TCP client library using Winsock WSAEventSelect in C++

One way to write a client which uses a specific protocol, eg http like in this case, is to create a base class with the basic socket handling functionality with virtual functions which can be ...
4
votes
2answers
76 views

C++ object pool

I am a beginner and would like to build a pool. I made some research and found out that if my software has heavy object create and delete part, I should use a pool because of performance. I made some ...
5
votes
2answers
115 views

Creating a simple 52-card data structure for Blackjack in Python

I am fairly new to Python so I am trying to learn more about its conventions and ways to make my codes more efficient. I am making a Blackjack game and so far have this class that draws, organizes, ...
3
votes
1answer
50 views

Scoreboard with score evolution plots using classes

I've very recently started using OOP paradigms for the code in my work (academic research). As an exercise I tried coding this quick scoreboard. I'm not interested in improving the 'display' part, I ...
1
vote
1answer
112 views

Winning logic for Tic Tac Toe and OO design

I'm a Java beginner and I've just started learning about GUI. However, I'm not sure about GUI coding conventions and whether I'm getting the object orientation part of it right. I feel like I'm ...
0
votes
0answers
20 views

JavaScript constructor-function for currency-conversion

I've made this constructor-function for currency-conversion. It shall be incorporated into an app I'm planning to implement. So therefore: Any hints concernings flaws as well as suggestions are ...
1
vote
1answer
62 views

Ruby class to model (pre)historical Dates with (im)precision

I am relatively new to Ruby, having worked with Rails for about 8 months. For fun and my own education, I have written a Ruby gem (no Rails) that models dates with a precision (second, minute, hour, ...
3
votes
1answer
47 views

Using Ruby to record tasks

I started writing this program to get a better understanding of different aspects of Ruby. I tried to follow the ruby style guide here. What it's supposed to do is take the exercises/tasks you give ...
-1
votes
1answer
52 views

Classes (and maybe subclasses) for characters in a Python game

I am practicing classes and subclasses in Python. I'm not sure whether it might be useful to add a subclass to the following code, instead of just adding methods to the class. ...
5
votes
2answers
112 views

Mars Rover Simulator

Problem Statement Consider a rover and a plateau of size nxn. The rover takes three type of instructions L,R and M. 'L' and 'R' rotate the rover in the left and right direction. 'M' moves the ...
1
vote
1answer
100 views

Call Center Design

Imagine you have a call center with three levels of employees: respondent, manager, and director. An incoming telephone call must be first allocated to a respondent who is free. If the respondent can’...
0
votes
1answer
35 views

Generalizing the Initialization of Singleton Derived Classes

I have the following construct for storing and restoring my applications settings to and from XML. ...
10
votes
5answers
2k views

Merge two already sorted linked list

This is code to merge two sorted linked lists. l1 and l2 are sorted. While calling the merge function via ...
4
votes
1answer
34 views

Binary expression tree node with two possible states

I am building out a binary expression tree and shown below is an implementation of the tree's node. The node can be either a leaf or non-leaf, with leaves having ...
1
vote
1answer
73 views

PHP Class code that allow developers to register taxonomies in a CMS

Building complex applications can sometimes be a pain when extending or editing later on; I read online about the S.O.L.I.D principles of OOD, I want to understand if I am following a good approach ...
2
votes
1answer
80 views

Pizza Delivery System

I have made this code as my summers vacation project in Turbo C++ (I know its old and outdated, but that's what they teach us in our school). The code allows users to order different pizzas and even ...
3
votes
2answers
89 views

War card game using classes

I would like some feedback to the code I wrote for the card game War. While programming it, I wanted to make classes that I could easily use for other card games too (hence why some functions are ...
2
votes
0answers
44 views

Data structure of in-memory database [closed]

I am learning OOP, SOLID principles and design patterns. I have designed data structure of in-memory database in C#. Please provide suggestions to improve it better considering solid principles, OOP ...
6
votes
1answer
84 views

“Stardust” 2D Gravity Simulator - Follow Up 1: The Planets

This is a follow up for the 2D Gravity Simulator-like Game question. Since then I have developed my javascript skills further, and now I'm using ES6 mainly. Note that even through this code uses ...
4
votes
1answer
87 views

Basic Internet banking application

I programmed in Java before, but I feel that I lack the "true way" of programming (OOP concepts, design, algorithm), so I started to learn all of these but I need your opinions and suggestions so I ...
3
votes
2answers
63 views

Validating multiple parameters by regex and length

I have a set of validation functions which return a response code along with an error message if the validation fails. Requests can be of three types, and each of them contains a different type of ...
0
votes
0answers
41 views

A simple User class

...
1
vote
0answers
11 views

Inheritance and Association implentation in Symfony 2.7 and Doctrine

I've a working implementation in Symfony2 with doctrine of the following model. A Parent can apply for one/more Training(s) A Training is based on a specific Skill, but you can have multiple ...
1
vote
0answers
22 views

Business Access Layer and Data Access Layer for a database application

Would like to get your opinion and any advice regarding my current approach of creating database applications. Below find my current approach. Counting on your opinion and comments including examples ...
8
votes
2answers
74 views

Hash table OOP implementation in C

To brush up my C I decided to do some OOP programming in C. I have never tested this before, but I was curious to try it since seeing an example of it a while ago. I decided to implement a simple hash ...
3
votes
1answer
52 views

PHP class which preserves line break by splitting the line into as many line break as it have

Can anyone here please review my PHP code which preserves line break by splitting the line into as many line break as it have? ...
7
votes
3answers
243 views

Let's play Rock, Paper, Scissors

I have written my first rock, paper, scissors project recently. I had to use a lot of if statements and System.out.println(); commands in the program. I am wondering what ways I could optimize my ...
2
votes
4answers
167 views

Implementation of warning storage

I implemented type (UserRuleManager) that will apply list of rules to entity User. I need your code review and your advices. ...