Core to Object-Oriented Programming (OOP), a class is a template for creating new objects that describes the common state(s) and behavior(s).

learn more… | top users | synonyms (1)

7
votes
1answer
547 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. ...
3
votes
1answer
367 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, ...
4
votes
3answers
469 views

Random number generation in Dice class

I don't intend on implementing this into an application yet as I'm going to test it first. As such, it doesn't do much beyond rolling. It also overloads some "typical" operators such as ...
7
votes
4answers
3k 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 ...
10
votes
2answers
2k views

Card Deck class for a Poker game

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 ...
2
votes
3answers
234 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 ...
0
votes
2answers
2k views

Is this good class design (OOP PHP)?

Explained what I'm doing in the comments: ...
10
votes
1answer
816 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: ...
3
votes
2answers
164 views

Trying to use classes in my python code. Not sure if being done correctly

The point of my code is to: Read in the observed data from the a catalog of stars (whitespace separated table). Do some unit conversions on the observed data (math stuff). Apply an interstellar ...
3
votes
2answers
332 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 ...
11
votes
2answers
741 views

Is it wrong to write an entire program under one class/method in Java?

I'm new to programming and have 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 ...
7
votes
2answers
206 views

Cleaning up and commenting on my code for Pong game

This post is a follow-up to When should I consider the number of my method arguments too big? I took the some advice from previous post and I'm almost done with cleaning up the code. I didn't make ...
7
votes
2answers
410 views

Improving remake of factoring/prime factorization calculator

Background info on factoring and prime factorization. I've remade this program from my first attempt, and I'm sure it can still be improved. My questions: These calculations should only be done ...
3
votes
1answer
369 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 ...
10
votes
1answer
326 views

When should I consider the number of my method arguments too big?

I'm writing a simple Pong game, I have a method bounce() that makes everything run: the ball, the paddles, score etc. and it uses 12 arguments: 3 counters, 2 ...
5
votes
2answers
92 views

Initiating class objects and arrays

I have a class that always has 14 instances. I'm just wondering if there is a better or more effective way of doing this. In this class I also have an array that is filled by calling 4 functions ...
4
votes
3answers
337 views

Nested class or two separate classes?

I am making this program that is going to calculate distance from randomly generated dots (with x and y coordinates) to 5 bigger ones and then its going to put each smaller dot into the group with ...
3
votes
1answer
1k 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: ...
3
votes
2answers
992 views

Authentication Class

I've wrote this class in PHP for my future projects: ...
2
votes
1answer
61 views

Generate the Norwegian equivalent to social security numbers

This is just a little hobby project I've been working on. I've been using it to learn/improve my knowledge of C++. The program generate Norwegian personal-numbers (11 digits) for males born a given ...
2
votes
1answer
80 views

Best structure for a Person in PHP classes (and databse)

I am (in the process of) creating a system to store People and their details - names, date of birth (dob), addresses, phone numbers, etc. - and I'm curious how it is best achieved. Below is an an ...
2
votes
3answers
211 views

Simple class exercise using the “this” pointer

This is my solution for an exercise from a book. It's a simple Golf class with member variables fullname and ...
2
votes
1answer
125 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
158 views

Classes for Facebook graph API and Twitter access

Given below is code which I wrote to provide an easy access to Facebook graph API. ...
1
vote
2answers
97 views

Is this a 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 ...
1
vote
1answer
98 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 ...