Tagged Questions

Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.

learn more… | top users | synonyms (1)

4
votes
2answers
20 views

PHP Usersystem basic class

I've recently picked up OOP in Java and I'm trying to use it for my PHP usersystem. I've come up with the following generic.class. On my main site, I'll simply put ...
1
vote
1answer
14 views

Lua program to clean up phone numbers

How idiomatic is my code? Since Lua does not have classical inheritance such as in OO languages. Feedback on the test and implementation are both appreciated/welcomed. The rules are: If the phone ...
1
vote
2answers
56 views

Simple deck of cards

I had recently completed one programming challenge where I've had to design a deck of cards. The time was limited but I tried my best. I designed the basic operations and am wondering if I can improve ...
1
vote
0answers
46 views

OOP bank database

I have been working on this: Design a class for a bank database. The database should support the following operations: ❍ deposit a certain amount into an account ❍ withdraw a certain ...
1
vote
2answers
63 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 ...
3
votes
3answers
54 views

PHP Bilingual Error System Ideas

I am building a php based mobile website that must be in both Spanish and English. This is my first bilingual site so I've been having to re-think a lot of coding practices I currently use to ...
1
vote
1answer
29 views

Using composition or inheritance to enhance this linked list

Problem Statement: A method called insertEnd() exists, but it runs in linear time, because every time it is called, it walks down the list to find the end. Without changing the meaning of this ...
0
votes
2answers
50 views

Dynamic connections classes

I have an abstract Connection class which looks like this: ...
5
votes
0answers
70 views
+100

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
1answer
46 views

Including a page specified in query string

This is how I include a page depending by name. Example URL: http://www.page.com/index.php?page=admin where ...
2
votes
0answers
29 views

Content management system for teaching PHP OOP to beginners

I created this basic content management system to teach object oriented PHP to beginners. However, I have concerns if I violate solid principles in App.php and Router.php. GitHub App.php: ...
2
votes
1answer
65 views

ArrayList for Shop implementatin

Problem statement: Design a system for the following scenario: An item list contains item code, name, rate, and quantity for several items. Whenever a new item is added in the list ...
0
votes
0answers
24 views

PHP Dependency Injection - magic methods injections?

I'm trying to get my head around DI. Am I doing it correctly for classes that follow DI pattern? ...
0
votes
1answer
42 views

Image manipulation PHP class using PHP's Image Functions

I am working on an image manipulation class for a project to re-size uploaded slider images to 780 X 397 and uploaded avatar pictures to 220 X 220. I am wondering if this is a good way to construct ...
10
votes
3answers
96 views

Creating an object oriented model in VBA using COM and ADODB from 2 depended SQL tables

The story... A bit of background info and how is the database designed... Please notice you don't really have to rebuild the tables in SQL but I shared an SQL Fiddle just in case and screenshots1 of ...
2
votes
2answers
245 views

c# best way to declare a class-level value in base class and set it at derived classes [closed]

I have a root class and I'd like to add an indicator to it (property, static field, readonly field, virtual method or something like that), that should give me the same string value for every instance ...
3
votes
1answer
80 views

Populating values into a C# object

I have written a function to populate values into a class whose structure is as given below ...
5
votes
2answers
69 views

Generic Object Pool in C#

I have a limit of 100 sessions (each session held in an object). Many threads will be requesting sessions, and it is very possible that all 100 sessions could be in use at any time. I'm a Junior ...
3
votes
1answer
33 views

Objects/closures for storing movie information

I'm currently in the process of learning JavaScript and what it has to offer. I thought writing a simple web app that would allow me to add/remove/show my favorite movies would be a nice learning ...
10
votes
1answer
165 views

Object to object mapping verification - is this extension method useful?

In our .NET tests we use NSubstitute & ExpectedObjects. Testing object expectations involves hand crafting large anonymous ...
0
votes
1answer
71 views

Converting Ocean to RunLengthEncoding object

For the problem statement shown below: Part II(b): Your run-length encodings will only be useful if other classes have the ability to read them after you create them. Therefore, implement the ...
4
votes
2answers
39 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 ...
6
votes
1answer
78 views

Navigation bar built from fetched JSON data

I have finally been able to create my little navigation plugin in an object-oriented way that reads the li from a JSON file. Now, is my code efficient? Especially, ...
1
vote
1answer
46 views

Does RunLengthEncoding class provide abstraction and encapsulation?

This review is in continuation with Part I mentioned in query. As part of the assignment given in Part II from this link, here is the solution: Ocean ...
2
votes
2answers
51 views

Change the navigation ul li based on the clicked country

I'm trying to create a very simple jQuery plugin in the object-oriented way. Now, I'm not sure whether the code I produced is correct and efficient OO programming. The plugin's aim is to change the ...
1
vote
1answer
33 views

