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)

4
votes
2answers
363 views

Use of a static class for a game engine

I've been designing a game engine for the past few months with little issues. However, one main goal with this project is to put it on my portfolio/résumé so naturally I want the code to be as good ...
1
vote
1answer
29 views

Method to parse store product details based on feed (CSV or XML or both) [on hold]

How can I refactor the following code? I have a method that receives a storeName parameter, and based on the store we parse a CSV file, an XML file or a CSV and an XML file together in order to ...
0
votes
0answers
31 views

multiple constructors and if's vs inheritence [closed]

Maybe someone know which way, of writing code is better(less memory,fastest for CPU or GPU). 1st way: Writing one class for all instances with several constructors and "IF's" checking which ...
0
votes
1answer
71 views

OOP PHP best practices

I've worked with PHP for a few years now and have a degree of understanding about classes / objects, but I've never written my own until now. In that vein then, I'm looking for a bit of confirmation ...
11
votes
3answers
755 views

License and Registration, Sir

The following code will generate a number plate and then generate a random speed and see if it's speeding ...
1
vote
0answers
29 views

PHP MIMEType class

There isn't a very reliable way (in my opinion) to get the mime type of a specific extension, regardless of the file actually being of that type or not. This type of thing usually is used when ...
2
votes
1answer
57 views

Using a class for reading config from files

The goal of my current piece of work is to read from a global config file all the settings and then from the local file only those settings that a user has chosen. Firstly I wrote a function but then ...
4
votes
2answers
111 views

Reflecting emotion classification based on the Lövheim cube

Background I created a simple class to reflect emotion classification based on the Lövheim cube. The code is not scientific at all, and I just did it for fun, but I want all code I write to be as ...
6
votes
3answers
174 views

Basic volume issue representation

I have the following struct: ...
3
votes
1answer
43 views

How can I ensure some structure for classes for a plug-in system written in Python?

I have written a toolkit (hwrt) which has a plugin system. One type of plugin is a feature (see this) for many of them. There are some restrictions of feature ...
2
votes
1answer
22 views

GSON parsing - nested classes or not

Today I was trying GSON after a while and went to the YQL console to run this query: ...
2
votes
1answer
30 views

Class for formatting topics using BBCodes

I'm developing a program for users from a VBulletin's forum. This forum has a lot of people interested in write good articles but some of them don't know how to use the formatting bar in his favor. ...
0
votes
1answer
90 views

User Registration

I'm fairly new to PHP and am very interested in learning best practices, etc. I have just created a user registration system mostly in OOP that will dump user info into a database I've created. This ...
3
votes
2answers
92 views

How to achieve less repetitions for applying the same method to multiple properties?

I am looking for generic ideas and guidelines of how to improve the style of my coding and make it more readable and robust. ...
4
votes
1answer
50 views

Class representing both cartesian and spherical coordinates

I have had little experience with OO programming, being a typical engineer I tend to hack together functional code. However, I'm trying to change that and I see value in implementing OO when modelling ...
1
vote
1answer
42 views

jQuery slideshow code - adding previous and next classes a better way

I have a slideshow in jQuery slideshow switching picture automatically every 5 seconds with CSS3 transitions. The current picture has the current class, the ...
0
votes
2answers
58 views

Insert into table class

This class should function as a simple insert into table. What do you think about it? How can I make my code better? ...
1
vote
0answers
45 views

Singleton request validator and sanitizor class

