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

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 ...
1
vote
1answer
180 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
218 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
115 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
402 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
468 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
vote
1answer
180 views

PHP Lazy loading with __get - yay or nay?

I have my own PHP MVC framework that I'm iteratively developing (i.e. adding a feature when I have the time). I'm trying to keep it to the best practices I can, while still adding the most in terms of ...
3
votes
2answers
190 views

JavaScript (multiple) inheritance / mixins

I'm quite new to JavaScript, and I'm trying to understand the idea behind inheritance in JavaScript. I've read a bit about it, and I don't want to mess with prototypes (which I don't yet fully ...
0
votes
0answers
106 views

Implementation of Javascript Classes and Inheritance

I've created a simple Javascript library to be able to create "classes" and extend them defining instance and static methods and variables. It consists in a simple function Class with two methods: ...
3
votes
2answers
117 views

Style comments please on my timer class, which I hope will be a pattern for other classes

I'm a relative noob to Python. On a range of 0 to 10, where 0 is a complete noob and 9 is Guido, I'd put myself as 1 aspiring to 2. So I wanted a timer, rather like the Visual Basic object, and I ...
1
vote
1answer
1k views

how to properly use database connections in PHP classes

I need some advice\suggestions on how to create\handle database connections for a project I'm working on. I'm creating a simple work order system for my company using PHP 5.4.3, right now there isn't ...
2
votes
3answers
196 views

Am I utilizing classes and OOP efficiently?

In my last question on Stack Overflow I was a very confused newcomer about classes and OOP and how to correctly implement everything to make things easier. So I started a different example to ...
2
votes
1answer
129 views

What could be improved in this implementation of a Vector3D class?

[EDIT #1: Read more of the meta, editing to remove the impression I might be looking for "micro benchmarking code golf", I really just want general feedback and thought an experienced coder might see ...
3
votes
1answer
176 views

PHP, would this class pass the single responsibility principle?

I have a user class comprised of the code below. It has functions to insert a user, update a user, delete a user, look up a user, and search for users. What I'm wondering is if I this class would pass ...
1
vote
0answers
994 views

Database Handler - Dynamically create “mdf file” and tables from classes (NEED HELP/SUGGESTIONS) [closed]

I'm trying to create a handler that first of all creates a "mdf" file, which I later connect to. Then I can add tables from a type, that gets all its properties and values. So a class with 2 ...
1
vote
2answers
837 views

Is this good class design (OOP PHP)?

Explained what I'm doing in the comments: class User { public $id; public $email; public $username; public $password; public $rep; public function __constructor($id, $email, ...
4
votes
1answer
396 views

C# Class of client methods for interacting with web servers

I'm in QA Automation, and C# isn't my first language. I've written a small class of methods for GETting and POSTing to web URLs. I use these when I want to test certain things that really fall outside ...
2
votes
3answers
256 views

Communication between two classes in ruby

I cannot understand how I can make two classes work together by passing variables between them. During the last 5 days, I learned the basics of inheritance, singleton methods and eval methods. I even ...
1
vote
2answers
163 views

Ruby - class definition for connecting to external API

I've defined a Client class to connect to an external API. The Client class will return XML responses for various resources. Here's what it looks like now: require 'nokogiri' class Client ...
2
votes
1answer
145 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 ...
3
votes
1answer
276 views

How to convert my classes to Dependency injection?

I am still learning to develop my skills in OOP. It uses a combination of the factory and its real singletons? As I did more research, I have realized this design pattern is bad because of global ...
4
votes
2answers
685 views

Returning Groovy class fields as a map

I want to get a map of all the fields in a class (aka value object) in a generic way. The following works fine for me: class Baz { String foo = "foo2" int bar = 2 public Map asMap() { def ...
4
votes
2answers
237 views

Is it a good practice to wrap datatypes in custom classes?

So in my current application, I was thinking to make a extended class for all the datatypes. For int, it will be something like ExtendedInt, for bool it will be something like ExtendedBool. These ...
3
votes
2answers
720 views

Authentication Class

I've wrote this class in PHP for my future projects: <?php /** * Auth * This class is used to securely authenticate and register users on a given website. * This class uses the ...
3
votes
1answer
787 views

C#: Simplfy code using Interfaces + business rules / validation

I have a workflow; within the workflow I can have many stages. I want to open and close a stage based on some business rules. E.g., stage 7 cannot be opened, because stage 5 + 6 need to be closed ...
2
votes
1answer
130 views

Best way to Structure class + Instantiation

Is this a good way to design a class so I can prevent values being changed/ the state must remain as it was when it was intantiated... This code would be normally instantiated after a call from the ...
4
votes
1answer
249 views

Should I split class or keep it all in one?

Currently, in my project I have one class that is dedicated to the all of the queries for the IBM i and converts it into usable models for my .NET code. There is already 12 methods in this class and ...
2
votes
2answers
335 views

beginner's class inheritance question C# VB Visual Studio 2010

I understand the typical example of fruit as a base class and banana, orange, and pear as derived classes. But what about when there is only one property in common? Do you still use class ...
3
votes
1answer
245 views

“Class” design in javascript

I'm a systems programmer teaching myself javascript. Prototypal inheritance is completely new to me, so I could use some best practices advice here. I made a simple game (breakout) for my first ...
3
votes
1answer
141 views

How do my improvements look? Any suggestions for improving the class?

I recently posted a thread looking for feedback on a script I wrote (see: How can I make the following code better, more efficient, shorter, elegant, etc? ) Since then I have re-written it into a ...
2
votes
1answer
53 views

RegEx Code Organization

I've written an algebraic notation to use for moves in a game and I'm currently writing code to parse the information from the notation. I'm doing this using regExes. This is coded in HaXe. For ...
1
vote
2answers
217 views

What can I do to make this class better?

I'm 100% sure improvements can be made. Any help is greatly appreciated. I should add that I am new to OOP and am not sure if I'm using this the right way. <?php defined('_VALID') or ...
2
votes
1answer
598 views

Database class design

I'm writing a SQLite wrapper for C++. I have this class representing a database: class Database { sqlite3 *db; public: Database(const std::string& file_path, bool readonly = false) ...
2
votes
2answers
2k views

How to improve performance in this database connection class?

This is my general database connection class. I am using this class to execute my queries through website. What would your suggestions about this to improve performance. Thank you. MSSQL 2008 R2 SP1 ...
4
votes
1answer
226 views

Python, WeakBoundMethod

I've written this small class in Pyhon that wraps bound methods but does not prevent the deletion of self. Do you have any though on my code? Do you think I handle errors appropriately? Is it missing ...
0
votes
0answers
1k views

Gmail Contacts API Connection Review

I created this class that connects to gMail contacts, and enables you to add/edit/delete the contact. Curious to see what others think of my code... if you see any areas for improvement, that would ...
6
votes
3answers
817 views

New to OOP; is this a good class design?

I have a few different classes in my application, but this specific class is the one I'm interested about. Please review for good practices and potential problems. using ...
2
votes
3answers
496 views

C++ Static Class member destruction

I have a basic cache set up where whenever a user requests a bitmap it fetches it or loads it from disk if it isn't already loaded, significantly reducing load times. Currently the design explicitly ...
2
votes
1answer
139 views

How would you ruby-fy this non-AR model class for Ruby on Rails app?

This is a class from my rails application. It is used as non-database model in my RoR application and uses syntax similar to AR design pattern. I wonder is there a way to make this look more like Ruby ...
6
votes
0answers
379 views

How can I manage different problems in Math Quiz?

Ok, this will be the first question for this project. This is a Math quiz system. Always must generate different problems for each problem, but at the same time, I have to generate the same exam for ...
2
votes
3answers
402 views

Is there a better way to do what I've done?

I've created the following class to persist data by serializing/deserializing objects that are sent to it. I would like to know if there is a better way of writing this class, or if my class is fine ...
0
votes
3answers
425 views

C++ Alternative to Template Class

I have a class Matrix to handle Matrix Vector Multiplication. Class Matrix has many sub-classes, each of them has different data structure and performs multiplication differently so I write: class ...
2
votes
1answer
386 views

Improve OOP code

I am learning OOP and have written a class for Likes. There is a load, add, delete method and I think this code can be improved since there is a lot of duplication. Please let me know how I can ...
5
votes
2answers
367 views

Please review this C-style array class

I often use C API's in C++ that force me to use C-style arrays. I got sick of constantly using a dynamic vector with &vec[0], so I wrote this C-style array container. Please review and give ...
1
vote
1answer
460 views

Javascript filter class to hide and show content on data-attributes

I'm a hacker, not a trained engineer. I ask/answer specific questions on StackOverflow and am pretty confident in my ability to get the browser to do what I want, I thought I could benefit a great ...
2
votes
1answer
160 views

Refactor a subroutine that divides date range into quarters.

The subroutine below, GetDetailsQuarterly, accepts two dates. Then it writes out each quarter that falls within the date range. It also gives the first and last day of the quarter. I really don't like ...
0
votes
3answers
289 views

PHP, Is creating a class for templates to much?

I am new to using classes heavily, and was wondering if going so far as to create a class specifically for templates was going to far. Here is a simplified version of my class template. Yes, I know I ...
4
votes
1answer
145 views

Simplifying a Resizing Method

I'm making a simple container class for fun and education, but my rebuilding/resizing method seems rather inefficient. Is there an easier way to do this? // If FromFront is true, cells should be ...