Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
3 votes
1 answer
359 views

Streamlining repetitive class definitions in python with a class_factory() function

I forked this repo to be more concise. The code is here. I'll paste it below since that seems to be the style. I removed the class definitions at the bottom that I didn't change -- the edit I'm ...
Patrick Collins's user avatar
9 votes
1 answer
1k views

Critique Request: PHP Request-Method Class

I'm working on a general Requestmethod class which sanitizes and recasts the input of users in an automatic fashion. I've also tried to do array-access in cookies. ...
wandregal's user avatar
2 votes
1 answer
2k views

Representing database row as a class

For my current project, I have elected to represent database rows as objects. So an individual comment can be retrieved as a class like so: ...
Racktash's user avatar
16 votes
1 answer
4k views

Should I put default values of attributes on the prototype to save space?

Suppose I've got a JavaScript function that I'm treating like a class - that is, I want to make many instances of it: ...
Simon Sarris's user avatar
8 votes
3 answers
1k views

Is this Date class well-written?

I'm a C++ beginner and have made a simple class. But I'm not sure if this is well-written. It's basically just a Date class. ...
Normal People Scare Me's user avatar
3 votes
2 answers
833 views

Object-oriented design of list of primes

Is there a better way to implement this class, or does it not constitute implementation in the first place? This is one of my first few tries at OOP. Any suggestions will be much appreciated. <...
albertjorlando's user avatar
2 votes
0 answers
290 views

PHP upload class

I know there are many PHP upload classes out there, but I'm comfortable with my own code, so I made a simple one here. What do you think of my approach when isImage...
Mihai Vilcu's user avatar
13 votes
4 answers
52k views

Text-based RPG game using classes

I am studying for a degree in "Bachelor of Engineering in Information and Communication Technologies." I am currently on vacation, just after we started learning C++ at the end of the semester. I ...
Sumsar1812's user avatar
0 votes
3 answers
1k views

Objective-C class for placing UI elements based on screen size

I'm always programmatically creating and laying out UI elements in multiple ViewControllers and I've wanted an easy way to get relevant Screen information (sizes/points) globally using a helper class. ...
Korey Hinton's user avatar
4 votes
2 answers
711 views

Classes and variables in PHP

First of all, I'm trying to learn OOP PHP, so any advise will be great. My idea is to create some kind of MVC Framework CMS kind of thing, just to learn OOP PHP and MVC well. Let's say that I've got ...
Mathlight's user avatar
  • 251
1 vote
2 answers
153 views

Extending a simple Python console program with external code. Did I handle this correctly?

I'm a hobbyist Python programmer with not much experience. I wrote some code for a solution to a Tic Tac Toe AI problem on the internet. Then yesterday I wrote a simple console Tic Tac Toe game for ...
Russ's user avatar
  • 173
4 votes
1 answer
263 views

Nested Deck class design and implementation

Previous review of this project: Deck and Card classes and member-accessing with one header I'm nearly finished with my deck of cards project, and this time I made changes to hide the ...
Jamal's user avatar
  • 34.9k
6 votes
3 answers
457 views

Deck and Card classes and member-accessing with one header

Previous review of this project: Card Deck class for a Poker game - version 2 This time, I considered combining both classes into one header file so that I can reduce my use of ...
Jamal's user avatar
  • 34.9k
3 votes
2 answers
2k views

Copy object properties without using many if statements

I have two class: InputForm.java ...
emeraldhieu's user avatar
3 votes
4 answers
1k views

Card Deck class for a Poker game - version 2

This code was first critiqued here (without the Card class): Card Deck class for a Poker game After learning more about data structures both online and in class, I wanted to revisit my ...
Jamal's user avatar
  • 34.9k
2 votes
1 answer
5k views

overloaded const and non-const class methods returning references in C++

I have a data-structure class in C++ with an accessor to some object (may be large) and I have const and non-const methods using this accessor so I need to overload it. I am looking for a critique of ...
John's user avatar
  • 123
9 votes
1 answer
17k views

Review of 2d Vector class

I'll keep this short. I've never actually done professional C++. I don't really know any of the 'best practices'. I'd like to get some review on a simple class that I've made. My Vector2d.h file: <...
Tyler Slabinski's user avatar
3 votes
1 answer
99 views

How do I refactor this basic form handler

I've dabbled with PHP for a couple of years, I can generally get what I need done and I've been teaching myself PDO. The problem is I want to set it up with classes but i'm not really sure how to. ...
user1284386's user avatar
6 votes
1 answer
2k views

Playing Card Class - is this right?

The Art and Science of Java, a course book that uses the ACM library, has an exercise that reads like this: Implement a new class called Card that includes the following entries: • Named ...
Antonio Ricardo Diegues Silva's user avatar
3 votes
2 answers
2k views

Accessing MySQL to make queries and scalars

I've developed my own class in ASP.NET project to access MySQL and make queries and scalars, and read the results from it. I want you to review my class and tell me where I've made a mistake. Here ...
user1131997's user avatar
5 votes
1 answer
463 views

Simplifying member functions in Blackjack game

For my display functions in my Blackjack game, I want to control each player's stats output based on whether a turn is in progress or has ended. Normally, you could only see one card that your ...
Jamal's user avatar
  • 34.9k
10 votes
1 answer
158 views

Key Press Handler

