Construct that is used as template for creating new objects. Class describes the state and behavior that the objects of the class all share.

learn more… | top users | synonyms

1
vote
1answer
83 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 ...
3
votes
4answers
103 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
55 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
62 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
39 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
41 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
3answers
103 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
91 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
76 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
77 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
84 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
188 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
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
236 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
150 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
68 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
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
54 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
234 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
329 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
98 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
181 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
181 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
235 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
127 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
105 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 ...
0
votes
0answers
90 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
175 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() : ...
1
vote
2answers
63 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
109 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 ...
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 ...
4
votes
2answers
244 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 ...
3
votes
1answer
456 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
1answer
88 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
242 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
113 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
108 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
271 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
177 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 ...
1
vote
1answer
178 views

How can I improve upon my SharePoint Class?

To help learn the SharPoint Object Model (Primarily for SharePoint 2007) I've been working on a class library with a number of useful functions. I'm a junior developer and this is my first C# project ...
5
votes
2answers
136 views

Improve/Correct PHP Class

I'm looking for code correctness and improvements for the following code. It's my first step into class based programing. What the class does, is simply to read a directory (path is passed as ...
5
votes
1answer
217 views

Javascript inheritance

I have a simple class inheritance in JS: var Class = function(){}; Class.extend = function(){ var Extended = function(constructor){ function extend_obj(destination, source) { ...
1
vote
2answers
112 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 ...
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 ...
3
votes
2answers
369 views

STL-like graph implementation

I have implemented an stl-like graph class. Could someone review it and tell me things that I could add to it? Thanks in advance. File graph.hpp #include <vector> #include <list> using ...
2
votes
1answer
419 views

Class with methods to retrieve data with Linq to sql

I think here is something wrong with code. I use a class with methods to get tenants from DB: public List<CrmTenant> GetAllTenants() { List<CrmTenant> tenantsList = new ...

1 2