Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.
1
vote
0answers
11 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 ...
3
votes
2answers
59 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
97 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, ...
2
votes
1answer
32 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 ...
-4
votes
0answers
22 views
Return two arrays from one function [on hold]
I am creating a forum. It has sections. Each section has its own groups. I want to fetch all sections and their groups. But there is a problem with my code. plz check and tell me where the fault is.
...
0
votes
1answer
102 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
19 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
60 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
43 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 ...
0
votes
0answers
36 views
Design zoo management using oop [closed]
This is an open ended question, there is no fixed definition. Please review this design.
...
-1
votes
1answer
51 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
104 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
93 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 ...
0
votes
1answer
34 views
Generalizing the Initialization of Singleton Derived Classes
I have the following construct for storing and restoring my applications settings to and from XML.
...
9
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
32 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
77 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
79 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
43 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
0answers
67 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
80 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
62 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
1
vote
0answers
9 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
20 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
69 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
48 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
208 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.
...
0
votes
0answers
20 views
View/templating system with standard content and custom parents
I've been working on my own website, and decided to write an own framework for it. One of the items in the framework is a view/templating system, used to easily maintain presentation files (HTML, PHP)
...
2
votes
1answer
301 views
1
vote
0answers
38 views
Counting and listing words in a table
I have recently carried out a test for university where I was given the following instructions:
Write a simple JavaScript application that reads paragraphs of text
input by the user and creates ...
1
vote
1answer
29 views
CLS_Compound_Predicate
I have a CLS_Comparison_Predicate which will take an input value, perform a logical comparison and return a Boolean.
CLS_Compound_Predicate instead takes lists of ...
1
vote
0answers
19 views
es6 OOP class Email + Facebook login
I've been given the task to create a micro-service which basically logs in OR creates a user. I chose to do this with express.js ...
4
votes
2answers
82 views
Copy, Paste and Format 2.0
This is a follow up with revised code, see the original question and subsequent answer in the following link (Copy, Paste And Format)
This is a full version of all three "Macros" or subs within the ...
3
votes
1answer
37 views
Overloaded applyRestrictionsToCriteria(…) methods
We want to refactor two methods that are exactly the same, except for one difference: one takes an org.hibernate.Criteria and the other ...
0
votes
0answers
50 views
View/renderer for a polymorphic model
I need to render polymorphic models in different situations.
Model's base class:
...
7
votes
1answer
66 views
Class: 2D Variant Array
Note: Yes. It's big. I'm not expecting commensurately
long/detailed answers (though if anyone wants to write one, you'll definitely be receiving a substantial bounty). This class is going to be ...
1
vote
3answers
61 views
Python static / instance method or function?
background:
I have a model called FileInfo, which represents a sftp file / windows dfs file.
...
0
votes
2answers
56 views
Getting and posting data use PHP OOP and mysqli
I am not very experienced in php oop. Moreover, when mysqli comes with php oop, it make me more confused about using it in best efficient way. Anyway, first look at my connection class:
...
3
votes
4answers
179 views
Property caching
Trying to figure out how to efficiently cache property calculations with dependency tracking to invalidate the cache. Here is the syntax I have at the moment (one ...
3
votes
1answer
42 views
Python 3 class constructor
I have implemented a metaclass in Python 3 that, apart from the usual instance constructor (i.e. __init__), enables you to define a class constructor (as a class ...
2
votes
1answer
48 views
Raindrops in Java
Problem Statement:
Write a program that converts a number to a string, the contents of
which depends on the number's prime factors.
If the number contains 3 as a prime factor, output ...
6
votes
2answers
173 views
Dictionary as context manager
I've created a class that implements customized addition, subtraction, etc. But for this class I'd like to have some additional parameters for these methods (...
6
votes
2answers
231 views
Rock-Paper-Scissors game with OOP concepts
This is code for a Rock-Paper-Scissors game I made using some of the OOP concepts I learned in C#. I don't know if I am making the right choices but I am fairly confident. It would be great if I could ...
3
votes
3answers
63 views
Binary string to decimal conversion
Problem Statement:
Write a program that will convert a binary number, represented as a
string (e.g. '101010'), to its decimal equivalent using first
principles
Implement binary to decimal ...
1
vote
0answers
26 views
An [InternalCopyArray] by any other name
So I'm building a 2D Array class.
I want to have CopyArray and RemoveIndexes functions. However, in both cases, the method ...
9
votes
2answers
138 views
Pokemon game in JavaScript
I'm practicing my JavaScript skills by trying to create a Pokemon game. So far, I've made the dataset and the functions required to work the game. Can someone help me optimize the code and tell me why ...
5
votes
1answer
71 views
Let's revisit Roman numbers
Problem Statement:
Write a function to convert from normal numbers to Roman Numerals:
e.g.
1 => I
10 => X
7 => VII
Code:
...