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)

1
vote
0answers
23 views

Game engine for 2D games in Java

I am writing a 2D game engine library that I can use for simple future games, and I've been told that it is written very procedural rather than objected oriented. I was wondering what I should do to ...
1
vote
0answers
46 views

Project Euler #11 Largest product in a grid

Question Link to the exercise : https://projecteuler.net/problem=11 I'm currently working on the Project Euler exercise's and I just finished the eleven exercise. It's working fast enough it takes ...
4
votes
1answer
42 views

Printing the right diagonal of a matrix

I am solving a coding challenge whose objective is to print the right diagonal of a matrix. And below is my code to do that. ...
2
votes
1answer
30 views

Regrouping JSON object

I wrote a JavaScript source which regrouping by new key i.e. following JSON to the other: ...
3
votes
2answers
55 views

Parsing a string as fast as possible that is using comma delimiters

I have made a simple static parser for a bigger program. This parser takes a string that has comma deliminators and I need to separate the strings in to a vector for handling in a different section of ...
4
votes
0answers
30 views

A “policy-based” design for a generic CUDA kernel

I am faced with a design issue that has been discussed on SO several times, the most similar question being this one. Essentially, I want polymorphism for a CUDA kernel in the form of a "generic" ...
0
votes
1answer
31 views

Simple weighted directed graph in Python

I have this simplistic Python class for representing directed weighted graphs (digraphs for short): Digraph.py ...
4
votes
1answer
48 views

A class to encapsulate a pair of ints with range-checking

The goal is to have a helper class to wrap the concept of a resolution safely, encapsulating the range check into the class, since otherwise it can get lost by a client not so cautious. I think this ...
4
votes
1answer
37 views

C++ Address Book (2nd follow up)

This will be my third post of this program, I have received a lot of great feedback and have learned a lot from the community. I have edited this program a lot, and am here for another review to see ...
13
votes
3answers
1k views

Simple worker class program

I Have written this program to add workers into a list and print them. I'd like a review of this. I'm especially concerned if the method Addworker should be inside ...
0
votes
1answer
23 views

Optimizing Codegeneration from Ast

I have been writing a compiler. While profiling the compiler, one method takes 5 seconds to compile 2k lines of code, my profiler tells me that this is the bottleneck. ...
-4
votes
0answers
27 views

Sorting custom objects based on date datatype [closed]

I am trying to sort my object based on the date in ascending order but the result is not as expected. The sample code is listed as below, for my work so far, ...
3
votes
3answers
135 views

Bowling scoring kata