I have tried to code a PHP singleton class for validating multiple/single fields (sanitizing is optional). When validating single field, on success it will return 1 (...
1
vote
3answers
80 views

Coding on interfaces/superclasses not implementations

From pretty much any book I've read it always said to code on interfaces/superclasses and rarely on implementations, today though that advice made a bit confused about how I should format my code. ...
1
vote
2answers
154 views

Bank simulation using ArrayList

Problem Statement: Design a BALANCE class with account number, balance and date of last updation. Consider a TRANSACTION class with account number, date of transaction, amount and transaction ...
7
votes
0answers
93 views

UIntArray class in PHP (part 2)

This question is the follow up of the question: UIntArray class in PHP @Brythan provided a really nice review and I have improved my class. I have addressed almost all the issues he pointed out ...
0
votes
2answers
225 views

Connecting to a MySQL database with C#

Can anyone help me with checking this code? It is for connecting to a database. The method getFromDatabase is to take values from the database and put it to a ...
4
votes
0answers
88 views

Wrap function pointers in template classes

I'm working on a C++ library for Arduino and other embedded systems. I'm currently working on wrapping up function pointers and member-function pointers into two C++ template classes (function and ...
3
votes
1answer
105 views

Populating values into a C# object

I have written a function to populate values into a class whose structure is as given below ...
4
votes
3answers
332 views

Having two abstract (static inner) classes within the interface they implement

Is it wrong? Should I have these 2 classes in separate files? ...
3
votes
1answer
152 views

PDO wrapper class for database

I have my PDO Wrapper class and would love to get some more tips/opinions about what you think. This is my first class and I basically put my time into making it as logical and standardized as ...
4
votes
2answers
48 views

Should I create an abstract runnable? I've 4 sub-classes which perform similar work but only 3 of them have identical constructors

I've added the code for an abstract thread class and 2 sub-classes. The structure and job of the threads (sub-classes) is identical except one difference: ONE of ...
3
votes
2answers
80 views

SMTP client to send search results

I have the following working code to send search results via e-mail. Since we have segregated domains that cannot talk to each other, the program needs to support multiple SMTP servers. ...
3
votes
2answers
518 views

Class design for a student class

Problem Statement: Design a STUDENT class to store roll, name, course, admission date and marks in 5 subjects taken from user. Create an array of STUDENT objects. Provide methods ...
10
votes
1answer
145 views

UIntArray class in PHP

I have seen UInts being natively supported in other languages. PHP allows you to install a third party extension, but I can't do that ATM, so I've decided to create ...
1
vote
2answers
59 views

Simple interface and class for holding text to be analyzed

I am making a sentiment analysis library targeted first at social media text (like Twitter) and then I will expand it for more general use. For the first step I am making a simple interface and a ...
2
votes
1answer
205 views

Validating email addresses and phone numbers

I have the following code that I need help with refactoring: Validation class for objects you may create: Email address URL Norwegian Mobile Number (must start with 4, 9 or 59 and be 8 digits ...
3
votes
2answers
77 views

Select products and config values from MySQL

I have working code that gets products details and config values from MySQL bit it's combined with HTML, I would like to know a better way to do this, maybe a class that I can use. ...
2
votes
1answer
32 views

Could this connection and query class be improved?

Wrote this class it allows me to connect to database and display as many columns as I wish to. I can just give it desired parameters and I'm done. I've commented about the parameters that need it to ...
5
votes
3answers
137 views

Parameterised Constructors

Finally, Parameterised Constructors are possible in VBA. Background: One rainy day, I came up with an idea: take a static class and expose one property as default (like it was done in the Reverse ...
1
vote
2answers
66 views

Processing user input for a form

I'm still learning PHP OOP, so I'd like to seek for some expert advice or criticism regarding this code I created. In this script, I created the objects I need to process the user input from a form. ...
4
votes
1answer
55 views

Logger class for MVC Framework

I have created a logger class for my own framework. Now I am trying to identify the components which can be done in a better way. The logger class doesn't log anything inside a file but it logs the ...
6
votes
2answers
138 views

Basic C# calculator (+,-,*,/) - V2

Original question: Basic C# calculator (+,-,*,/) My 'teacher' requested this problem be solved by parsing the input into a tree based on the order of operations. The class Calc variables are ...
5
votes
2answers
298 views

Custom MySQLI Class

I have created this MySQLI Class. I wanted to know if this class is secure enough to be used on the production websites or more improvements can be done to this class. ...
10
votes
3answers
285 views

Basic C# calculator (+,-,*,/)

My 'teacher' requested this problem be solved by parsing the input into a tree based on the order of operations. The class Calc variables are specific to his ...
8
votes
6answers
1k views

Blackjack on console

I have decided to create a console Blackjack game as my final Java project. Please take a look at my code and give me some feedback. I have tried to make the game as object-oriented as possible. I ...
5
votes
2answers
225 views

User-defined class for a box

We have just learned about classes. Please help me improve this program. I created a class called Box with members that represent its dimensions. Then I calculate ...
8
votes
5answers
418 views

Simple LinkedList implementation

I am brushing up my Data Structure knowledge (for preparation for internship interviews) and I started by implementing a very simple Linked List class. This is by no means intended to be able to ...
2
votes
1answer
54 views

Class to get user information

I've just begun creating a class to get User information, and I'd like for it to be improved. The global variable $oConni is the database connection. ...
5
votes
1answer
60 views

Architecture for manager that gets shared among different components

It started with a simple log manager. Then I wanted to implement more features, for example printing the name of the component that send a message. Later on, I can think of giving each component that ...
2
votes
2answers
162 views

Simple Database Abstraction Layer

I'm learning PHP and currently object-oriented programming. I would like to get a feedback; how I'm doing so far. If I have bad coding that should be fixed immediately etc. I'd call this code an ...
1
vote
2answers
91 views

Writing a class for common block of code used in many other classes

In this I have written the setAnalyticsInfo() method. The code inside this is common to almost all other (30) classes, so I have created ...
6
votes
1answer
104 views

Deleting a user from a database

I was hoping if anyone could tell me if I'm doing this correctly, I know there are other questions like this but everyone codes different and I just feel that I'm not doing this right. I'm trying to ...
1
vote
1answer
56 views

PHP framework building: System Class (reads configuration .ini file)

I am building a PHP framework and would like to get some feedback on a few different sections of the project so far. I consider myself still a neophyte in PHP so I would like to ask if I'm going about ...
3
votes
2answers
128 views

PHP framework building: MySQL Connection and query class

I am building a PHP framework and would like to get some feedback on a few different sections of the project so far. I consider myself still a neophyte in PHP so I would like to ask if I'm going about ...