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
22 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
35 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
113 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
93 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
36 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
32 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
41 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
26 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
48 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: ...
0
votes
0answers
26 views

Avoiding action class proliferation in my dialogue system

I'm running into an issue of class proliferation in my dialogue system. The system works fine as it is, but I just finished writing out a list of possible actions that could happen based on the ...
-1
votes
2answers
37 views

Varying the parent class dynamically in Python

I am trying to dynamically pick a parent class in Python 2.7: ...
3
votes
1answer
51 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
68 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
669 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
92 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
59 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
21 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
46 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
116 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
30 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
62 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
83 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
389 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
32 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
76 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
87 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
44 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 ...
4
votes
1answer
68 views

HND Java module (vending machine simulator)

As part of the distinction requirement, I am required to ask for testing/review of my code. There was no time allotted for this in class, and as such I am turning to the folks of StackExchange for ...
8
votes
3answers
172 views

Implementing OOP in this Java word count program

I wrote a program that reads a text file and then outputs the unique words, their frequency, and the line numbers that word appears on. It also counts the number of sentences in the text file. All ...
2
votes
1answer
31 views

Easily registering WordPress custom post types and taxonomies

I am developing a library to easily register WordPress custom post types and taxonomies. But the problem is I can't use one instance of object because of adding the object in WordPress hooks. So ...
5
votes
0answers
42 views

ECMAScript text component

At the moment, I'm learing ES6 and how to write classes. And I'd like to know if I'm doing things right and I have some points that are not clear to me. Please find my code here at bitbucket and ...
6
votes
1answer
60 views

Temporary file utility class in Python

I decided to write a tiny class to automatically write and delete a file given filename and content. It is intended to make testing IO less verbose. I include a small example usage. ...
1
vote
1answer
88 views

Parsing video files from a given directory

I have written a little class that is basicly looking for video files in given directory and then parsing some info about those files. Finally it saves everything in a list. To properly run this you ...
11
votes
4answers
1k views

Simple text RPG in Python

I am trying to teach myself to code using Python. The following is the first real program I have written from scratch. I feel that it is messy and in need of improvement, but I am either unsure of ...
2
votes
2answers
53 views

Binary Conversion in Java

Before implementing a GUI I tried performing it at CLI first and I also tried to implement it by using calling methods to another class. ...
6
votes
4answers
109 views
6
votes
2answers
148 views

Rock, Paper, Scissors Game in C++

Below you will find my first attempt at a C++ implementation of the classic game Rock, Paper, Scissors. If someone could look it over and point out or suggest any things that I could change to improve ...
2
votes
1answer
42 views

Different methods of API that use similar Services

I have three methods in API running similar code snippets. For this reuse the code inserted a switch-case according to the API method. It's good practice that? I ...
4
votes
3answers
124 views

Object-oriented rock-paper-sciccors game

This is my code for a simple rock-paper-scissors game. Users have the choice between playing against a computer or watching a "computer player" play another "computer player". The code for the ...
3
votes
1answer
44 views

Generating realistic terrain data - Part 2

I've made a "heightmap" terrain generator similar to my previous one, except this one has some improvements, and some new features. The way this one works is similar to my last one, but slightly ...
-1
votes
2answers
44 views

A simpler multiply and addition polynomial function [closed]

I'm working on a project where I have 2 classes, one class for Monomials and another one for polynomials which are built out of monomials. I would like to make a simpler method for adding and ...
0
votes
1answer
28 views

Python class inheritance with parameters [closed]

Is this the preferred/confect way to write class inheritance with parameters? ...
3
votes
1answer
58 views

Business logic in service method

I'm currently writing a small asset tracking system. The implementation should meet the following requirements: The system; scans the transfers every 15 minutes. If the transfer is accepted by ...
3
votes
1answer
82 views

Football Data Design

I'm working with the XMLSOCCER.COM API. I'm a little confused with how to best design the application. The problem I'm facing is that teams do not have a league ID so I couldn't associate a team with ...
12
votes
1answer
118 views

Data item prototype in a Javascript data structure where object instance functions see own data

I'm working on a complex Javascript application which includes its own data structure. The previous version's data structure was rather chaotic, and I'm looking to replace it with something where: ...
42
votes
10answers
4k views

Sales tax calculator, rejected for being not OOP

I applied for an Application Developer position. They require all their applicants to complete 1 of 3 programming assignments. I picked one for sales tax calculation. It was quite simple. ...
10
votes
3answers
102 views

Simulating a river ecosystem

I'm currently working my way through a textbook to enhance my beginner Python skills (Goodrich, Data Structures and Algorithms in Python). The first, somewhat in-depth problem involving OOP was the ...
7
votes
1answer
55 views

Tic Tac Toe implementation in Ruby

Here's my first shot at implementing Tic Tac Toe in Ruby. After watching Gary Bernhardt's Functional Core, Imperative Shell, I thought this would be a great exercise in trying out the ideology ...