I've been writing basic Python scripts for a while now to help process data or automate some task but I've decided I should start picking up unit testing and objective orientated programming (the vast ...
7
votes
1answer
157 views

Console app to teach bitwise operators

I'm creating a console app that has the purpose to teach you how to use C# bitwise operators. I have several classes which contain info about the different operators and I instantiate/add them in the ...
2
votes
1answer
64 views

Simple address book in C++ - follow-up

After posting my original address book program I took the responses and edited my code. I have used every suggestion given, the code works great, and now I am looking for further review and ...
4
votes
1answer
32 views

Extremely Simple Paint Program in Java (Tips for making it run smoother?)

I have written a very basic paint program in java using awt and swing. I have separated the program into two different class files; one of them holds the JFrame and adds a custom panel (this custom ...
6
votes
1answer
141 views

Custom card game

I had a task to create a program to simulate a simple card game. Given an input file with number of players, the players and finally a list of cards played, I had to change the game state accordingly ...
3
votes
2answers
87 views

Simple Rock-Paper-Scissors to get more comfortable with OOP

I'm trying to get a little more comfortable with using classes as they're meant to be used, instead of using them to decorate my code to make it look more legitimate. Can you see anything glaringly ...
2
votes
1answer
112 views

Preventing SQL injection without using prepared statements

I'm learning OOP and totally new to this way of coding. I've always scripted PHP the procedurial way. Now I've written a working class, which creates a database connection and has the method to create ...
3
votes
1answer
135 views

Bitwise operator guide

I'm developing a console app which is supposed to teach how the bitwise operators in C# work. It will include tutorials, training fields and all that good stuff. I have a problem with the naming of my ...
2
votes
1answer
69 views

Object-to-array flattening function

I have written a function that is designed to convert an object into an array of key/pair values ("flattening it") like so: Input ...
3
votes
0answers
18 views

Fetch data from co-processor on network in background

My code communicates with a Raspberry Pi (with a static IP address) running on a network. The client sends a signal to the Pi, and the Pi sends back a double (encoded as a string) with the angle ...
2
votes
0answers
41 views

API call to a music provider

I have inherited a PHP base class for an API call to a music provider. It is functional, however it makes me feel that there are some "magic" nature behind it that makes me un-easy (or maybe I'm not ...
1
vote
0answers
43 views

Basic vector based drawing OOP design

I had an exercise as below for an interview. I've added my implementation at the end. How could I improve it? Exercise description: Develop a simple vector based drawing package. Your ...
1
vote
0answers
8 views

Unit Tests for a Redshift Wrapper Class

I'm somewhat new to TDD and Unit Testing, but I've written a suite of unit tests to check my functionality. The basic classes ...
1
vote
1answer
50 views

Global site settings middleware for Slim Framework 3

I have created this middleware code for slim. I just want to know that is this right way to store site settings globally. so, I can use where ever I want. What do you think about my class structure ...
0
votes
1answer
38 views

Acquiring payment service ID

I have a utility class, called Bills, that extracts some information from a billId and a ...
0
votes
0answers
30 views

Web-scraping library

Here are two functions that make a request for a given URL and then takes the response body (HTML) and loads it into the cheerio library: scrapeListing.js ...
0
votes
0answers
48 views

Pass several classes as one parameter with Poker user controls

I have two classes that hold some info about the user. One holds the data, the other one holds the controls info. Now I need to pass both of them as a parameters to a method. However they are ...
2
votes
2answers
76 views

Player classes for a playing card game

I have a simple base class and two derived classes. However, when I'm creating new instances of that class, the line where I instantiate the variables is getting way too long. I have it on two lines: ...
1
vote
1answer
28 views

Type Storage Class

So I have designed a "type store" in C++ that can hold a single instance of any subclass of a defined type. Here is an example of how it would be used: ...
1
vote
2answers
57 views

Online book reader system

I am learning to design classes, and in the effort to improve, I have designed an online book reader system with the following requirements in mind: Allow person to create and renew membership ...
5
votes
2answers
78 views

Showing object's data on GUI and HTML without accessors and mutable objects

I have been searching for a solution to show data of class with three assumptions: Class Employee is not responsible for showing itself Class ...
4
votes
2answers
190 views

C# Winform Amazon Application

This is my first program I've written ever. Don't hold back on me. Any help and feedback is appreciated. This code wont work because it requires some keys, but I censored them out, but it does ...
3
votes
1answer
57 views

Application Settings Helper

I'm developing an app which stores some different user settings in app.config such as connection strings, paths for saving reports, default printer e.t.c For retrieving them I made a static class ...
7
votes
1answer
262 views

Calculating the results of bit operations

I have a simple program that calculates and outputs the results of all the bit operators. I'm planning to send it to my friend and to explain some stuff about them to him. Before I do that, I want to ...
4
votes
1answer
105 views

Querying the Google ads API

I have a method which relies heavily on object supplied by third party APIs. Below is my working code, is there any scope of improvement? ...
7
votes
2answers
224 views

WinForms Poker (complete project)

I have quite huge question/favor to ask but I hope I can get some useful answers. This is my first complete project, I'm still learning C#, my first programming language. I'm afraid that there will ...
0
votes
0answers
24 views

Render HTML/JS with Values for jQuery Modal Boxes

I have some code that I use to render the template + values for the HTML that makes up jQuery Modal Boxes in my code. ...
0
votes
2answers
51 views

PHP alternative syntax confusion

Newbie to PHP. Trying to output the results of an array inside a foreach loop. I have got the following code but I cannot understand what to do with it next. Mainly; Where/how do I start and end ...
1
vote
1answer
39 views

Database query inside a method of a class and return data [closed]

I'm trying to find out what is the right approach to return DB values from a class. This is what I came up with: ...
2
votes
2answers
45 views

Instantiating different kinds of error records for a database operation

I've written code to be called from Powershell like so: Rename-DatabaseUser -Name 'someuser' -NewName 'somenewuser' I'm wondering if there's another way I can ...
1
vote
2answers
106 views

Strategy pattern using an abstract class and an interface

I have implemented some sort of the strategy pattern using an abstract class and an interface: ...
3
votes
3answers
57 views

Tic-Tac-Toe project in Python

Here's a Tic-Tac-Toe program I wrote in Python. How can I improve it (.eg. make it more readable)? ...
1
vote
2answers
110 views

Derived methods with Poker classes

I have an interface with two functions. This interface is being inherited by an abstract class which implements just one of those functions. The other one is left to be implemented by the derived ...
1
vote
1answer
38 views

Initializing a game in SDL

I have recently learnt about RAII and exceptions and I have been trying to implement them into my code, but I have met an impasse. With this code here what I am trying to do is manage everything that ...
0
votes
1answer
22 views

Keep classes anonymous in TicTacToe program

My console TicTacToe program This is my first large project attempt and I want to learn how to keep classes as anonymous as reasonable and as protected/secure as reasonable. The program works as ...
2
votes
0answers
28 views

Interface modelling for a journaling program in Java

My program's Journal consists of unique Pages identified by their Day. Within those pages ...
5
votes
3answers
220 views

My first finished Python program: a deck of cards

I've recently started learning how to code in Python, and have even more recently learned the basics of object-oriented programming. Feeling inspired, I started on a program that would generate random ...
0
votes
2answers
91 views

Double linked list c++

I'm trying to figure out double linked lists. I'm looking for any type of comments you might have for my code. Anything that will make it better. ...