All Questions
433 questions
5
votes
2
answers
5k
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?
File graph.hpp
...
2
votes
1
answer
4k
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:
...
3
votes
1
answer
194
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: ...
2
votes
3
answers
304
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
1
answer
2k
views
Implementation of a Vector3D class
I'm an amateur coder writing a geometry library in Python, and would like some feedback regarding my implementation of a class for 3D Vectors.
My priority is to have a really friendly API for ...
3
votes
1
answer
399
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 ...
8
votes
4
answers
3k
views
Poker game classes
I've built this two classes for a Poker game on Android and I would appreciate some feedback on my code.
Have no mercy. The harsher you are, the better.
Feel free to add your number of WTFs/minute.
...
4
votes
1
answer
876
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
2
answers
708
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:
...
2
votes
1
answer
183
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 ...
4
votes
1
answer
572
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
2
answers
1k
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 ...
3
votes
2
answers
1k
views
Authentication Class
I've wrote this class in PHP for my future projects:
...
3
votes
1
answer
2k
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
1
answer
198
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 ...
6
votes
1
answer
4k
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 ...
3
votes
1
answer
433
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 ...
4
votes
1
answer
1k
views
Wrapping bound methods
I've written this small class in Python that wraps bound methods but does not prevent the deletion of self.
Do you have any thoughts on my code?
Do you think I handle errors appropriately?
Is it ...
7
votes
3
answers
6k
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.
...
4
votes
3
answers
2k
views
Static class member destruction in C++
I have a basic cache set up. Whenever a user requests a bitmap, it fetches or loads it from disk if it isn't already loaded, significantly reducing load times.
Currently, the design explicitly tells ...
3
votes
1
answer
236
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 ...
3
votes
1
answer
487
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 ...
8
votes
2
answers
1k
views
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 ...
3
votes
1
answer
1k
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 ...
3
votes
1
answer
246
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 ...
3
votes
3
answers
331
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 ...
8
votes
1
answer
216
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?
...
5
votes
2
answers
529
views
Splitting code, am I doing it right?
I would like to have my code reviewed, I'm trying to get a general model I'm using for my stuff going and I don't want to keep using wrong or inefficient code if I can.
My file structure is like this:...
11
votes
2
answers
759
views
Object Paradigm for PHP, Practice in Design
I've created and I manage a point of sale web application built in PHP which has thus far followed no clear guidelines or methodology for development; it's operation is completely procedural. In turn, ...
12
votes
6
answers
1k
views
Class for holding person's information
I have written another program in C++. Excluding the point that the class definition should be in a separate header file, is there anything that needs to be improved?
...
13
votes
6
answers
2k
views
"Do you owe the government?" classes
Should my class pass parameters internally or reference class level scoped variables?
I'm not sure on the best approach or style for procedure calls that have parameters. Should I go with the class ...
11
votes
5
answers
2k
views
Simple ASP.NET C# class design
Here's a class I'm designing:
...
18
votes
2
answers
802
views
Cleaning up class creation / extension
I was wondering for quite some time how to clean up the below code without blowing it up any further. The extension of the classes is the main concern here, it looks a bit too much like magic. That's ...