Detecting Windows Phone and Tablet clients

This is called from a VF page, styleClass="{!IF(isWindows8Device, 'windows', 'not_windows')}" So if it's a windows device, return true. The best thing to do ...
10
votes
1answer
140 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 ...
8
votes
1answer
139 views

Speed, distance and time calculator

This is a speed distance and time calculator - the comments should explain most of the odd looking code if there is any. I am looking for suggestions to improve the efficiency of the program and how ...
7
votes
2answers
175 views

Abstract classes and interfaces in a game inventory system

After reading a lot about interfaces, which I'm new to, I've tried implementing it in my inventory system for a game I'm working on. I have managed to create something proof of concept which seems to ...
2
votes
3answers
69 views

Is usage of friend class appropriate in this case?

I want to have a class that stores data from an input file, for use in a simulation program. It is like a struct but may require some small functions for accessors. A seperate class reads all the ...
7
votes
2answers
175 views

Does this simulation follow abstraction and encapsulation?

This below code implements a simulation of an ocean(as 2d-array of cells) which currently have Shark, fish or be Empty. User can run this simulation, as shown below: ...
3
votes
1answer
67 views

Getting a value from a database table dynamically

I am trying to create a forum using php in a MVC architecture. This is my database setup: Table: forum_categories ...
4
votes
2answers
55 views

LiveTime Object Literal

I have a website that retrieves time data from any given location on the world live. I wanted to be able to automatically change the time and not deal with the hassle of local client times. It's ...
8
votes
1answer
195 views

Solar System model: Moving Space Balls

I have a model of the solar system that I'm working on at the moment. Now is the time to start cleaning my code up a little. Here's what I have so far: A main 'driver' method: ...
5
votes
2answers
58 views

Solving first- and second-degree degree polynomials

I was writing a bit of code and I was just wondering if I was doing it the right way. I know all the syntax is right and It all works perfectly. I was just wondering if I'm doing it the right way. ...
0
votes
0answers
6 views

Getter within loop returning null after assigning values [migrated]

I've got a slight problem with my program. Simply put, what I do is this: Choose the option to "Add a new Student record". When I try to display the newly added values (First Name, Last Name, ...
5
votes
3answers
109 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 ...
2
votes
1answer
37 views

Naming a function and its parameters for adjusting a queue

I have a function that takes all items in a queue and increments their order (used to allow insertion earlier in the queue). ...
3
votes
2answers
69 views

Can I further secure this blog post loading script?

The following code is developed around a mysql database where the posts table has 3 columns: post_ID, date and title. config.php holds the values for $dsn, ...
6
votes
5answers
158 views

DP solution to min triangle path

I am studying for interviews for various companies. I wrote a solution to this problem, but if an experience programmer looks at it I am sure there are certain areas the code can be made in to a more ...
1
vote
1answer
39 views

Orange Tree simulator

I'm practicing SOLID principles and the concept of making a clear distinction between an object's private and public interfaces. ...
5
votes
3answers
438 views

Trip Advisor - Train routes

Gives advice to the user on which trains to take to reach a destination ...
3
votes
1answer
89 views

Example String Class in C

I wrote this small example piece of OOP being implemented in pure C. I wanted it to be reviewed for the following points: Portability Performance And especially Usability "How does it look" ...
6
votes
1answer
75 views

Bowling scores in Ruby

A little while back, I wrote in a review of a Ruby bowling sim that I might try my hand at modelling the game myself, focussing on the funky "deferred scores" system. Since a2bfay, who posted the ...
7
votes
1answer
84 views

Multiplayer bowling in Ruby (follow-up: injection, single responsibility)

This is a multiplayer bowling simulator in Ruby. It allows for variable skill levels, and produces weighted random results for each player's rolls based on those skill settings. This is a complete ...
8
votes
2answers
87 views

Generating and calling code on the fly

Delegate This class module defines what I'm calling, in this context, a Delegate - here a function that can take a number of parameters, evaluate a result, and ...
5
votes
3answers
355 views

Would I be better off re-factoring out these switches, in this case?

After I completed writing this code, I started to wonder if the switches should be replaced with a more OOP approach. I originally picked the switch approach because there will never be anymore skill ...
2
votes
1answer
37 views

Optimizing mcrypt encryption class further

The following is a very simple implementation of an Encryption class using mcrypt whereby the functions encrypt and ...
18
votes
7answers
3k views

Basic OOP Poker - Deck, Cards and Hands

I decided it would be interesting to simulate a game of Poker. Baby steps at the moment, and eventually I'll attempt to turn it into a GUI. The code I have so far is very basic such as populating a ...
3
votes
2answers
66 views

Booking validation in a big if-elseif block

I have pasted a part of my event handler code block. I understand this code really looks like a mess specially the object that is created every time the message is changing. Is cleanup possible in ...