Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [object-oriented]

Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.

11
votes
0answers
1k views

Object-Oriented Chess Game in Ruby

I wrote a chess game in Ruby using object-oriented principles. One of the challenges was deciding which particular methods/actions belonged to a particular class, as there were some that felt as if ...
9
votes
0answers
144 views

BattleShip - Ships & Players

I'm making a full-blown OOP Battleship game in VBA (previous post: Battleship Grid), and I want this code to be as good as it gets - and better, if I can. I've refactored a few things, introduced a <...
7
votes
0answers
134 views

Web Battleship -The Unofficial Battleship UI

I've written my own UI for Mathieu Guindon's VBA Battleship (Battleship UI: GameSheet) which uses a webpage in a WebBrowser control for the View. Webform: Userform ...
7
votes
0answers
41 views

Perl Script to import flat-file versioned files into git repositories

I wrote a perl script to import local files with "File-Ending-Versioning" (like file.1.12.pm) into a git repository. I tried to use the concept of roles in this script and I am not shure if I applied ...
6
votes
0answers
23 views

Free body diagram generator using MVP for VBA

Based on my understanding of Model View Presenter (MVP) I have it generate a diagram. Is this a correct implementation of MVP? What deficiencies are there in my implementation? UI Generated diagram ...
6
votes
0answers
74 views

Using decorated methods in a subclass of deque to dump its state to a JSON file

I am sub-classing an object in python and I need to overload a bunch of the methods with very similar logic, essentially a call to super() and then some additional operations. I want to avoid ...
6
votes
0answers
121 views

Python class for organizing images for machine learning

I built a class to help me handle image data to use in machine learning. I thought that there would be a pre-existing package that did what I wanted but I couldn't find it so I wrote this. I am not ...
6
votes
0answers
133 views

Security Helper Class According To NIST SP800-63B Guidelines

I've created a security helper class that attempts to adhere to the National Institute of Standards and Technology (NIST) "Digital Identity Guidelines" SP800-63B [June 2017] specs. These guidelines ...
6
votes
0answers
217 views

C++ Parsing with chain of responsibility

