Core to Object-Oriented Programming (OOP), a class is a template for creating new objects that describes the common state(s) and behavior(s).
4
votes
1answer
77 views
Class responsibilities OOP design [on hold]
I'm having some questions on creating a design for simple approval workflow. Some arbitrary thing (ItemToApprove) needs approval process. Approval process begins ...
3
votes
1answer
39 views
A User class for visitors to register and log in to a site
I'm just looking for some feedback on my User class. The class is designed to handle users being able to register, login, and logout of the site. I'll be using it in conjunction with a forum I'm also ...
1
vote
2answers
31 views
Database fetch class
The active column in the database only contains a boolean. The country column contains ISO 3166 A2 codes (2 char). Do you have any advice on improving this class?
...
3
votes
1answer
45 views
Changing a user's password
I wrote this class for the project I'm currently working on. It's basically used to change a user's password. I'd like to know your thoughts on the basic structure/design of this class and how it can ...
0
votes
1answer
65 views
PHP framework building: initializer and object loader classes
I am building a PHP framework and would like to get some feedback on a few different sections of the project. I consider myself still a neophyte in PHP so I would like to ask if I'm going about ...
4
votes
3answers
151 views
Basic complex number class
As part of my C++ training, I wanted to create a basic complex number class for basic complex number calculations.
The class should have the following:
constructor (non explicit, for implicit ...
6
votes
2answers
54 views
Basic String class
I wanted to create a basic String class that will hold a CString and have:
constructor, destructor, copy constructor
...
2
votes
2answers
93 views
Bag data structure (a set that can store multiple copies of items)
I am trying to make my class a bit cleaner, especially some of its methods like Count, __add__, ...
1
vote
2answers
49 views
EF Code First Identity/Info Storage
I've built this EF for storing data for web scraping. Any ideas? What am I missing?
...
3
votes
1answer
40 views
Immunity of login/signup class to all types of attacks
I am going to use the following class which is very simple to use and get user info in pages:
...
1
vote
2answers
48 views
Generic 2D engine for simulation
I'm using SFML to manage my windows and I'm writing this engine to visualize some PSO work. I'm trying to make it generic enough that I can extend it for other simulations later on and keep it as ...
2
votes
1answer
94 views
Single Responsibility + Entity Framework
I still feel like I struggle to grasp some concepts of SOLID principles at times, and am hoping for some clarification here.
The following classes are entities in an Entity Framework project.
...
16
votes
2answers
1k views
The grid looked at the menu and said “Something with class, please”
This is a follow up on my previous question:
A grid and a menu walked into a program
I integrated classes into the mix.
The program now asks how big you want the grid to be.
...
4
votes
2answers
130 views
C# static class holding list of member class instances
I was wondering if such a design was a bad idea in C#. Here I have a static class EventLog which holds a list of instances of ...
1
vote
1answer
36 views
Prompting the user for employment information
I have created a simple program in which the user is prompted for various details about their employment. In my Employee.java file, I have all the methods.
Employee.java:
...
2
votes
2answers
96 views
Timecode class design
I've created a Timecode class. The "timecode" that I'm trying to represent is a timecode that is used in video editing quite often, and is seen displayed in the ...
4
votes
2answers
499 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
49 views
Method to parse store product details based on feed (CSV or XML or both) [closed]
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
1answer
85 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
791 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
33 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
73 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
135 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
185 views
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
36 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
32 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
99 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 ...
5
votes
2answers
105 views
Applying TrimSideSpaces() method to multiple string 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
56 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
56 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 ...
1
vote
2answers
65 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
50 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
92 views
Coding on Point interfaces/superclasses instead of 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
385 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
100 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
427 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
99 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
128 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
339 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
172 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
64 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
85 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
803 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
148 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
670 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
91 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
166 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 ...