I have made a class to import into my projects to more easily handle the state of the keyboard so I can use stuff like: if(Keys.returnKey(37)){ As opposed to ...
Kris Welsh's user avatar
1 vote
1 answer
75 views

autoloader class fine tune to be usable in every project

I'm open to any advice to help improve this code for general use. ...
jgetner's user avatar
  • 111
3 votes
2 answers
4k views

Pong game in Python

I'm writing a pong game in Python and I created classes for the game objects. The top level class is Object, and Ball and <...
Ryan's user avatar
  • 721
2 votes
2 answers
425 views

PDO database class review

I've taken this class and made it my own but I'm curious to know what other think of it? Are there things I'm missing? Anything you can recommend? ...
SeanWM's user avatar
  • 131
4 votes
2 answers
165 views

improve the design of class “accuracy” in Python

I am learning about the class and methods in Python. The class Accuracy is a class of several (13 in total) statistic values between a reference polygon and one or more segmented polygons based on ...
Gianni's user avatar
  • 205
7 votes
2 answers
365 views

Reducing verbosity of RomanNumeral class

I point to my problem in the comments of my code. I have a class RomanNumeral: ...
Ishmael's user avatar
  • 173
7 votes
1 answer
7k views

PHP Extending PDO Class

I am trying to convert myself from using mysql extension to using PDO, with that being said I was curious if I am going about this the right way. I have a custom logging system that I built I am ...
McGee.WIll's user avatar
1 vote
2 answers
958 views

PHP PDO Custom class ple

i created a database class from a good tutorial and wanted to put it up here so it would get in some search results. it took me about 2 days to find it. also i added a few custom functions to it.. ...
Trae Moore's user avatar
2 votes
2 answers
3k views

Consistent implementation of PHP class constants (arrays not allowed)

I'm currently writing a class: ...
ComFreek's user avatar
  • 751
0 votes
1 answer
81 views

Is declaring a property as `public` insecure?

I posted a question few weeks back, on making a PHP Login Script. Most of you guys told me not to use global variables and especially for something like MySQLi ...
ShuklaSannidhya's user avatar
8 votes
3 answers
920 views

Class with a sometimes unused property

From times to times I stumble over the following situation: I have got a class with a property that's only used if another property has a particular value, for instance: ...
Eduardo Brites's user avatar
7 votes
2 answers
6k views

Playing cards in C++

I am currently learning C++ (note: I am using C++11) and have begun working on a small project to practice what I've been learning. This project is a deck of cards that I hope to use later to create ...
kamek's user avatar
  • 173
4 votes
2 answers
5k views

Stringed musical instrument class

I humbly submit the following for critique. This was my final project for an Intro To Java Programming class ("handed-in" already, I can't make changes). The abundant commenting is required by the ...
MayNotBe's user avatar
  • 141
1 vote
1 answer
3k views

Organizing classes for Blackjack game

I have to write a Blackjack game for college using the Processing language. It has to be done in a strict object-oriented approach, so I can't make an object of a class in another class unless there ...
eMRe's user avatar
  • 203
0 votes
1 answer
439 views

Making a Custom class less specialized but just as understandable?

In my C# program, I have a class defined as follows: ...
Matt Rohde's user avatar
3 votes
2 answers
1k views

BinaryTree class with extra methods

I am taking a data structures course. I would like to check whether my BinaryTree code is perfect, fine or has lots of mistakes. I would like any kind of advice ...
malhobayyeb's user avatar
1 vote
2 answers
122 views

Request for help to tidy up code involving arrays and loops

I posted the following code on here a few days ago: ...
Andrew Martin's user avatar
2 votes
2 answers
340 views

Wiki API getter

I know there are other Python wiki API classes out there. I'm writing this one because I don't need all the bells and whistles, no edits, no talks, etc. I just need to be able to search for titles and ...
Justin808's user avatar
  • 775
2 votes
1 answer
138 views

Is this a good JavaScript class?

I'm trying to get my head around object oriented programming, and I'm starting in JavaScript. I have put a working demo of my code on JSFiddle (here), but the class is below. My main concerns are ...
Grezzo's user avatar
  • 123
5 votes
2 answers
6k views

Validation and Form classes

I have written Validation and Form classes in PHP. Validation class allow you to define the ...
I'll-Be-Back's user avatar
2 votes
1 answer
546 views

Help improve my first PHP class

I recently started to learn more about OOP in PHP and I created a website for testing. I have 4 classes: database, user, ...
Ovidiu's user avatar
  • 39
4 votes
1 answer
982 views

Avoid explicitly writing base class state in a derived class. Suggestions for my method

I have two classes one base Foo class and one derived Bar class. Each class has its own associated settings class that can create a new instance from the Load method. This way all derived class ...
user1423893's user avatar
5 votes
1 answer
3k views

Simple Socket class hierarchy

One of the things I wanted to do was make it impossible to forget to initialise or forget to cleanup WSA. Often the network examples will return as soon as an error occurs (say an socket didn't bind) ...
Borgleader's user avatar
4 votes
1 answer
11k views

PHP Config Class

I'm working on a config class for PHP, where I can easily bring in config options. Any improvements/suggestions are appreciated. Example usage: ...
user avatar
3 votes
1 answer
376 views

Is my base class constructed correctly?

I have tables that use BulkManager to save data to database. I moved common functionality to BulkTableBase. Because creation of ...
theateist's user avatar
  • 263
5 votes
2 answers
285 views

Javascript inheritance

I have a simple class inheritance in JS: ...
Matteo Pagliazzi's user avatar
1 vote
2 answers
6k views

Python: keeping track of info across classes by storing a variable to self

I wrote the following code to test a score-keeping class. The idea was to keep score of a game such that the score was kept across multiple classes and methods. I'm looking for any input on being ...
DBWeinstein's user avatar
3 votes
2 answers
165 views

Subclassing or not?

I have a class called Foo ...
Premraj's user avatar
  • 131
1 vote
1 answer
3k views

Reversi move class

I redid a Python Reversi move preview routine that is online. I could use comments about using Python better and/or better OOP design since the original did not use classes. There are three main ...
jlim's user avatar
  • 103

1
5 6 7
8
9