Construct that is used as template for creating new objects. Class describes the state and behavior that the objects of the class all share.
0
votes
0answers
21 views
Another php upload class
i know there are many php upload classes out there but i'm mostly comfortable with my own code.
So i made a simple one here.
I'm interested about your opinion on the approach on image files in case ...
0
votes
0answers
15 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. ...
-1
votes
1answer
44 views
Problem using private Int Data Variable [closed]
I have this problem
xyz.h
class xyz{
private:
int number;
bool **matrix;
public:
xyz*fun(int number);
int fun1(xyz*point);
};
xyz.cpp
xyz*xyz::fun(int ...
3
votes
2answers
186 views
PHP Classes and variables
Hy all,
First of all, i'm trying to learn OOP PHP, so any advise will be great ( and sorry for the bad English ).
The later idea is to create some kind of MVC Framework CMS kind of thing, just to ...
0
votes
2answers
47 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 ...
1
vote
1answer
93 views
Should I use a class as a class factory in Python?
As a bit of a learning project, I decided to take the concept of proxying objects a bit further and extend it to creating proxy classes which create proxy'd objects. I originally found the idea of ...
2
votes
1answer
82 views
Is this nested class design ineffective for my Deck class?
Previous review of this project: Proper use of multiple 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 Card ...
1
vote
2answers
44 views
Proper use of multiple classes and member-accessing with one header?
Previous review of this project: Am I following any bad practices in my updated Card and Deck classes?
This time, I considered combining both classes into one header file so that I can reduce my use ...
2
votes
2answers
84 views
Copy object properties without using many if statements
I have two class:
InputForm.java
public class InputForm {
private String brandCode;
private String caution;
public String getBrandCode() {
return brandCode;
}
public ...
1
vote
1answer
67 views
Am I following any bad practices in my updated Card and Deck classes?
This code was first critiqued here (without the Card class): Please critique my C++ Deck class
After learning more about data structures both online and in class, I wanted to revisit my Card and Deck ...
2
votes
1answer
57 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 ...
3
votes
1answer
83 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:
...
2
votes
2answers
79 views
Best coding practice for classes
I just have a somewhat simple question on coding practices. I have never written a large application before and I am currently working on building a game engine in Javascript. The part that confuses ...
3
votes
1answer
52 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.
...
1
vote
0answers
34 views
Meta programming: dupping Rails model
Can someone please review my code:
# dup/ish -> //github.com/rails/rails/issues/5449
class Form
include Mongoid::Document
attr_accessor :source
def self.ish(prefix, suffix, &block)
...
-1
votes
1answer
64 views
Java Question for An Absolute Beginner [closed]
This is for a beginning Java course that poses the problem:
Write a class named Employee that has the following fields:
name. The name field references a String object that holds the employee's ...
3
votes
1answer
125 views
Fun with probability theory. Suggestions?
I want to play around with the Powerball lotto drawing history. What other probability theories could I try or what other probability class libraries exist. The code parses the file very quickly but ...
5
votes
3answers
512 views
Is it wrong to write an entire program under one class/method in Java?
I'm new to programming an created a simple rock, paper, scissors game. The entire program is under a single class and the main method, i hear that's probably not the best way to code.
How should i ...
1
vote
1answer
115 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 ...
4
votes
4answers
169 views
General advice on a practice linked_list for C++ classes/templates
Introduction
I'm learning C++ (Coming from Haskell, C, and Assembly - and other languages sparsely) and this was my practice with classes and templates. It's a linked list that you can call in this ...
1
vote
2answers
102 views
MySQL GEAR, C# class for ASP.NET project
I've developed my own class in ASP.NET project to access MySQL and make queries, scalars and read the result from it.
I want you to review my class and tell me where did I make a mistake, thanks!
...
1
vote
1answer
66 views
How to simplify code for display member functions?
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 ...
1
vote
1answer
43 views
Possible “shortcut” for accessing multiple data members?
In my Blackjack game so far, I have multiple classes that access each other frequently. For example, this is my hit() function for the Game class:
void Game::hit(unsigned playerNum)
{
Card ...
1
vote
0answers
46 views
General Code Review - 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 setting up key listeners.
Could you ...
1
vote
1answer
44 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.
/**
*
* This code was created by Joshua Getner.
* @license http://opensource.org/licenses/bsd-license.php BSD
*
*
*/
namespace ...
2
votes
3answers
109 views
Python: How much logic is enough logic, and how much is too much logic in an __init__ method?
I am writing an email parser and cannot decide how much logic should be included in the __init__ function. I know, a constructor should make the object ready for use, but are there best practices to ...
1
vote
2answers
101 views
Is this class structure good?
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 Paddle inherit from it. And ComputerPaddle is a child class of Paddle.
# ...
2
votes
2answers
92 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?
class Database {
private $host = '';
private ...
0
votes
2answers
79 views
I would just like to find out if the code below is the correct way of creating a generic list and populating it?
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Text;
public class InnerJoinTables
{
public ...
3
votes
2answers
90 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 ...
5
votes
2answers
194 views
How can I make this method less verbose?
I point to my problem in the comments of my code.
I have a class RomanNumeral:
public class RomanNumeral {
private String romaNumera;
private String romans = "IVXLCDM";
public ...
-1
votes
1answer
96 views
I'm a C programmer moving to C++, am I using classes and templates correctly? [closed]
I took a quick look at the C++ documentation on templates and classes. I'm not entirely sure if I'm using the features(read: syntax) properly, but I get the concepts.
I have to admit that scope is a ...
0
votes
1answer
340 views
Please critique my C++ Deck class
I have recently finished creating my own Deck class for my Poker game. It works the way I want it to, but I would like to know if I can make it better and/or more efficient. Here's what I have:
...
4
votes
1answer
392 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 ...
0
votes
2answers
101 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.. ...
0
votes
0answers
47 views
I would like to ask for suggestions, criticisms and/or possible edits on my class file to be used on an Android Applciation?
I have a class file that would be used to connect and execute queries into the database. The only thing I am confused about is this: do you really need to drop tables and re-create them everytime you ...
0
votes
2answers
91 views
Consistent implementation of PHP class constants (arrays not allowed)
I'm currently writing a class:
final class MyTestClass {
const URL = 'http://www.example.org';
private static $MY_ARRAY = array('...');
// since this is not allowed
// const MY_ARRAY = ...
0
votes
1answer
47 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 connection object as it may be insecure. ...
0
votes
1answer
323 views
Good, flexible and secure MVC router PHP
I have developed a new router after having learnt a lot from my previous attempts and I will be using this in sites I make from now on.
In a previous question, the issue of REQUEST_URI being too ...
7
votes
3answers
337 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:
public enum ...
5
votes
1answer
105 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 ...
4
votes
3answers
205 views
OOP Classes, how to put class in class
I've started to learn an OOP and I've built a class called accountactions, and I would like to know if I did a good job writing it.
The class is in the file: accountactions.class.php.
<?php
...
3
votes
2answers
296 views
School project critique
This is a long one, I'll edit as instructed.
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).
...
0
votes
1answer
298 views
How to organize classes for blackjack game
I have to write blackjack game for college using 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 is some ...
2
votes
1answer
142 views
Please review my classes - Database, User and Validator
I am very new to OOP and I am sure this code is very, very bad. I will appreciate if you review my classes and give me some advice to improve them. Any recommendations are welcome. I have also put ...
1
vote
1answer
118 views
C++ Design Struct vs Class [closed]
I am writing class CollectingClass which collects much data in private members and prints them out later.
To encapsulate all the private members, I decided to create a struct Data, keeping all the ...
0
votes
1answer
150 views
Making a Custom class less specialized but just as understandable?
In my C# program, I have a class defined as follows:
public class DbResult
{
public bool bSuccess { get; private set; }
public String Message { get; private set; }
private DbResult(bool ...
0
votes
0answers
138 views
Translation class with database back-end
From reading the faq, basically I would like if everyone could give me advice on all of the things enunciated there about my code (mainly design pattern usage and security):
Best practices and ...
1
vote
1answer
198 views
A Java BinaryTree class with extra methods need review
I am studying Data Structures course. So I would like to check whether my BinaryTree code is perfect, fine or has lots of mistakes.
I would like any kind of advice on this code. So I can learn from ...
0
votes
0answers
69 views
Which of ways to construct object is better?
Object, which is going to be constructed, has several constant. What of ways to place constants is better and why?
The first way is function for each member:
BarcodeObject::BarcodeObject() : ...