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
1answer
17 views

Lightweight implementation of the in-close algorithm from C++ to C# translation

The following C++ code is a lightweight implementation of in-close algorithm. Full details of the project can be found here. I was trying to translate the C++ code to C# but it's very difficult to ...
0
votes
0answers
4 views

YUIDoc syntax for optionally static constructor

In JavaScript, I wrote a class that can be optionally instantiated with the new keyword, but can also be called statically as well. What is the best way to ...
4
votes
0answers
23 views

PDO Class to help on writting SELECT statements

I made this class just for the fun of it. The idea is to make a SELECT statement really quickly. ...
0
votes
1answer
38 views

Scroll to specific sections

I have a jQuery code that helps me to scroll to specific sections on mouse scroll. To handle mouse scroll events I am using the jQuery mousewheel plugin. ...
11
votes
7answers
738 views

Scoring a Scrabble Word

I was asked before an interview to create a console application that will work out the score of a word for the board game scrabble. It worked fine but the feedback I received said: "there were no ...
3
votes
0answers
26 views

Dynamic voting protocol implementation for replicated file system

I recently implemented a dynamic voting protocol for a replicated filesystem. I would really appreciate it if you can review the design and some choices made with regards to sharing of Locks & ...
-1
votes
0answers
14 views

Re factoring Duplicated For Loop in PHP Method [on hold]

Disclaimer: I understand the code may not work 100%, as I see issues already, but the core thing I am looking for help with is moving the duplicated for loop out of the function and into its own, ...
0
votes
1answer
26 views

PHP session_set_saver_handler with session timeout

I have developed a class that utilises the session_set_saver_handler function so I can store sessions within my DB. The class works just as I would like. However, ...
-1
votes
0answers
50 views

Please check the code quality of the OOP beginner

I started with OOP around 1 week ago and I would like to ask you to check my code and give me some tips and advice but also tell me what I'm doing completely wrong. I'm giving you code of my ...
2
votes
1answer
67 views

A color class and a CRUD class for it

Is it better to have only one class color and include the functions from the second class in the 1st one? Or leave them apart? Why is one better than the other or ...
-2
votes
0answers
11 views

Tables with same columns in Relational Database [closed]

