Questions tagged [classes]
Core to Object-Oriented Programming (OOP), a class is a template for creating new objects that describes the common state(s) and behavior(s).
420
questions
0
votes
0
answers
25
views
Python3 tokenizer abstract baseclass ( Without the permission to be instantiated directly )
Greetings.
I'm a newbie python developer, and fortunately I have been introduced to the principle of Abstract base classes and they seemed pretty interesting to tackle while going forward in my python ...
1
vote
1
answer
180
views
Python3 currency abstract class (without the permission to be instantiated directly)
I'm a newbie python developer who accidentally studied the concept of
Abstract classes
and I found it pretty much helpful to implement due to the SOLID principles.
At the very moment of testing and ...
2
votes
2
answers
114
views
Defining hardware components structure
I'm writing firmware for my Arduino project, and I'm struggling with a clean, scalable hardware mapping structure. Initially, I had the following namespace:
...
4
votes
1
answer
58
views
Improving readability of semi-nested classes for loading data of separate runs of a joint testing campaign
A bit of background:
Most often I am analysing data (mostly timeseries) of mechanical machine conditions (vibrations, temperatures...) that were acquired in different 'runs'. All runs were acquired ...
1
vote
0
answers
50
views
Memory game code quality
I am making an incremental-memory-game similar to this https://www.crazygames.com/game/incremental-memory
I am not very satisfied of how spaghetti this code is. I am trying to learn to improve my code ...
4
votes
1
answer
165
views
Blog site generator in python
Summary:
This project is a simple static blog site generator written in python, utilizing pandoc to convert posts written in Markdown to HTML. It is essentially a follow up to my previous post: blog ...
7
votes
3
answers
174
views
C++ String Class Reimplementation
I started learning C++ about a week ago and I was hoping somebody can critique my code. I decided to implement my own basic String class just for the sake of applying all that I've learned about ...
0
votes
1
answer
81
views
PHP Class to render HTML div styled tables v2 [reviewed by me]
After my previous question I made several changes and came up with this. Remember: I wrote this for PHP 7.0.33. I'm aware I should upgrade, save the advice :)
...
5
votes
3
answers
724
views
Library: Point class
Recently I made a point dataclass and a point_calc class which performs various commonly used algorithms on a point.
...
2
votes
1
answer
281
views
PHP Class to render HTML div styled tables v1
This class aims to render an HTML compliant div styled table. I added a help() method that provides usage and styling in a more user-friendly way. Besides the ...
2
votes
1
answer
99
views
HTML form Class
After my previous question I revised the code to the code below. I am using PHP 7.0.33 and tried to accomplish PSR-12 as much as I could. In "condensed usage" in the docblock you can find a ...
3
votes
2
answers
579
views
PHP HTML form Class - so far so good?
I am writing this class to render HTML forms. It is working as expected, so far. There are many things to be done yet (including testing). Is it ok to keep this way?
...
2
votes
1
answer
88
views
PHP Pagination class (Clase para paginar resultados)
This is my first question in Code Review. I apologize in advance for using Spanish (my native language). I thought there was a spanish version of Code Review.
This class is meant for pagination. It ...
-4
votes
1
answer
78
views
any bits unsigned integer [closed]
This is a class that acts as an unsigned integer with a variable amount of bits.
...
1
vote
0
answers
69
views
Storing multiple PyTorch tensors of different shapes with names that are not known by advance
I need to create a container for instances of torch.Tensor of different shapes, where I can call them by their name.
It is a use case for a dict except that:
I don't want to rely on the heavy syntax ...
2
votes
1
answer
99
views
Making a game using python and pygame
I am making a game using python and pygame and as my game started to grow, in some of my classes the number of instance variables started to get big.
Like in the settings class is like this:
...
1
vote
2
answers
139
views
A simple String class and its special member functions
I am learning the behavior of C++'s special member function, using a naive String class as example. (The code is modified from this tutorial) Here is the ...
2
votes
1
answer
104
views
Java program for complex math utilities
I've got 2 Java programs, with the aim of solving some matrix math that involves complex numbers (an EE problem). Both programs have main functions, the one with all the complex math operations has a ...
0
votes
1
answer
72
views
GPG class for AJAX calls
I want to know if this GPG class in PHP is up to snuff as a professional-level class. I did my best to include everything and make it easy to use. I'm calling the object by invoke(). If anyone can ...
2
votes
3
answers
129
views
Rock Paper Scissors with file save/load
Took me a couple days and I had to make 2 versions. Version 1.2 is better looking and more readable, with better functionality. No where near optimized though, as I know nothing about that.
Save and ...
1
vote
1
answer
144
views
Interconnect Recipe and Notes
I'm currently working through a tutorial. The project is a recipe website.
One of the lessons to "save some lines of code" and use bidirectional setters for bidirectional relations of ...
4
votes
1
answer
197
views
Simple console menu backend with calculator implementation in Python
I've written a simple calculator in Python. I want to show not much effect of the action but the logic behind it, by that I mean console menu implementation in the ...
1
vote
0
answers
56
views
A Haskell-style "maybe" type in Python, version 2
I have decided on a preferred solution to my question A maybe type in Python. Which implementation is best?, and have expanded it to be more ergonomic. I have implemented a host of utility functions (...
0
votes
0
answers
692
views
football team results in python
The program is taken on the standard input a list of football team games with the result of the match and displays on the standard output a summary table of the results of all matches.
A team is ...
1
vote
0
answers
67
views
Powershell Outlook Email Security custom classes
This provides custom classes to work with Outlook 2016's email security settings in trust center. Included are some top level functions to list outlook profiles, retrieve the data from a given profile,...
2
votes
1
answer
201
views
Fetch data from two exchanges
I'm trying to fetch the latest price from two exchanges and to do further actions based on the prices.
exchanges.py:
...
0
votes
0
answers
75
views
Investment capital calculator(Python)
The program is simulate a situation where my goal is to lose money in Corresponding exchange, however I will win max_lose times ...
1
vote
1
answer
41
views
Sparse String Matrix Storage Class C++
Introduction
I implemented a class to store a matrix with entries at positions (i,j) that are strings. The matrices I would like to efficiently store in this class have strings as entries and it ...
2
votes
1
answer
157
views
Create a string "Build" number for procedures and module
The class assigns various strings to the build number. So the build might look like 3.4.5.1 which would be of the format ...
1
vote
1
answer
149
views
A greedy approach to the Knapsack problem with C++ templates
The assignment is to be implemented on the following instructions:
You are to write a Knapsack class and the main() to support and
demonstrate the functionality required here.
A function generate(int)...
3
votes
1
answer
439
views
Movie app using fetch API
The code will create a new Movie class and then with the response of the API call, will render html using the data.
Although the code works, I imagine it will get quite convoluted, now that everything ...
2
votes
2
answers
56
views
Object Oriented Hangman in Python (version 1.0)
As always, I am looking for as much criticism as possible. Forums and exchanges like this are where I have received my most solid feedback.
Enjoy!
Github hangman repository
The code that I import is ...
2
votes
2
answers
417
views
Python: Sorting Marbles with switch and rotate - Need help in optimizing a working solution
I have made a couple modifications to the switch/rotate routine for the classic Marbles game. The modifications are
Using a random_select method that can help pick either switch or rotate
Create a ...
0
votes
1
answer
410
views
What can I do better in my C++ serialization implementation?
I want to serialize a class Mango recursively.
...
4
votes
1
answer
144
views
Alpha finance trader singleton
I used to write singleton in Python, which actually Alpha only need to initialize once and the trading bot will run forever. For example in main.py:
...
0
votes
0
answers
255
views
Function block diagram code in CPP to program Arduino
I have created a processing program (Java) with which a programmer can use a GUI to make a program for an Arduino using logic function blocks. It looks like this:
Ofcourse it still needs some work. I ...
4
votes
2
answers
110
views
A simple and fast library/code to store & manage variable data
I've been searching through the different ways to store data and found some helpful and actually great libs like:
JSON
XML
And some neh:
text file basic write and read
some binary type data storing?...
2
votes
1
answer
253
views
Generating random number of randomly sized Squares/Rectangles using numpy arrays
I made classes to use in generating square/rectangular shapes on a texture.
...
2
votes
2
answers
170
views
Template Complex class
I have created a class Complex which represents a complex number of any arbitrary arithmetic type. Overloads are given for the 4 common functions, addition, ...
8
votes
5
answers
2k
views
ReversibleList: a list that is "reversed" in O(1) time
UPDATE: Thanks everyone for the suggestions! I made a follow up version here which fixes the bugs, incorporates the feedback, and has more tests.
A ReversibleList ...
2
votes
1
answer
371
views
Object-oriented Snake game in HTML without using canvas
I wanted to try out classes in Javascript and implemented a snake game. You can control the snake by using the arrow keys.
I would be interested to know if the source code can be improved in terms of ...
0
votes
1
answer
147
views
Equation calculator
Function
Calculates values for user defined equations. Just a concept right now. I plan to add many more equations.
Equations in code
Density:
$$ p = \frac{m}{v} $$
Speed:
$$ s = u + a \cdot t $$
<...
3
votes
2
answers
488
views
MP3 Playlist Class in Python
Background Info
I am an intermediate level Python programmer. This is my implementation of a MP3 Playlist class challenge that was hosted on 101 Computing.Net. The ...
0
votes
1
answer
268
views
Common interface for fixed-length and variable-length lists in C#
I am working on library project in which I am reading and writing binary files that have own file format structure. In that structure there are variable-length and fixed-length elements. My approach ...
1
vote
1
answer
261
views
Monster Maker application in Tkinter
I have a program that works okay (not fully completed) however, I would like to simplify things and create some classes and different .py files for my tkinter app as I feel that would help organize ...
3
votes
1
answer
197
views
Topological Sort C++
Comments on optimizing the code or improving the code are requested. The input parameters to the class constructor are a one dimensional array of job ID's and the second argument is a list of vectors ...
2
votes
1
answer
654
views
Sudoku Tkinter generator
I made OOP sudoku generator - at this moment it generates only valid table. You can clear it and then generate over.
The case is I struggled with calling "fill_board" and "clear_board&...
1
vote
3
answers
1k
views
Saving Multiple Lists to Database - C# Forms
I am trying to store multiple lists to a database but I'm struggling on finding a better way of doing it, as the way I am doing it now, seems to be incorrect.
On my form, I have 6 different legs. Each ...
2
votes
1
answer
103
views
UpdateCustomer - implementation in C++
I am trying to write a program that does the following:
The application will read the customer and book orders data from a
data file “BookOrders.txt” and load them in a customer linked list,
each ...
1
vote
1
answer
174
views
ASCII game in console [closed]
Overall, I want to make a game in console, something Pokemon-like but with typical rpg scenery - swords, magic and all that. I want to make player able to move around the map, find dungeons, fight ...