Construct that is used as template for creating new objects. Class describes the state and behavior that the objects of the class all share.
1
vote
0answers
22 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
53 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
85 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
342 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
votes
0answers
32 views
Object Oriented PHP - mysql database manipulation [closed]
Been working with this code but it won't run. Please help me find the problem with this.
THis is my class :
<?php
class mysqlcon
{
private $connection;
private $database;
public $query;
...
4
votes
4answers
141 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
1answer
98 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 ...
1
vote
2answers
64 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
63 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
40 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
42 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
42 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
2answers
112 views
Python class review - wiki api getter
First, 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 ...
2
votes
3answers
106 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 ...
3
votes
2answers
86 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 ...
1
vote
2answers
93 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
79 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
78 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 ...
5
votes
2answers
190 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 ...
4
votes
1answer
186 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 ...
-1
votes
1answer
91 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
263 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:
...
0
votes
2answers
73 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.. ...
4
votes
3answers
185 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
...
0
votes
0answers
45 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
59 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
0answers
255 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
330 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 ...
0
votes
0answers
101 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 ...
5
votes
1answer
101 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 ...
3
votes
2answers
233 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).
...
2
votes
1answer
130 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 ...
0
votes
1answer
248 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 ...
1
vote
1answer
107 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
139 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 ...
1
vote
1answer
184 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() : ...
2
votes
1answer
144 views
Set of classes for generating social plugins, is my design correct?
I've created a set of classes thatwork together to create the html needed to display social plugins like Facebook like, google plus and twitter.
At firsti defined an abstract class ...
1
vote
2answers
65 views
Request for help to tidy up code involving arrays and loops
I posted the following code on here a few days ago:
public class Practical4_Assessed
{
public static void main(String[] args)
{
Random numberGenerator = new Random();
int[] ...
2
votes
2answers
135 views
Subclassing or not?
I have a class called Foo
public class Foo {
private String optionalProperty;
private String name;
private long uniqueId;
// getters/setters for above properties
}
For some ...
1
vote
1answer
90 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 ...
3
votes
1answer
503 views
How to improve Try…Catch Block for PDO?
I have written a PDO wrapper and a class file like a model. So far, it's looking so good! I am just confuse where I should put Try...Catch block - Would it be better to place in PDO wrapper ...
4
votes
2answers
263 views
Validation Class - Feedback Welcome!
I have written a Validation and Form class in PHP.
Validation class allow you to define the rules of each field and a error message.
Form class allow you to get a error message and also allow you ...
4
votes
1answer
92 views
Attempt at an implementation of a TextFile class
How can I improve this class that should represent a text file?
Im trying to write a simple class to represent a text file - which one would think should be quite easy.. I don't intend to add all ...
2
votes
1answer
244 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, posts, comments.
This is a simple database.class.php:
class DB {
...
3
votes
1answer
115 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 ...
5
votes
1answer
109 views
ClassHierarchy Design in java for a small project
I have written a java code which does following:-
Main goal is to fetch emails from (inbox, spam) folders and store them in database. It fetches emails from gmail,gmx,web.de,yahoo and Hotmail. ...
1
vote
1answer
283 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:
echo Config::get('database.host');
// Returns: ...
3
votes
1answer
179 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 BulkManager depends on params of each Table I create the BulkManager in ...