I need to know if its a good practice to make tables with the same columns on the database. I have a situation where i have 4 kinds of documents wich each one of them have a correct format (something ...
7
votes
1answer
49 views

Media lending library

My assignment was to make a "Lending Library" that keeps track of items. We were advised to create two classes and a main method. What I am unsure of is if any of my code would be considered bad ...
4
votes
0answers
46 views

Blocking reads when writes are happening on two flows

I am trying to implement lock by which I want to avoid reads from happening whenever I am doing a write. My requirements are: Reads block until all three maps have been set for the first time. Now ...
5
votes
2answers
89 views
+100

Generic Networking Class for PHP

I am in the process of writing networking code for PHP that is meant to be used in long-running PHP processes. I realize that PHP is supposedly not well suited for long-running processes, however ...
3
votes
1answer
42 views

Converting Procedural JS Code to Object

I'm new to JS and trying to improve my code with the use of more organised objects. I have the following procedural code which I have converted to an object. It does an ajax load within main. Aside ...
3
votes
1answer
37 views

OO coding style in short Ruby scripts

I've been using Ruby for about a year now, mostly for small scripts with uses ranging from data munging to DevOps tasks. However, I am not intimately familiar with OOP (I appreciate the functional ...
4
votes
3answers
124 views

Case Study - Basic sales tax

The solution was to be assessed, not just on completing the task but also on code quality and design, presence of testing, robustness, maintainability etc. Problem Statement Scenario Basic ...
2
votes
1answer
41 views

Program simulating dictionary using file handling - part 2

This is the new version of the dictionary program which I uploaded for reviewing here. I would be grateful if the program could be reviewed for all the points mentioned in the above link. ...
3
votes
2answers
61 views

Ball Entity for a Entity/Component/System Soccer Game

Here is a code snippet of a class that I be interested to refactor. I was in doubt on how to proceed with the process of instantiation. The original ask was here. After think about it and heard some ...
5
votes
1answer
127 views

Code Golf challenge that plays Mafia

I am working on writing a Code Golf King of the Hill challenge, the details of which can be read here. You can read the full code here. Briefly, the game proceeds in cycles of night then day. There ...
7
votes
3answers
247 views

Go (board game) in Java — version 2

First version: Go (board game) in Java What's new: I now use (as advised) HashMap<GoPoint, StoneColor> where GoPoint ...
-1
votes
1answer
26 views

Globally accessible helper class [closed]

I would like to get opinion if I am doing this right. I am creating a helper class that is globally accessible to my whole project. I want it to be easily called like ...
1
vote
0answers
40 views

Soccer game using libgdx and an Entity System Framework

I'm working in a game as a hobbie. I'm using an Entity/Component/System architecture using Libgdx as Engine and Ashley as Entity Framework. I have a GamePlayScreen in which I initialize my system, ...
2
votes
1answer
48 views

Parking lot and vehicle classes

The expected functionality is that a user/vehicle interacts with a ParkingLot and it allots the space in Park method based on ...
2
votes
0answers
134 views

Procedural to OOP MVC: Understanding Controllers, Models, and Service Layer

I designed a framework to make the switch from procedural to OOP design. This question will contain multiple parts I will bold each question to make reading/dissecting easier. I attempted to look into ...
5
votes
2answers
120 views

Slim API with 3 layer architecture

I'm new to Slim and the three layered approach I'm using below. So far I have the API, a Presentation layer (leaving out for now), a Business Logic Layer, and a Data Access Layer. The code's working, ...
13
votes
4answers
1k views

Go (board game) in Java

Go is a board game (it looks like 5-in-a-row and plays like chess) and I tried to program it in Java. Rules: Two players take turn placing stones on a board. The goal is to capture teritory. ...
1
vote
2answers
37 views

Separate Ajax code in separate modules

This is the first time I am working on OOJS code and I am a beginner in JS. I think I have pretty much messed it up. I am planning to modularize my code, but with the inclusion of ...
0
votes
1answer
34 views

Minesweeper in JavaScript

I have written Minesweeper in JavaScript. Using OO-Approach. Cell class describes a cell in the grid. Cell.t property tells ...
2
votes
2answers
44 views

PHP Autoload Class From Namespace

I wrote this function to be passed as a param in spl_autoload_register(). It autoloads PHP classes from their respective directories using their namespace, named ...
0
votes
1answer
27 views

Implementing quicksort with pivot of first, median or random

I am attempting to implement the quick sort algorithm whereby the pivot will be chosen by the user, and can either be median, first, or random. I am supposed to return a ...
0
votes
1answer
50 views

Define constants in Util class or not

Which is best? I have a bunch of components in my projects. It's related to Ashley (a java entity system) to libgdx (a game engine). this components are like that: ...
-1
votes
2answers
40 views

Varying the parent class dynamically in Python

I am trying to dynamically pick a parent class in Python 2.7: ...
3
votes
1answer
52 views

Interval scheduling problem in C++

The problem I attempted to solve is described as: What is the largest subset of mutually non-overlapping intervals which can be selected from I? Where I is a set of N intervals where each ...
0
votes
1answer
25 views
4
votes
1answer
70 views

Second attempt at a Blackjack game

I posted yesterday about my first attempt at a Blackjack game. After I received much helpful advice I tried my best to fix up my code. I was wondering what you would think about round two! Edit: I ...
8
votes
3answers
674 views

First attempt at a Java Blackjack game

I just completed my first multi class program, Blackjack, and it works! It allows the user to play Blackjack against a single dealer, with no other players at the table. I was wondering, seeing as it ...
6
votes
2answers
98 views

Bank ATM program in Ruby

After reading a bunch of Ruby tutorials, I decide to write fake ATM bank software. I've tried to use OOP design and just want to know if I'm on the right road. ...
6
votes
1answer
60 views

Particle Swarm Optimization

I wrote my first python code to conduct PSO. I am wondering about the best practices for Python. While my code works, I want to make sure it's orthodox as well. For example, here is my class I use ...
2
votes
0answers
25 views

Simulate object.__getattribute__ in Python

I want a Python example that illustrates how object.__getattribute__ resolves instance attribute lookups. I'm looking for feedback about the following code. Is it ...
2
votes
1answer
48 views

Read and output CSV content OO PHP

Okay, I am wanting to expand my armoury within PHP, so I've been researching OO PHP. With my researched knowledge I went on to create a quick script that reads a CSV file and outputs the results. CSV ...
4
votes
4answers
122 views

Find Kth largest element in an array

I am preparing for interviews where my code would be judged based on optimizations, OOP concepts, code readability as well as my knowledge of JAVA and design patterns. What comments will you give in ...
4
votes
1answer
32 views

Ensuring data consistency in a PointsAlongCircle object

I'd like to write classes which are Pythonic, readable and easy-usable. A main issue for me is to keep data consistency. Here is an example (version 1): ...
4
votes
2answers
64 views

Object-oriented approach to sieve of Eratosthenes

I was trying to implement the sieve of Eratosthenes entirely by myself, using only what I have learned so far. Now I'm wondering what I can do to improve my code's readability. Optimizing the ...
2
votes
1answer
87 views

DirectX Window Class

After figuring out DXGI, I wrote a class that combines the act of creating a window and its associated swap chain (as well as an OOP approach to messages). The class supports different window modes ...
8
votes
4answers
408 views

U.S. Postal Service zip code and bar code class

This program accepts either a 27 digit binary bar code of type string, or a 5 digit integer zip code of type int. The program ...
5
votes
1answer
35 views

TicTacToe game in Ruby

I would appreciate any feedback you could offer. I'm self-learning, so I don't really know a "standard" that my code should be up to. I'm also not sure how to get rid of that bit of logic at the ...
4
votes
2answers
83 views

CSV import-export in Python

I have finished a really short and small import / export script using Python 2.7, and now I would like to structure it using classes and methods where possible. Could anybody give me some advice on ...
1
vote
1answer
89 views

Web application for consuming a REST service

The application is a web application that consumes a REST service. Web config has the REST URL along with the parameters. REST URL and the values are passed as ...
4
votes
1answer
52 views

Handling users connection to the application

This is a simple User class that I'm using throughout the application for anything related to the users. To tell if a user is logged in or not, I check the presence ...