The task was to create the parser for the string input, that would return the std::vector< int > of parsed numeric results and the type of given input (e.g. numbers, division by zero error, out of ...
6
votes
0answers
938 views

Flask view dependency injection

so, first of all, I've been into trying to have a simple dependency container as possible in python and with your help managed to get conceive https://github.com/dareenzo/tinydic, many thanks. Now, I ...
6
votes
0answers
132 views

Object-oriented WordPress plugin

Note: This plugin is / was never intended to be submitted to repo just for personal use but the questions still apply to general Plugin Development. This plugin listens for ...
5
votes
0answers
61 views

Prototype GameManager for game written in Unity

I am self taught, so I'm consistently seeking ways to code better, and more efficiently. If anyone has the time, please advise me on what can be done better with explanations as to why the old method ...
5
votes
0answers
186 views

Battleship MVC Architecture

The entry point is the Macros module, which - for now - includes only a single procedure, at a very high abstraction level - I'm quite happy with this: ...
5
votes
0answers
257 views

ATB strategy MVC architecture refactoring

NOTE: this question isn't as long as it appears to be. I added the comments to the code only to answer some possible questions that may appear. I'm making an active time battle strategy. Its ...
5
votes
0answers
343 views

Writing a metaclass to ensure a class is thread-safe

Python allows the creation of classes to be modified via metaclasses. They can perform all sorts of operations that might appear to be magical to languages that do not have the capability. The goal of ...
5
votes
0answers
155 views

Object-Oriented Sorting Algorithms

I would like a review of a library I've recently published. I realize this is a rather large request, but having looked on meta, it seems this is perfectly on-topic. I'll include a few choice samples ...
5
votes
0answers
67 views

Artificial perceptron in python3

I have designed a very basic perceptron (single layer neural network) that has been mostly successful in learning basic linearly separable problems. The perceptron in defined as a class with ...
5
votes
0answers
60 views

Model for a multi-channel programmable electrical power supply

I am modeling a programmable electrical power supply which has multiple independent channels (or "ports") in a class I'm calling Supply. One of its features is the ...
5
votes
0answers
285 views

Object-oriented fractal tree

I made an object oriented fractal tree in javascript using the p5 library, it consists of three files: Fraternal Tree.js branch.js flower.js Here is the github repo with the source code. All the ...
5
votes
0answers
73 views

Python-style object library for Clojure

Background I am authoring pulley.objective, an Open Source library that provides an object system inspired by Python's object model. I have some features ...
5
votes
0answers
356 views

SVG mosaic creator

Although my code works as expected, there are a few gotchas. A single row is not filled at once; instead, I can see partially filled rows during the rendering process(Fixed in the updated code below.)...
5
votes
0answers
62 views

Node that makes bots jump with weapon thrust

Today I decided to continue working on a UnrealScript (Unreal Engine 1) class that lets bots jump onto ledges by firing weapons beneath themselves. (The only problem is that they don't aim and jump ...
5
votes
0answers
9k views

Simple Router class

I made a simple routing class that I like to get reviews for, mostly because I do not know how to make it SOLID, since I even made this class separate from the HTTP response/request for the sake of ...
5
votes
0answers
645 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 ...
4
votes
0answers
52 views

Tracker for object construction, copy, and movement

I made an object tracker for debugging and testing purposes called ccm_counter (construction, copy, move counter). It counts constructor, copy and move calls. It ...
4
votes
0answers
70 views

Two player snake game

I created a 2 player Snake game from my original one player version. I am looking for some feedback on how I made it. I think I could use improvement when handling input (...
4
votes
0answers
80 views

So what if the “View” in an MVC isn't a Userform, but is the Worksheet?

So I've been following the discussions around VBA as an OOP language and the applicability of various design patterns, such as MVP or MVC. Excellent postings on these topics are extremely informative ...
4
votes
0answers
158 views

Python Class to represent a Pokemon

I have been programming with Python on-and-off for about 2 years now, even now I still find that when I look at other applications I struggle to follow along with their classes/objects. Please help me ...
4
votes
0answers
97 views

Data processing program

I'm working on part of a service for data processing. The main idea of the service is to get the input data, process it and return the processed data to another service. Input and output data format ...
4
votes
0answers
35 views

Class based Kjijii Webscraper

Using PowerShell I have made a class based Kijiji webscraper that records progress in a MariaDB table (for use in another project). I had made this as a module with cmdlets months ago but I wanted to ...
4
votes
0answers
53 views

Viewport for Card Match Game

This is the 2nd half of my Memory game. The first half can be found here. The repository can be found on Github. I am using SFML 2.4.2. In this project I focused on a few key aspects of design and ...
4
votes
0answers
386 views

Object-relational mapper for VBA / MS-Access

This is my attempt to create simple object-relational mappers (ORM) in VBA for DAO and ADODB recordsets to reduce boilerplate code when converting data between recordsets and objects. As far as I've ...
4
votes
0answers
113 views

Simple command user interface for conditional logic

This is a command-line interface wrap for any application involving conditional logic. I have posted the source here on bitbucket. Usage: Myself using as a starting point for a time series ...
4
votes
0answers
107 views

Given a string of letters, output all English words formable using only those letters

As an introduction to Python classes and an exercise in recursion / tree-traversal, I wrote a small script that forms all English words using only the letters in an input string. Useful for things ...
4
votes
0answers
49 views

Mechanism for providing timeout notifications when traffic ceases

I'm trying to build a nicely encapsulated mechanism for providing timeouts that wait for a signalling channel to go quiet for a duration. As a fun study of ...
4
votes
0answers
100 views

Load data from WebAPI to the ViewController

My current code working perfectly, it is for data load from web api to the UIViewController (UITableView). But I am confused ...
4
votes
0answers
64 views

sk-learn like model

I am trying to make a simple model that returns the conditional expectation of a target with respect to the value observed for another variable. Basically, given a feature \$F\$, a level of this ...
4
votes
0answers
304 views

PyQt GUI to add and remove dots

Initially I got this code: ...
4
votes
0answers
140 views

2d game enemy entities factories, probably in need of refactoring

So I'm making a 2d shoot'em up game as a way of learning canvas, and larger-scale programming than what I'm accustomed to. I'm a purely front-end web dev, I can't say I'm very experienced in this. ...
4
votes
0answers
164 views

Simple Snake Game - Follow-up 2

Based on the previous question, I have implemented all suggestions. Also, I worked a bit in this project to improve it. Summary of improvements: split the code into multiple files as .hpp and .cpp ...
4
votes
0answers
77 views

Creating companion classes that are `inherited` onto any sub-classes

The idea for the code I have written came about due to the acts_as_versioned gem which automatically nests a Version class onto ...
4
votes
0answers
71 views

Comparison of sprite movement implementations

I've come up with two ways to do sprite movement with CreateJS, and I'm wondering if one is better than the other as far as performance and maintainability. The player data is saved in a json file ...
4
votes
0answers
265 views

Building Data abstraction and ADT for rectangle using “objects”

For the below given exercise: Exercise 7: Abstracting Rectangles Implement a representation for rectangles in a plane. (Hint: You may want to make use of your procedures from exercise 5). Then,...
4
votes
0answers
9k views

An Object-Oriented Programming pattern for AngularJS models using CoffeeScript classes

Over the past week, we tried to make our AngularJS model layer more powerful and reduce complexity in our controllers and template by using the object-oriented programming pattern and the CoffeeScript ...
3
votes
0answers
41 views

Object-Oriented Breadth-First Search Implementation

My goal is to write a GUI application where a user can create a maze and select an algorithm. The passage of the algorithm from a selected start and end point should be visualized. The following ...
3
votes
0answers
43 views

Metaclass to run a __first__ method for the first instantiation of a class

I had an idea for a __first__ special method for a class. It would be run after __new__ and before ...
3
votes
0answers
28 views

Generic router in Rust

I am trying to make a router in Rust using Rocket.rs. I'd like to devise a way to use a default router for my more simple db tables that don't require different logic, to prevent rewriting the same ...
3
votes
0answers
44 views

Playing card object

I am writing this class to eventually create a playing card game (Spades) and also to utilize the object oriented paradigm. This was my attempt to model a card as an object. Each card has a suit and a ...
3
votes
0answers
153 views

Design an object oriented parking lot

I solved this system design interview question. The problem description Design a parking lot Constraints and assumptions What types of vehicles should we support? Motorcycle, ...
3
votes
0answers
50 views

Amateur Python Sudoku Solver

I'm self-taught in Python and would have a lot of room for improvement. I made this basic Sudoku Solver mainly in order to practice the use of Class creation. I would greatly appreciate any feedback ...